Page 2 of 2

Re: Capri 1.16 beta release!

Posted: Thu Nov 06, 2014 6:08 am
by max
KemyLand wrote:Didn't noticed this topic #-o I was excepting it long ago :wink:
Feel free to give it a try, happy to hear critique! :)

Re: Capri 1.16 beta release!

Posted: Sat Nov 22, 2014 11:30 am
by zhiayang
HELLO MAX

After using makefiles for years, I've finally decided to switch, because they were mostly giving me headaches.
I have to say, in 20 minutes of using Capri, it's effing-fantastic.

Three things though:
1. Is it possible to define a variable at top-level of a Capri script 'statically'? Right now I'm trying to have a so-called 'project directory' using File.getCurrentDirectory(). Unfortunately, including this root-level build.capri script recomputes the function call, so I can't get a statically defined variable like that without hard coding it...

2. Somewhat related to (1), is it possible to dynamically import scripts at runtime? For instance looping through some files in a folder and calling import "{file}"; would be really cool!

3. Bug report... Unfortunately. Doing something like this:

Code: Select all

task all depends build, buildLib;
task build depends compile, link;

task compile { ... }
task link { ... }
task buildLib { ... }

somehow results in a "dependency failed for task 'all'"... except both compile and link are actually called, and return true.
After some digging, replacing

Code: Select all

task build depends compile, link;
with

Code: Select all

task build { compile(); link(); }
Solves the issue. Just a small bug, not exactly disastrous but hopefully worth looking into, yes?
Thanks! You have successfully rid me of my makefile addiction, hopefully this goes open source soon!

Re: Capri 1.16 beta release!

Posted: Sat Nov 22, 2014 12:07 pm
by max
Hello requimrar :)

Thanks a lot for the kind words and the feedback. Happy to see that its of use for others!

1. Could you give me an example? Yes it is possible to create a variable, task or simply write statements in the global scope.
2. Not yet, I've added it to my list :)
3. This is indeed not the way it should be, but I have a suspicion. Will update once fixed.

You can already get the sources in the capri release folder. I'm working on a website with a documentation, and also a public repository :)

Greets, Max

Re: Capri 1.16 beta release!

Posted: Sat Nov 22, 2014 1:03 pm
by zhiayang
Hey max, thanks for your quick reply.
To clarify, what I meant by the first point was this: say I have this code in "toplevel/build.capri"

Code: Select all

projDir	= File.getCurrentDirectory();
sysroot 	= File.getAbsolutePath("{projDir}/build/sysroot");
Of course, this also defines a few more global variables like CXX etc, for convenience.
In "toplevel/sublevel/sublevel2/build.capri, I have this:"

Code: Select all

import "../../build.capri";
...

somethingRandom = "{sysroot}/usr/include";

What happens here is that 'sysroot' in the second file is computed using its context, meaning it is essentially

Code: Select all

File.getAbsolutePath("{File.getCurrentDirectory()}/build/sysroot");
This means {sysroot}, to the sublevel capri script, is not 'toplevel/build/sysroot', but instead 'toplevel/sublevel/sublevel2/build/sysroot'.



PS: What can go inside the string-substitution curly braces {}? Just variable identifiers, or are arbitrary expressions (function calls) also allowed?
PPS: I might have another bug:

Code: Select all

task something depends somethingElse
{

}
The task 'something' doesn't work properly in this case, I need to manually call somethingElse() from within it...
Anyway, it's still a fantastic job!

Re: Capri 1.16 beta release!

Posted: Sat Nov 22, 2014 1:12 pm
by max
Oh, I see what you mean. This issue happens because getCurrentDirectory returns the directory in which capri is currently working in = the executed script location; anything that is imported is executed as if it was in the same script. I'll add something to work around this.

For the second thing, I've messed something up with the dependencies (as your previous example shows), I'll have a look over this stuff.

Thanks a lot for your feedback. Will add an update once this is fixed. ;)

Re: Capri 1.16 beta release!

Posted: Sun Nov 23, 2014 1:38 am
by zhiayang
Thanks! (also, would it be possible to release a text mate syntax file for capri?)

Re: Capri 1.16 beta release!

Posted: Wed Dec 03, 2014 2:37 pm
by max
requimrar wrote:Thanks! (also, would it be possible to release a text mate syntax file for capri?)
I'll create a BNF for Capri, I've never written a textmate syntax file, but feel free to contribute if you made one ;)
Sorry for the late reply, was sick, now working on bugfixes. :)

EDIT: Ah, to
requimrar wrote:PS: What can go inside the string-substitution curly braces {}? Just variable identifiers, or are arbitrary expressions (function calls) also allowed?
You can put any expression in there, everything in there is interpreted and the return value (or for a simple variable the variable value) is inserted right at that location.
For example, a "Hello world" can be this:

Code: Select all

task print {
	Utils.print("Hello ");	
	return "world";
}
Utils.println("{print()}");