diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2015-11-13 13:59:47 +0100 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2015-11-27 16:11:28 +0100 |
commit | a1fed79c13132d750198f2e68f2fadd351398c6d (patch) | |
tree | 805aae3287fa9544dd6f0446e2001ef87ba2df07 /build.sbt | |
parent | 21be6697e61402ca2a80a7e997db68fd126e97d9 (diff) | |
download | scala-a1fed79c13132d750198f2e68f2fadd351398c6d.tar.gz scala-a1fed79c13132d750198f2e68f2fadd351398c6d.tar.bz2 scala-a1fed79c13132d750198f2e68f2fadd351398c6d.zip |
Some small fixes for generated artifacts in the sbt build
Diffstat (limited to 'build.sbt')
-rw-r--r-- | build.sbt | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -216,13 +216,19 @@ lazy val compiler = configureAsSubproject(project) streams.value.cacheDirectory) ++ (mappings in Compile in packageBin in LocalProject("interactive")).value ++ (mappings in Compile in packageBin in LocalProject("scaladoc")).value ++ - (mappings in Compile in packageBin in LocalProject("repl")).value, + (mappings in Compile in packageBin in LocalProject("repl")).value ++ + (mappings in Compile in packageBin in LocalProject("repl-jline")).value.filter(_._2 != "repl-jline.properties") ++ + (mappings in Compile in packageBin in LocalProject("repl-jline-embedded")).value, includeFilter in unmanagedResources in Compile := "*.tmpl" | "*.xml" | "*.js" | "*.css" | "*.html" | "*.properties" | "*.swf" | "*.png" | "*.gif" | "*.gif" | "*.txt", scalacOptions in Compile in doc ++= Seq( "-doc-root-content", (sourceDirectory in Compile).value + "/rootdoc.txt" - ) + ), + // Generate the ScriptEngineFactory service definition. The ant build does this when building + // the JAR but sbt has no support for it and it is easier to do as a resource generator: + generateServiceProviderResources("javax.script.ScriptEngineFactory" -> "scala.tools.nsc.interpreter.IMain$Factory"), + managedResourceDirectories in Compile := Seq((resourceManaged in Compile).value) ) .dependsOn(library, reflect) @@ -283,7 +289,10 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target" ) val outdir = (classDirectory in Compile).value JarJar(inputs, outdir, config) - }) + }), + // Exclude repl-jline-embedded.properties from JAR + mappings in (Compile, packageBin) := + (mappings in (Compile, packageBin)).value.filter(_._2 != "repl-jline-embedded.properties") ) .dependsOn(replJline) @@ -576,4 +585,14 @@ lazy val mkBinImpl: Def.Initialize[Task[Seq[File]]] = Def.task { mkBin("scalap" , "scala.tools.scalap.Main", (fullClasspath in Compile in scalap).value) } +/** Generate service provider definition files under META-INF/services */ +def generateServiceProviderResources(services: (String, String)*): Setting[_] = + resourceGenerators in Compile += Def.task { + services.map { case (k, v) => + val f = (resourceManaged in Compile).value / "META-INF/services" / k + IO.write(f, v + "\n") + f + } + }.taskValue + buildDirectory in ThisBuild := (baseDirectory in ThisBuild).value / "build-sbt" |