In Thisbuild

13 views
Skip to first unread message

Maatary Okouya

unread,
Aug 10, 2014, 6:37:21 AM8/10/14
to simple-b...@googlegroups.com
Hi,

I just want to make sure that I understand "in Thisbuild" properly.

Is it a mechanism to share code between project of a multi-module project? For instance defining organisation scalaVersion or the version of the project could be done with it, to spread it over all sub-project right?

This would be true for task as well right ?

Am I missing something? What is the implication for a task for instance, would the task be spread like in all build, or is it just available for reference in the other build. Then executing this task from within a sub-project would trigger the execution of the root build.

Please I would appreciate some clarification here.

Another related question in the mean time,

Is it necessary to define the root project using project() and define its settings (in a multi-project context)? I'm asking this because it seems to be redundant to do so, if indeed, every task and settings in that build(root) are supposed to be scoped to the root project. Am I missing something? By the way if you project() to define your root build, and you do not use the project infile syntax, is there another syntax to do that, that is more like the sub-project: project("rootproject", file(".")).settings(). Is it correct to do that?

Many thanks,

M

Josh Suereth

unread,
Aug 10, 2014, 6:15:45 PM8/10/14
to simple-b...@googlegroups.com
On Sun, Aug 10, 2014 at 6:37 AM, Maatary Okouya <maatar...@gmail.com> wrote:
Hi,

I just want to make sure that I understand "in Thisbuild" properly.

Is it a mechanism to share code between project of a multi-module project? For instance defining organisation scalaVersion or the version of the project could be done with it, to spread it over all sub-project right?

Exactly.
 
This would be true for task as well right ?

Yes, it's no different for any key (including inputTasks) 

Am I missing something? What is the implication for a task for instance, would the task be spread like in all build, or is it just available for reference in the other build. Then executing this task from within a sub-project would trigger the execution of the root build.

It's more like specifying the task ina global scope and others can use it.  On the command line when you type "task" it looks through the scoped for a task, using the notion of "current project".  That algorithm needs to be detailed better, but bascially *eventually* the globals are looked at and the task is found.  But it's the exact same instance no matter which current project you try to run it from.

Also, if you run an aggregate task (i.e. something which runs tests on all projects), as task in ThisBuild would only run ONCE no matter how many of those aggregate projects depend on it.
 

Please I would appreciate some clarification here.

Another related question in the mean time,

Is it necessary to define the root project using project() and define its settings (in a multi-project context)? I'm asking this because it seems to be redundant to do so, if indeed, every task and settings in that build(root) are supposed to be scoped to the root project. Am I missing something? By the way if you project() to define your root build, and you do not use the project infile syntax, is there another syntax to do that, that is more like the sub-project: project("rootproject", file(".")).settings(). Is it correct to do that?


No.  The "convenience" of .sbt files are that their settings are automatically associated with the project located in their directory.  SO, if you add build.sbt files in your subprojects, those settings are associated with the subprojects.   

With sbt 0.13.6, the necessity of deifning the root project explicitly will be reduces, as you can instead manipulate the project object directly in the raw .sbt DSL, e.g. 

enablePlugins(foo)

will be the equivalent of:

val root = (project in file(".").enablePlugins(foo)


Hope that helps!
- Josh
 
Many thanks,

M

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-t...@googlegroups.com.
To post to this group, send email to simple-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool.
For more options, visit https://groups.google.com/d/optout.

Maatary Okouya

unread,
Aug 10, 2014, 7:42:36 PM8/10/14
to simple-b...@googlegroups.com
Cristal clear,

Thanks
Reply all
Reply to author
Forward
0 new messages