diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2015-11-13 13:59:47 +0100 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2015-11-24 12:44:38 +0100 |
commit | 18e261ba7a34825b519a865d8dd72b987f73b5bf (patch) | |
tree | cef2d23bd83ad4988bbdb677fc1045649786f1c4 | |
parent | 62f346b6574a72d236b04ba8744b7a8ea2bcdfe2 (diff) | |
download | scala-18e261ba7a34825b519a865d8dd72b987f73b5bf.tar.gz scala-18e261ba7a34825b519a865d8dd72b987f73b5bf.tar.bz2 scala-18e261ba7a34825b519a865d8dd72b987f73b5bf.zip |
[nomerge] Some small fixes for generated artifacts in the sbt build
-rw-r--r-- | build.sbt | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -221,13 +221,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) @@ -288,7 +294,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) @@ -614,4 +623,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" |