SBuild-org / sbuild

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

Support for @include annotation #3

Closed lefou closed 10 years ago

lefou commented 10 years ago

This is like @@classpath@, but additionally will compile the included resource first.

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

Original Redmine issue link: Redmine ID 3 Reporter: Tobias Roeser => @lefou Creating date: 2012-03-30T08:58:25+02:00

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

This issue relates issue #34.

lefou commented 10 years ago

I'm not sure about the need for this feature. As we already have modules (aka subprojects), that can also lie in the same directory, there are already possibilities to split the build setup into multiple files.

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/3 Author: Tobias Roeser => @lefou Creating date: 2012-04-24T21:14:55+02:00

lefou commented 10 years ago

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

lefou commented 10 years ago

This is somehow related to #34, because both issues target the sharing of build information and logic.

To have this feature, some issues have to be solved, though.

Where to store the class files?

SBuild could create an @.sbuild@ folder an store the class files there, analogous to the way the buildfiles are handled. Than, we need a proper mechanism of locking, to avoid more than on compile job and avoid loading the compiled class files while another process recompiles it. Another question: Who will clean up to compiled classfiles. What would be the definition of "the local directory" when files are referenced.

An alternative could be, that each project that includes another file also manages it. No locking and no specieal cleanup task would be necessary, but of course SBuild needs to compile the included file for each project, which might be very expensive and time consuming. When the included file changes, each project needs to recompile it. This could be improved by caching in some cases, though.

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

lefou commented 10 years ago

On an implementation level, the second aproach of #3#note-3 could be simplified, by just concatenating the content of the included resources to the project file before compiling. As the project also executes the included resources, the classpath must contain all runtime dependencies. In most cases, this should be everything thats needed to compile the included resources, too.

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/3 Author: Tobias Roeser => @lefou Creating date: 2012-11-03T10:21:38+01:00

lefou commented 10 years ago

That (previous comment) is actually no simplification and would introduce a lot of unsolvable problems (package scopes and imports). As Scala compiler does not interpret the location of the source files, but only uses the package definitions in the file itself, it should be fine to simply add all included resources to the compile run.

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/3 Author: Tobias Roeser => @lefou Creating date: 2012-11-04T20:53:19+01:00

lefou commented 10 years ago

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

lefou commented 10 years ago

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/3 Author: Tobias Roeser => @lefou Creating date: 2012-11-04T23:20:47+01:00

lefou commented 10 years ago

Implemented the second aproach of comment #3#note-3. This works reasonable well in terms of compile speed. It is a gread feature!

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/3 Author: Tobias Roeser => @lefou Creating date: 2012-11-04T23:24:29+01:00

lefou commented 10 years ago

See page [[IncludeAnnotation|@include]].

Comment imported from Redmine http://sbuild.tototec.de/sbuild/issues/3 Author: Tobias Roeser => @lefou Creating date: 2012-11-04T23:58:03+01:00