SBuild-org / sbuild

SBuild - The magic-free yet powerful build tool.
sbuild.org
Apache License 2.0
15 stars 3 forks source link

Add cmdline-option to add additional modules #17

Closed lefou closed 10 years ago

lefou commented 10 years ago

So, the cmdline argument (e.g. -m proj2) should behave exactly as a @Module("proj2")@ function inside a buildscript.

Ticket imported form Redmine http://sbuild.tototec.de/sbuild

Original Redmine issue link: Redmine ID 17 Reporter: Tobias Roeser => @lefou Creating date: 2012-08-30T21:25:08+02:00

Assigned to: Tobias Roeser => @lefou Start date: 2012-11-04 Due date: 2012-11-06

lefou commented 10 years ago

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/17 Author: Tobias Roeser => @lefou Creating date: 2012-09-16T15:25:30+02:00

lefou commented 10 years ago

When should those project added?

The time of the addition might be relevant in terms of environment properties. If the project will be added after, properties set with @SetProp@ or @ExportDependencies@ might be visible in those project, whereas if they will be added before, properties might not be visible.

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/17 Author: Tobias Roeser => @lefou Creating date: 2012-09-26T20:54:04+02:00

lefou commented 10 years ago

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/17 Author: Tobias Roeser => @lefou Creating date: 2012-10-01T09:12:38+02:00

lefou commented 10 years ago

This is semantically similar to issueing the "-f" option multiple times. The difference is, that currently "-f" tells SBuild to not use the default name of the build file "SBuild.scala" but use the name given with "-f" instead. We could extends SBuild, so that is allows to use the "-f" option multiple times. The only drawback I can see for now is: When the user wants to add module but also want to use the default file "SBuild.scala", he has to give both files on command line.

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/17 Author: Tobias Roeser => @lefou Creating date: 2012-11-04T11:39:21+01:00

lefou commented 10 years ago

The above scenario is technically the best solution.

To avoid the case that the default file and a second file have to be given both, we could add a "-F" option, that explicitly "only adds" new files without erasing any defaults.

But what would be the meaning of "sbuild -F SBuild1.scala -f SBuild2.scala". Do we have now three files (including SBuild.scala) or only two? In contrast "sbuild -f SBuild1.scala -f SBuild2.scala" would be less vague.

Hmm, a lot more cases have to be considered. Here is a table

Scenario 1: User has a default SBuild.scala file and wants to add another one SBuild1.scala

. -f Semantic |. -F Sementic |_. Example | first/default file | additional files | sbuild -F SBuild1.scala | any file, replacing default | - | sbuild -f SBuild.scala -f SBuild1.scala | any file, replacing default | additional files | sbuild -f SBuild.scala -f SBuild1.scala | | | sbuild -F SBuild1.scala | | | sbuild -f SBuild1.scala -F sbuild.scala |

Scenario 2: User doesn't want the default SBuild.scala file but wants to use SBuild1.scala and SBuild2.scala

. -f Semantic |. -F Sementic |_. Example | first/default file | additional files | sbuild -f SBuild1.scala -F SBuild2.scala | any file, replacing default | - | sbuild -f SBuild1.scala -f SBuild2.scala | any file, replacing default | additional files | sbuild -f SBuild1.scala -f SBuild2.scala | | | sbuild -f SBuild1.scala -F SBuild2.scala |

Hmm, I thinks, the first solution is the one with the least surprise.

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/17 Author: Tobias Roeser => @lefou Creating date: 2012-11-05T14:42:31+01:00

lefou commented 10 years ago

Finally implemented it. Option -f controls always the name of the first buildfile. New option -F can add additional buildfiles. So the next two lines are essentially the same:

SBuild -f SBuild.scala -F Sbuild1.scala
Sbuild -F SBuild1.scala

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/17 Author: Tobias Roeser => @lefou Creating date: 2012-11-06T11:37:07+01:00