These are chat archives for sbt/sbt

9th
Jul 2015
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 14:52
Hi
How do I enablePlugins for all modules?
in a multi-module build?
Chandra Sekhar Kode
@chandu0101
Jul 09 2015 14:55
  def DefProject(name: String, id: String = "") = {
    Project(if (id.isEmpty) name else id, file(name))
      .settings(commonSettings: _*)
      .enablePlugins(ur plugins)
  }

lazy val shared = DefProject("shared")
    .settings(sharedModuleDeps: _*)

  lazy val admin = DefProject("admin")
    .dependsOn(shared)
    .settings(adminModuleDeps: _*)
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 14:56
Thanks
that’s what I meant to avoid
to define my own Project object constructor
I think I’ll have to add the settings explicitly without relying on enablePlugins to do it for me
Chandra Sekhar Kode
@chandu0101
Jul 09 2015 14:59
hmm ok

that’s what I meant to avoid ,to define my own Project object constructor

can i know why ? just curious ..

Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:03
I’m lazy :)
and don’t want to introduce new stuff unless I’m forced to do so
new people in the project => too much mental load to grasp
what’s inside
I’d like to keep builds as simple as possible
Chandra Sekhar Kode
@chandu0101
Jul 09 2015 15:05
ah ok , i am new to sbt i thought i’am missing something .. :)
Dale Wijnand
@dwijnand
Jul 09 2015 15:16
interesting use case
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:17
mine?
Dale Wijnand
@dwijnand
Jul 09 2015 15:18
yeah
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:19
well, I’m working on git sha1 use in version
for all modules in a multi-module project
so I need enablePlugins(GitVersioning)
I think auto-plugin can do it
tested requires with GitVersioning, but doesn’t seem to work :(
how can an auto-plugin say
when I’m enabled the other plugins are too?
Dale Wijnand
@dwijnand
Jul 09 2015 15:22
That's why I think it's interesting, as (AFAIK) auto-plugins were designed around the reverse use-case: if this plugin and that plugin are enabled then enable me so I can configure on top of them
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:23
right
that’s my understanding, too
what about plugin’s dependencies?
I think I’ve heard it’s doable
so plugin can depend on other plugins
and bring them into scope
activate them
I know how to do it at Scala-level
but not on sbt’s one
eugene yokota
@eed3si9n
Jul 09 2015 15:27
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:30
looks like it’s not possible, right @eed3si9n ?
what about pre-autoplugin times?
how could a plugin depend on another?
and be a wrapper around it?
I think I’ve seen it somewhere...
eugene yokota
@eed3si9n
Jul 09 2015 15:31
@jaceklaskowski you could make a new auto plugin that depends on sbt-git
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:32
how?
I think I did it and didn’t seem to trigger the dependent plugins
plugins didn’t show they’re enabled
eugene yokota
@eed3si9n
Jul 09 2015 15:32
there's no trigger currently to pull in requirements
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:33
so, how to express "the plugin depends on another”?
eugene yokota
@eed3si9n
Jul 09 2015 15:39
GitPlugin depends on CorePlugin
CorePlugin is always there
so if you make a new FooPlugin that depends on GitPlugin, you get FooPlugin loaded automatically
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:40
thanks
let me review it
Dale Wijnand
@dwijnand
Jul 09 2015 15:41
I thought @jaceklaskowski wanted to find a way to force auto-enable GitVersioning
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:41
yes, that’s the case @dwijnand
eugene yokota
@eed3si9n
Jul 09 2015 15:43
I created a github issue - sbt/sbt#2093
FooPlugin can manually add settings from git versioning, effectively working around the design decision by the sbt-git author(s)
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:44
right
override def buildSettings = GitVersioning.buildSettings
?
is this what you mean, @eed3si9n ?
eugene yokota
@eed3si9n
Jul 09 2015 15:44
@jaceklaskowski yea
Josh Suereth
@jsuereth
Jul 09 2015 15:44
My design decisions are the best
Your design decisions need the workign around, dude
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:45
hehe
Josh Suereth
@jsuereth
Jul 09 2015 15:45
Ok, but seriously, what's the issue here? Did I mess somethign up?
eugene yokota
@eed3si9n
Jul 09 2015 15:45
only working around I'm doing is a clock
Josh Suereth
@jsuereth
Jul 09 2015 15:45
Yeah, you need to sleep, man
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:45
dunno, just want to enable GitVersioning for all modules
Josh Suereth
@jsuereth
Jul 09 2015 15:45
You'll get sick
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:45
in a multi-module project
Josh Suereth
@jsuereth
Jul 09 2015 15:45
Ah, gotcha. You mean, like, magically?
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:46
yup
Josh Suereth
@jsuereth
Jul 09 2015 15:46
ah
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:46
and think autoplugin could do that
Josh Suereth
@jsuereth
Jul 09 2015 15:46
that's not our intended usecase
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:46
but doesn’t seem so
Josh Suereth
@jsuereth
Jul 09 2015 15:46
it can if GitVersioning let you do it
but we decided it should be opt-in
Dale Wijnand
@dwijnand
Jul 09 2015 15:46
btw (paranoid me) there's a bunch of things to forward, not just buildSettings: https://github.com/sbt/sbt/blob/0.13.8/main/src/main/scala/sbt/Plugins.scala#L77-L89
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:47
GitVersioning needs buildSettings only
I don’t understand something
here
it appears that
GitVersioning autoplugin should be auto-enabled
since it requires sbt.plugins.IvyPlugin && GitPlugin
that are autoenabled
as they both expect sbt.plugins.CorePlugin
that’s enabled
do I miss something important here?
and try to fix something that’s not broken?!
eugene yokota
@eed3si9n
Jul 09 2015 15:49
@jaceklaskowski def trigger
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:49
please elaborate
no def trigger for GitVersioning
ah, so it’s not triggered/enabled implicitly, right?
eugene yokota
@eed3si9n
Jul 09 2015 15:50
@jaceklaskowski correct
if you make FooPlugin that's auto triggered you can work around it
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:51
I’ve got one
Dale Wijnand
@dwijnand
Jul 09 2015 15:52
that's what I meant by paranoid, atm it only requires buildSettings, but what about future versions? :) (if you want to emulate enablePlugins everywhere with this workaround)
Josh Suereth
@jsuereth
Jul 09 2015 15:52
GitVersioning is not autoEnabled, i.e. i didn't overload that trigger
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:53
and by default it’s noTrigger?
Josh Suereth
@jsuereth
Jul 09 2015 15:53
@dwijnand I'm going to throw in settings in those now, just so you can be right :)
@jaceklaskowski yep
The issue with this design is if a plugin is noTrigger, you can never autoenable it
or any of its dependencies
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:53
doh
Josh Suereth
@jsuereth
Jul 09 2015 15:54
that way, one stubborn person (like the sbt-git author) can make someting explicit and FORCE EVERYONE ELSE DO IT
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:54
it means that there’s a way
create an autoplugin that’s allRequirements?
as @eed3si9n says
?
Josh Suereth
@jsuereth
Jul 09 2015 15:55
you can do that
and copy my settings into it, rather than using my plugin
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:55
:(
copy doesn’t sound promising
Josh Suereth
@jsuereth
Jul 09 2015 15:55
but if mine is "explicitly enabled", then you can't get yours to autoenable unless they explicitly enable mine
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 15:57
it’s getting tougher every sentence
eugene yokota
@eed3si9n
Jul 09 2015 15:57
or send us pull request on sbt/sbt#2093
Josh Suereth
@jsuereth
Jul 09 2015 15:58
:)
So basically.
if you enablePlugins(GitVersioning)
and your plugin is "allRequirements" you'd get magically added
but because mine is noTrigger, SOMEONE has to manually specify it, always
They could enablePlugins(JacekPlugin) and that would also enable GitVersioning
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 16:00
okey, getting better at it
Dale Wijnand
@dwijnand
Jul 09 2015 16:43
oh, didn't know explicitly enabling a plugin enabled it's requirements
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 17:25
me either
btw, how can I set up sbt-git and sbt-release plugins
and sbt-native-packager
Josh Suereth
@jsuereth
Jul 09 2015 17:26
:) that i'm not sure, I only use two of those three
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 17:27
so universal:packageBin uses custom version
with git sha1
Josh Suereth
@jsuereth
Jul 09 2015 17:27
version in Universal should alter that, I think
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 17:32
version in ThisBuild is the convention of sbt-release
to set it up
I can’t seem to convince sbt-git
do I need to do it manually
or somehow it’s going to be mix-and-match
so sbt-git sets the setting
so sbt-release and sbt-native-package use?
OR did I over engineered the use case?! :)
Josh Suereth
@jsuereth
Jul 09 2015 17:50
So
sbt-release tries to change the version number
you want it to instead change the git.baseVersion
Which means you want to change the version bump tasks, and replace the default release script
Also, IIRC, the plugin wasn't "command" friendly, in the sense that each step runs a command, but does not allow those commands to run other commands (i.e. chain to completion).
Which, probably means very little to anyone but me :)
In any case, you should be able to get them all working together, but you'll want to redo the ReleaseStep components which touch git or the version number to be sbt-git friendly
And as for sbt-native-packager and sbt-git, that should "just work". We had some tickets opened on sbt-git about it, but I thought we fixed those
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 19:12
okey
found it
sbt-release uses version in ThisBuild in version.sbt
This message was deleted
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 22:52
why is baseVersion giving me No such setting/task w/ sbt-git plugin?
it even tells me Not a valid key: gitBaseVersion (similar: baseVersion, base-version, gitDescribedVersion)
yet
show baseVersion yields the error :(
Dale Wijnand
@dwijnand
Jul 09 2015 23:50
try: show base-version, show {.}/baseVersionand show {.}/base-version
Jacek Laskowski
@jaceklaskowski
Jul 09 2015 23:51
did that
it works now
but dunno what was changed to fix it
Dale Wijnand
@dwijnand
Jul 09 2015 23:52
lol