These are chat archives for sbt/sbt

6th
May 2017
G. Richard Bellamy
@rbellamy
May 06 00:13
oh. my. gawd. it's behaving differently in my reproduction
rbellamy @rbellamy hangs his head
G. Richard Bellamy
@rbellamy
May 06 00:20
I think I understand a path forward - is there a way to dynamically define a task depending on whether it's running under test or compile? For instance:
val task = Def.taskDyn {
  if (Test) {
    Def.task { // in Test 
    }
  } else {
    Def.task { // in other 
    }
  }
}
Jorge
@jvican
May 06 00:25
Are you looking for configuration.value?
Test and Compile are configurations
G. Richard Bellamy
@rbellamy
May 06 00:26
@jvican yes, they are, so is there a way to test whether or not I'm running a Task?
my example isn't great
if (test)
or if (compile)
does that even make sense?
Jorge
@jvican
May 06 00:28
configuration.value == Test?
G. Richard Bellamy
@rbellamy
May 06 00:28
aha
perhaps
Jorge
@jvican
May 06 00:28
I feel that there's a fundamental issue here. What you want is to resolve a task differently for those scopes.
G. Richard Bellamy
@rbellamy
May 06 00:28
yes, that exactly true
Jorge
@jvican
May 06 00:29
In those cases, you just define a task per each scope.
G. Richard Bellamy
@rbellamy
May 06 00:29
which I've done
but the task is a code generation task - that should generate code for the compile task
e.g.
Jorge
@jvican
May 06 00:30
myCodegenTask in (Compile, compile) := ???
G. Richard Bellamy
@rbellamy
May 06 00:30
sourceGenerators in Compile += genTablesTask.taskValue,
sourceGenerators in Compile += genTablesTaskTest.taskValue
Jorge
@jvican
May 06 00:30
And the same for (Test, compile)
But you're scoping them in the Compile configuration
Both of them
G. Richard Bellamy
@rbellamy
May 06 00:31
because the generated code is compile time code
whether that code is being generated during test or compile
I think you're right, I have to just be missing something fundamental here...
Jorge
@jvican
May 06 00:32
Try scoping in (Compile, compile) and (Test, compile)
G. Richard Bellamy
@rbellamy
May 06 00:32
doing that now...
G. Richard Bellamy
@rbellamy
May 06 00:39
I have to go - but this is looking really, really promising @jvican
and even if I don't end up with a reasonable SO question, I will gladly publish the working repository as an example (probably renamed and put under my organizations flag)
G. Richard Bellamy
@rbellamy
May 06 05:54
@jvican @dwijnand I've updated the project with my current best effort to get things behaving as expected. For now, focus on sbt test and why things don't behave as expected. Flyway "clean" and "migrate" should be run, followed by the slick codegen, followed by the compile... https://github.com/rbellamy/flyway-slick-codegen-test
like I said, whether or not this turns into a useful SO question I'll gladly keep the repository up and available as an example, once we get things working...
I'll rename it and transfer ownership to my organization (Terradatum)... or whatever you folks think would be most useful...
heh... okay, I've just invited @jvican @dwijnand and @eed3si9n as collaborators to the repo - so feel free to make any changes you think will make this sucker behave itself...
Dale Wijnand
@dwijnand
May 06 09:58
@edmundnoble I don't know why people use lazy val so much. That commonSettings example makes no sense. I constantly see people use lazy val when defining keys! The only legitimate case I see and use is defining the root aggregating at the top, with lazy val, so it can safely define aggregate/dependsOn projects defined later on.
Def.settings is just a convenience. It lets you mix and match individual settings with seq of settings to end up with one seq of settings.
It's the same as Project#settings and iirc one uses the other.
Your last flurry of questions are harder to answer. "values which won't be instantiated until later" if you mean settings, yes. You can declare one setting A in relation to setting B before defining setting B.
Miles Sabin
@milessabin
May 06 16:00
@dwijnand it's cargo culted from project to project. Could I remove all the lazy from the shapeless build?
Jorge
@jvican
May 06 16:01
If you're not using the feature that Dale mentions (to allow forward references between projects), yes, you can.
Though I'm planning to write a rewrite for this in sbt-migration-rewrites. You may consider waiting for this, since the tool will do it for you.
Dale Wijnand
@dwijnand
May 06 17:07
I see a number you can, a number you can't, @milessabin
if you shuffle things you could have less lazy vals
G. Richard Bellamy
@rbellamy
May 06 17:36
@dwijnand hey there - good afternoon/morning/evening to you!
BTW - where are you located? I'm in Northern California of the US
same to you @jvican
;)
Jorge
@jvican
May 06 17:38
Switzerland!
G. Richard Bellamy
@rbellamy
May 06 17:39
nice... so I'm catching you on Saturday evening
are you winding down, or winding up? I'm asking because I'm available for some directed focus on this problem I'm working on, and you did offer to help - so maybe right now would be good for you?
Jorge
@jvican
May 06 17:49
I cannot help you right now unfortunately :( I'm out with some friends. I would like to mention that it's normal that you only have to scope it in Compile, since source generators is defined there. I suggest you that you use inspect sourceGenerators to get all the information about the scopes, dependencies, etcetera.
I can probably have a look at it tomorrow
G. Richard Bellamy
@rbellamy
May 06 17:51
no worries, I appreciate whatever you can do -> go have fun with your friends! And yeah, I'm using inspect and inspect tree and show and all the things I can think of to review what SBT thinks is happening under the covers
G. Richard Bellamy
@rbellamy
May 06 22:10
@jvican @dwijnand @eed3si9n - I renamed the repository in preparation for it becoming an example, rather than an working effort
Justin Kaeser
@jastice
May 06 22:36
was it not possible to add an sbt plugin published to an organization’s bintray to the sbt-plugin-releases? I vaguely remember someone saying that
Dale Wijnand
@dwijnand
May 06 22:56
Yeah I remember Jeff saying so in Chicago.
Justin Kaeser
@jastice
May 06 23:08
but I do see other org’s packages included in https://bintray.com/sbt/sbt-plugin-releases — do I have to be an org admin or something to request adding?
Edmund Noble
@edmundnoble
May 06 23:40
@dwijnand But using %%% in an ordinary Seq of settings results in a macro error.