-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declarative build syntax #1
Comments
Discussion on ceylon-spec to be able to cross-reference named arguments ceylon/ceylon-spec#749 and to be able to define your own names ceylon/ceylon-spec#744 |
Here is an example of what is now possible void run() {
String myModule = "mod";
String myTestModule = "test.mod";
build {
project = "My Build Project";
Task {
name = "compile";
compile {
moduleName = myModule;
};
},
Task {
name = "compile-tests";
compileTests {
moduleName = myTestModule;
};
},
//...
};
} Concerning the dependencies part, it's less sexy for the moment as we obliged to assign a name to a task outside void run() {
String myModule = "mod";
value compileTask = Task {
name = "compile";
compile {
moduleName = myModule;
};
};
build {
project = "My Build Project";
compileTask,
Task {
name = "compile-run";
runModule {
moduleName = myModule;
version = "0.1";
};
dependencies = [compileTask];
}
//...
};
} |
This looks much better! I suppose a command line arg is used to select the Task? PS it looks like a Task here is actually more like an ANTLR "target", right? Sent from my iPhone On 24/08/2013, at 9:32 PM, Loic Rouchon [email protected] wrote:
|
Yes, you select a task by command line args Concerning the terminology, yes, a Task is like an Ant target |
Ok, it looks pretty good then. Feels a little strange that the build def is nested inside a run() method but I can't think why that would actually be bad, or what would be a better alternative.... Sent from my iPhone On 25/08/2013, at 6:49 PM, Loic Rouchon [email protected] wrote:
|
Well it's currently nested inside a |
Yes, I understand that. Sent from my iPhone On 25/08/2013, at 7:08 PM, Loic Rouchon [email protected] wrote:
|
A declarative syntax like below would be great.
Main drawback is that dependencies are declared using a Goal / Task id which is just a
String
and so is not typesafe anymore.I think a
let
keyword has been mentionned somewhere on https:/ceylon/ceylon-spec/issues but I didn't find it back.But it could be a solution to the typesafety issue:
But as you can see, in this second example, you have to name your Goal and as an import is needed for the function to do the processing, there is a naming conflict between the
compile
goal and thecompile
function of the goal.The text was updated successfully, but these errors were encountered: