These are chat archives for sbt/sbt

2nd
Dec 2016
G. Richard Bellamy
@rbellamy
Dec 02 2016 00:05
I'm working with a codegen sub-project, and I don't want that sub-project to be published as a dependency
in the former, my "macro" sub-project is added as a dependency to the ivy.xml
in the latter, I get a compile error because the "macro" file isn't in the classpath of the "root" project
anybody have some guidance? I could really use some help...
G. Richard Bellamy
@rbellamy
Dec 02 2016 00:21
dependsOn(macro % "compile-internal, test-internal") did the trick
which isn't mentioned anywhere in the documentation
Guillaume Martres
@smarter
Dec 02 2016 01:35
I can't figure out how to get sbt to clean tests without cleaning the sources, test:clean cleans everything
Daniel Cazares
@danielchristiancazares
Dec 02 2016 01:40
Give me a second.
Hmm. It's a bit more involved than I figured.
I might be able to give you an answer tomorrow once I've played around with it a bit.
Nayana Hettiarachchi
@devzer01
Dec 02 2016 01:55

curious about best practices when it comes on bundling functionality that can be used for testing when publishing libraries

for example I am making a Scala DB access library and as part of the library there is a Test Adapter that mocks the Real Adapter functionality so there is a out of the box drop in for writing tests for those who use the library.
There are some test framework dependency on this library i.e scalatest, mokito

What's the best practice way to package my lib so that scalatest and mokito doesn't become a Compile dependency of the project that uses my library.

Ideas i have thought of

  • making the test stubs as a separate lib-project so that those who reference the library can correctly classfy the test-lib as %test% in the build file
    I learnt recently there is also the use of %provided% so curious on what should be the correct way?
Katrix-
@Katrix-
Dec 02 2016 10:53
Anyone mind giving me some help with a problem I'm having with an SBT plugin?
The problem is that the plugin depends on a library from a custom repository
However when I publish the plugin, the custom repository isn't included in the ivy.xml
What am I doing wrong here?
Derek Wickern
@dwickern
Dec 02 2016 19:32
is there a way to exclude resources from the resulting jar?
filter packageBin::mappings i guess?
Perry
@pfn
Dec 02 2016 21:38
@Katrix-, you can't transitively add 3rd party repositories
Daniel Cazares
@danielchristiancazares
Dec 02 2016 23:14
@dwickern % "provided"?
Oh resources.
Derek Wickern
@dwickern
Dec 02 2016 23:16
it was provided, but still included in the jar artifact
Daniel Cazares
@danielchristiancazares
Dec 02 2016 23:16
Err. Do you mean a resource or a dependency?
Derek Wickern
@dwickern
Dec 02 2016 23:17
err, confusing a bit. it is a resource, and also a dependency
I'm putting it onto unmanagedResourceDirectories just to make IntelliJ happy for development
but I don't want to deploy it
the mappings thing worked out
Daniel Cazares
@danielchristiancazares
Dec 02 2016 23:18
Hmm.
Interesting.
If it was a file, could've done assemblyMergeStrategy in assembly := { ... }
And done MergeStrategy.discard on that case.
Derek Wickern
@dwickern
Dec 02 2016 23:19
is that built-in? or some kind of shading plugin?
Daniel Cazares
@danielchristiancazares
Dec 02 2016 23:20
Oh, it's for the sbt assembly plugin.
Forgot.
Derek Wickern
@dwickern
Dec 02 2016 23:21
yeah, I don't have much incentive to make a fat jar or shade
build is so complex already
Daniel Cazares
@danielchristiancazares
Dec 02 2016 23:21
Gotcha.
Derek Wickern
@dwickern
Dec 02 2016 23:22
ended up using
mappings in (Compile, packageBin) ~= { files =>
  val excluded = Set("jnilib", "dylib")
  files.filterNot { case (file, _) => excluded(file.ext) }
}
Daniel Cazares
@danielchristiancazares
Dec 02 2016 23:23
Ah, nice. Haven't seen that before.
Derek Wickern
@dwickern
Dec 02 2016 23:23
key ~= transform is just key := transform(key.value)
Daniel Cazares
@danielchristiancazares
Dec 02 2016 23:24
I see. Definitely need to dig into sbt more.