These are chat archives for sbt/sbt

11th
Feb 2016
Matthew de Detrich
@mdedetrich
Feb 11 2016 00:16
@eed3si9n Yeah, I think it appears to be due to Play, thanks for the help, will go ask in Play
Matthew de Detrich
@mdedetrich
Feb 11 2016 00:29
Yeah the problem I am having, is that the tasks like coffeescript or less don’t actually compile anything
Matthew de Detrich
@mdedetrich
Feb 11 2016 00:37

Actually scratch that, coffeescript command does work, its compile that is not working

EDIT: Ignore me, was being stupid, compile never worked on web assets

Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:09
Hi guys. Trying to publish my "it" artifacts here.
I added publishArtifact in (IntegrationTest,packageBin) := true to my build file.
package does produce my it jar in the target folder
but publish (or publishLocal) does not publish it. Any clue why?
Dale Wijnand
@dwijnand
Feb 11 2016 14:13
perhaps you need to add the artefact
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:15
Indeed, that's the feeling here. show packagedArtifacts does not list my it artifact
Dale Wijnand
@dwijnand
Feb 11 2016 14:15
what's in packagedArtifacts and artifacts?
what about artifacts?
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:16
same
it is not there
Dale Wijnand
@dwijnand
Feb 11 2016 14:16
then try addArtifact
I'm just not sure what the taskDef should be
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:16
I would have assumed that the IntegrationTest scope defines that by default, like the Test does
Dale Wijnand
@dwijnand
Feb 11 2016 14:16
the artifact should be artifact in (IntegrationTest, packageBin), but not sure what taskDef should be
It might be an oversight, not sure
tbh publishing test jars is pretty rare, publish it test jars even more so :)
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:17
indeed
here the scenario is that we extend a test suite from the it scope in another project it scope
:)
Dale Wijnand
@dwijnand
Feb 11 2016 14:19
yep makes sense, much like why one might eventually publish a test jar
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:19
sorry, my sbt-fu is really low (I'm trying, ... hard)
how would I add this artifact now?
Dale Wijnand
@dwijnand
Feb 11 2016 14:20
so addArtifact is a method that returns a SettingsDefinition: https://github.com/sbt/sbt/blob/v0.13.9/main/src/main/scala/sbt/Defaults.scala#L1853-L1857
so I think you'd need to add addArtifact(artifact in (IntegrationTest, packageBin), ???)
I'm just not sure what the ??? part should be
perhaps it's packageBin in IntegrationTest
try that it's the most specific
and if not you can generalise to package and/or drop the configuration axis
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:22
it works!
thanks a lot
Dale Wijnand
@dwijnand
Feb 11 2016 14:23
cool
np
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:23
is this sth we should make a default in IntegrationTest?
Dale Wijnand
@dwijnand
Feb 11 2016 14:24
how did you publish test jars? I don't think that's default behaviour for test..
you opt into it for Test, so it makes sense to opt into it for IntegrationTest
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:24
i just added publishArtifact in (Test,packageBin) := true
Dale Wijnand
@dwijnand
Feb 11 2016 14:24
ah
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:24
and it worked
Dale Wijnand
@dwijnand
Feb 11 2016 14:25
hmm yeah in that case should work in the same way, feel free to open a ticket
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:25
cool thanks will do
Perry
@pfn
Feb 11 2016 14:29
integration test is a standard config scope?
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:29
no
Perry
@pfn
Feb 11 2016 14:29
then no, it shouldn't work the same
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:29
you get it by adding Defaults.itSettings to your build
and configs(IntegrationTest)
Perry
@pfn
Feb 11 2016 14:30
addArtifact is how you add non standard artifacts
that sounds standard
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:30
so you mean, I should open a ticket?
Perry
@pfn
Feb 11 2016 14:31
then it should work the same way, itSettings isn't enabled. by default, but it's still standard, I suppose
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:31
yep, that was my feeling
Dale Wijnand
@dwijnand
Feb 11 2016 14:31
I'm saying that if you use built-in IntegrationTest, enable it with Defaults.itSettings then setting publishArtifact in (IntegrationTest,packageBin) := true should do the right thing, like it does for Test
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:31
exactly, so, yes I'll open a ticket :stuck_out_tongue:
Dale Wijnand
@dwijnand
Feb 11 2016 14:31
imho yes
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 14:42
sbt/sbt#2458
Kaiyin Zhong
@kindlychung
Feb 11 2016 17:13
@dwijnand Yeah, that's what I want. Thanks!
Richard Gomes
@frgomes
Feb 11 2016 17:57
Is it possible to enable a certain plugin only inside a certain configuration?
Something more or less like: .settings(inConfig(MyConfig)(enablePlugin(MyPlugin)) ?
Perry
@pfn
Feb 11 2016 18:40
no
.settings(inConfig(MyConfig)(MyPlugin.projectSettings))
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 21:05

Hi again! Trying to create an AutoPlugin.
Here's my build.sbt:

name := "my-plugin"
organization := "my.test_package"
version := "1.0"
sbtPlugin := true

Here's my project/myplugin.scala:

package my.test_package

import sbt._
import Keys._

object TestPlugin extends AutoPlugin {

  object autoImport {
    lazy val testTask = TaskKey[Unit]( "testTask" )
    lazy val testSetting = settingKey[Boolean]("testSetting")
  }

  import autoImport._

  override lazy val projectSettings = Seq(
      testTask := {
        println("test")
      },
      testSetting := true
  )
}
This loads fine in sbt, and I'm able to publishLocal properly
However, I can't seem to find how to actually use this in another project
I tried, in project/plugins.sbt :
addSbtPlugin("my.test_package" % "my-plugin" % "1.0")
that works fine
but I cannot enable the plugin in my build.sbt file:
enablePlugins(TestPlugin)
I'm not sure why this does not work
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 21:12
it seems that the produced jar is empty
it only contains a manifest
and no class files
Tim Harper
@timcharper
Feb 11 2016 21:14
You need to put the plugin in src/main/scala
Pierre Borckmans
@pierre-borckmans
Feb 11 2016 21:14
anyone has a clue what is going on?
ah
obvious, but I missed it, thanks!
:)
Tim Harper
@timcharper
Feb 11 2016 21:14
Sbt does not include project definition files in published jars