summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-05-11 17:19:36 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-05-11 17:19:36 +1000
commit4db1de6531933c927280226642235344d7f1de6a (patch)
tree2a9e25ceeab76ced9d1d3dd57bce0a8e35e21a39
parent2e7a3d79eed4b7f8712ca8f297517063c13d2a28 (diff)
parent1125d054020f20e694314ebd4983f7f5ac44ae9d (diff)
downloadscala-4db1de6531933c927280226642235344d7f1de6a.tar.gz
scala-4db1de6531933c927280226642235344d7f1de6a.tar.bz2
scala-4db1de6531933c927280226642235344d7f1de6a.zip
Merge pull request #5154 from retronym/merge/2.11.x-to-2.12.x-20160511
Merge 2.11.x to 2.12.x
-rw-r--r--build.sbt70
-rw-r--r--project/Osgi.scala1
2 files changed, 49 insertions, 22 deletions
diff --git a/build.sbt b/build.sbt
index 546b3e7099..e9ea2c7153 100644
--- a/build.sbt
+++ b/build.sbt
@@ -84,7 +84,7 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
val mappings = artifacts.toSeq.map { case (a, f) =>
val typeSuffix = a.`type` match {
case "pom" => "-pom.xml"
- case "bundle" | "jar" => ".jar"
+ case "jar" => ".jar"
case "doc" => "-docs.jar"
case tpe => s"-$tpe.${a.extension}"
}
@@ -99,6 +99,8 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
if (file.exists) List(Credentials(file))
else Nil
},
+ // Add a "default" Ivy configuration because sbt expects the Scala distribution to have one:
+ ivyConfigurations += Configuration("default", "Default", true, List(Configurations.Runtime), true),
publishMavenStyle := true
)
@@ -236,8 +238,8 @@ def fixPom(extra: (String, scala.xml.Node)*): Setting[_] = {
) ++ extra) }
}
-/** Remove unwanted dependencies from the POM. */
-def removePomDependencies(deps: (String, String)*): Setting[_] = {
+/** Remove unwanted dependencies from the POM and ivy.xml. */
+def removePomDependencies(deps: (String, String)*): Seq[Setting[_]] = Seq(
pomPostProcess := { n =>
val n2 = pomPostProcess.value.apply(n)
import scala.xml._
@@ -252,14 +254,40 @@ def removePomDependencies(deps: (String, String)*): Setting[_] = {
case n => Seq(n)
}
})).transform(Seq(n2)).head
+ },
+ deliverLocal := {
+ import scala.xml._
+ import scala.xml.transform._
+ val f = deliverLocal.value
+ val e = (new RuleTransformer(new RewriteRule {
+ override def transform(node: Node) = node match {
+ case e: Elem if e.label == "dependency" && {
+ val org = e.attribute("org").getOrElse("").toString
+ val name = e.attribute("name").getOrElse("").toString
+ deps.exists { case (g, a) =>
+ org == g && (name == a || name == (a + "_" + scalaBinaryVersion.value))
+ }
+ } => Seq.empty
+ case n => Seq(n)
+ }
+ })).transform(Seq(XML.loadFile(f))).head
+ XML.save(f.getAbsolutePath, e, xmlDecl = true)
+ f
}
-}
+)
val disableDocs = Seq[Setting[_]](
sources in (Compile, doc) := Seq.empty,
publishArtifact in (Compile, packageDoc) := false
)
+val disablePublishing = Seq[Setting[_]](
+ publishArtifact := false,
+ // The above is enough for Maven repos but it doesn't prevent publishing of ivy.xml files
+ publish := {},
+ publishLocal := {}
+)
+
lazy val setJarLocation: Setting[_] =
artifactPath in packageBin in Compile := {
// two lines below are copied over from sbt's sources:
@@ -397,43 +425,44 @@ lazy val compiler = configureAsSubproject(project)
"/project/description" -> <description>Compiler for the Scala Programming Language</description>,
"/project/packaging" -> <packaging>jar</packaging>
),
- apiURL := None,
- removePomDependencies(
- ("org.apache.ant", "ant"),
- ("org.scala-lang.modules", "scala-asm")
- )
+ apiURL := None
)
+ .settings(removePomDependencies(
+ ("org.apache.ant", "ant"),
+ ("org.scala-lang.modules", "scala-asm")
+ ): _*)
.dependsOn(library, reflect)
lazy val interactive = configureAsSubproject(project)
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(
name := "scala-compiler-interactive",
- description := "Scala Interactive Compiler",
- publishArtifact := false
+ description := "Scala Interactive Compiler"
)
.dependsOn(compiler)
lazy val repl = configureAsSubproject(project)
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(
connectInput in run := true,
- publishArtifact := false,
run <<= (run in Compile).partialInput(" -usejavacp") // Automatically add this so that `repl/run` works without additional arguments.
)
.dependsOn(compiler, interactive)
lazy val replJline = configureAsSubproject(Project("repl-jline", file(".") / "src" / "repl-jline"))
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(
libraryDependencies += jlineDep,
- name := "scala-repl-jline",
- publishArtifact := false
+ name := "scala-repl-jline"
)
.dependsOn(repl)
lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target" / "repl-jline-embedded-src-dummy")
.settings(scalaSubprojectSettings: _*)
+ .settings(disablePublishing: _*)
.settings(
name := "scala-repl-jline-embedded",
// There is nothing to compile for this project. Instead we use the compile task to create
@@ -464,18 +493,17 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target"
val outdir = (classDirectory in Compile).value
JarJar(inputs, outdir, config)
}),
- publishArtifact := false,
connectInput in run := true
)
.dependsOn(replJline)
lazy val scaladoc = configureAsSubproject(project)
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(
name := "scala-compiler-doc",
description := "Scala Documentation Generator",
libraryDependencies ++= Seq(scalaXmlDep, scalaParserCombinatorsDep, partestDep),
- publishArtifact := false,
includeFilter in unmanagedResources in Compile := "*.html" | "*.css" | "*.gif" | "*.png" | "*.js" | "*.txt"
)
.dependsOn(compiler)
@@ -497,10 +525,10 @@ lazy val partestExtras = configureAsSubproject(Project("partest-extras", file(".
.dependsOn(replJlineEmbedded)
.settings(clearSourceAndResourceDirectories: _*)
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(
name := "scala-partest-extras",
description := "Scala Compiler Testing Tool (compiler-specific extras)",
- publishArtifact := false,
libraryDependencies += partestDep,
unmanagedSourceDirectories in Compile := List(baseDirectory.value)
)
@@ -510,8 +538,8 @@ lazy val junit = project.in(file("test") / "junit")
.settings(clearSourceAndResourceDirectories: _*)
.settings(commonSettings: _*)
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(
- publishArtifact := false,
fork in Test := true,
libraryDependencies ++= Seq(junitDep, junitIntefaceDep),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
@@ -543,9 +571,9 @@ lazy val test = project
.configs(IntegrationTest)
.settings(commonSettings: _*)
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(Defaults.itSettings: _*)
.settings(
- publishArtifact := false,
libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, scalacheckDep),
unmanagedBase in IntegrationTest := baseDirectory.value / "files" / "lib",
unmanagedJars in IntegrationTest <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
@@ -572,8 +600,8 @@ lazy val test = project
lazy val manual = configureAsSubproject(project)
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(
- publishArtifact := false,
libraryDependencies ++= Seq(scalaXmlDep, antDep),
classDirectory in Compile := (target in Compile).value / "classes"
)
@@ -643,9 +671,9 @@ lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-di
lazy val root = (project in file("."))
.settings(disableDocs: _*)
+ .settings(disablePublishing: _*)
.settings(generateBuildCharacterFileSettings: _*)
.settings(
- publishArtifact := false,
publish := {},
publishLocal := {},
commands ++= ScriptCommands.all,
diff --git a/project/Osgi.scala b/project/Osgi.scala
index d88c282383..36803c0e44 100644
--- a/project/Osgi.scala
+++ b/project/Osgi.scala
@@ -40,7 +40,6 @@ object Osgi {
},
packagedArtifact in (Compile, packageBin) <<= (artifact in (Compile, packageBin), bundle).identityMap,
// Also create OSGi source bundles:
- artifact in (Compile, packageBin) ~= (_.copy(`type` = "bundle")),
packageOptions in (Compile, packageSrc) += Package.ManifestAttributes(
"Bundle-Name" -> (description.value + " Sources"),
"Bundle-SymbolicName" -> (bundleSymbolicName.value + ".source"),