These are chat archives for sbt/sbt

25th
Jul 2016
Ben Hutchison
@benhutchison
Jul 25 2016 05:24

Can someone please explain (or direct me to info) about this type of Configuration directive bench % "compile-internal;test-internal -> test", taken from the Cats build.sbt file

I have heard of eg test->test before but

  • What is test-internal vs test?
  • What does the semicolon ; in the configuration string mean?
RomanIakovlev
@RomanIakovlev
Jul 25 2016 13:48
So I define a command that runs a task on a root of multi-project build with modified settings. The task is publish. The root project explicitly disables publishing: publish := (). If I run publish manually (sbt publish) on the root project, however, it publishes all the subprojects. If I run publish task via command, it only runs on the root project, effectively doing nothing. How to achieve the same behavior in the command as in manual task execution?
The command looks like this:
lazy val publishToArtifactory = Command.command("publishToArtifactory")(state => {
      Project.runTask(publish, Project.extract(state).append(Seq(
        credentials += Credentials(file("~/artifactory.credentials")),
        publishMavenStyle := false,
        publishTo := {
          val baseUrl = "http://ciartifactory/artifactory/"
          if (isSnapshot.value) {
            Some(Resolver.url("Artifactory Realm", url(baseUrl + "mapsng-snapshot-local"))(Resolver.ivyStylePatterns))
          } else {
            Some(Resolver.url("Artifactory Realm", url(baseUrl + "mapsng-release-local"))(Resolver.ivyStylePatterns))
          }
        }), state))
      state
    })
The idea is to make this global autoplugin, because it’s a pain to manually publish snapshots of open-source projects at local artifactory, waiting until my pull requests are merged and released.
Bjørn Madsen
@aeons
Jul 25 2016 14:00
hey, quick question, how do I add resource directories in an autoplugin’s projectSettings?
RomanIakovlev
@RomanIakovlev
Jul 25 2016 14:01
override def projectSettings = Seq(resourceDirectories in Compile += …)
Bjørn Madsen
@aeons
Jul 25 2016 14:01
thanks, was missing the in Compile
Travis Brown
@travisbrown
Jul 25 2016 15:52
What's the most convenient / idiomatic way to define a command alias in an SBT plugin?
Dale Wijnand
@dwijnand
Jul 25 2016 16:02
@travisbrown I think in globalSettings
Travis Brown
@travisbrown
Jul 25 2016 16:20
okay, thanks @dwijnand—that seems to work fine.
Dale Wijnand
@dwijnand
Jul 25 2016 17:18
@travisbrown note that the autoplugin needs to either auto-trigger or be enabled on at least one project for the global settings to apply.
Travis Brown
@travisbrown
Jul 25 2016 18:30
@dwijnand yep, that's not a problem for us.