summaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt58
1 files changed, 43 insertions, 15 deletions
diff --git a/build.sbt b/build.sbt
index fb5849a2d1..b31bde8078 100644
--- a/build.sbt
+++ b/build.sbt
@@ -53,7 +53,7 @@
* https://groups.google.com/d/topic/scala-internals/gp5JsM1E0Fo/discussion
*/
-import VersionUtil.{versionProps, versionNumber, generatePropertiesFileSettings, versionProperties, versionPropertiesSettings}
+import VersionUtil._
val bootstrapScalaVersion = versionProps("starr.version")
@@ -64,7 +64,7 @@ val scalaParserCombinatorsDep = withoutScalaLang("org.scala-lang.modules" %% "sc
val scalaSwingDep = withoutScalaLang("org.scala-lang.modules" %% "scala-swing" % versionNumber("scala-swing"))
val scalaXmlDep = withoutScalaLang("org.scala-lang.modules" %% "scala-xml" % versionNumber("scala-xml"))
val partestDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest" % versionNumber("partest"))
-val partestInterfaceDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest-interface" % "0.5.0")
+val partestInterfaceDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest-interface" % "0.7.0")
val junitDep = "junit" % "junit" % "4.11"
val junitIntefaceDep = "com.novocode" % "junit-interface" % "0.11" % "test"
val asmDep = "org.scala-lang.modules" % "scala-asm" % versionProps("scala-asm.version")
@@ -94,13 +94,27 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
(f, to)
}
IO.copy(mappings)
- }
+ },
+ credentials ++= {
+ val file = Path.userHome / ".credentials"
+ if (file.exists) List(Credentials(file))
+ else Nil
+ },
+ publishMavenStyle := true
)
-lazy val commonSettings = clearSourceAndResourceDirectories ++ versionPropertiesSettings ++ publishSettings ++ Seq[Setting[_]](
+// Set the version number: The ANT build uses the file "build.number" to get the base version. Overriding versions or
+// suffixes for certain builds is done by directly setting variables from the shell scripts. For example, in
+// publish-core this requires computing the commit SHA first and then passing it to ANT. In the sbt build we use
+// the two settings `baseVersion` and `baseVersionSuffix` to compute all versions (canonical, Maven, OSGi). See
+// VersionUtil.versionPropertiesImpl for details. The standard sbt `version` setting should not be set directly. It
+// is the same as the Maven version and derived automatically from `baseVersion` and `baseVersionSuffix`.
+globalVersionSettings
+baseVersion in Global := "2.12.0"
+baseVersionSuffix in Global := "SNAPSHOT"
+
+lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings ++ Seq[Setting[_]](
organization := "org.scala-lang",
- // The ANT build uses the file "build.number" and the property "build.release" to compute the version
- version := "2.12.0-SNAPSHOT",
scalaVersion := bootstrapScalaVersion,
// we don't cross build Scala itself
crossPaths := false,
@@ -524,8 +538,8 @@ lazy val test = project
.settings(
publishArtifact := false,
libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, partestInterfaceDep, scalacheckDep),
- unmanagedBase in Test := baseDirectory.value / "files" / "lib",
- unmanagedJars in Test <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
+ unmanagedBase in IntegrationTest := baseDirectory.value / "files" / "lib",
+ unmanagedJars in IntegrationTest <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
// no main sources
sources in Compile := Seq.empty,
// test sources are compiled in partest run, not here
@@ -534,6 +548,7 @@ lazy val test = project
javaOptions in IntegrationTest += "-Xmx1G",
testFrameworks += new TestFramework("scala.tools.partest.Framework"),
testOptions in IntegrationTest += Tests.Setup( () => root.base.getAbsolutePath + "/pull-binary-libs.sh" ! ),
+ testOptions in IntegrationTest += Tests.Argument("-Dpartest.java_opts=-Xmx1024M -Xms64M -XX:MaxPermSize=128M"),
definedTests in IntegrationTest += (
new sbt.TestDefinition(
"partest",
@@ -619,7 +634,13 @@ lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-di
lazy val root = (project in file("."))
.settings(disableDocs: _*)
- .settings(publishArtifact := false)
+ .settings(generateBuildCharacterFileSettings: _*)
+ .settings(
+ publishArtifact := false,
+ publish := {},
+ publishLocal := {},
+ commands ++= ScriptCommands.all
+ )
.aggregate(library, reflect, compiler, interactive, repl, replJline, replJlineEmbedded,
scaladoc, scalap, partestExtras, junit, libraryAll, scalaDist).settings(
sources in Compile := Seq.empty,
@@ -637,8 +658,14 @@ lazy val dist = (project in file("dist"))
.settings(
libraryDependencies ++= Seq(scalaSwingDep, jlineDep),
mkBin := mkBinImpl.value,
- mkQuick <<= Def.task {} dependsOn ((distDependencies.map(products in Runtime in _) :+ mkBin): _*),
- mkPack <<= Def.task {} dependsOn (packageBin in Compile, mkBin),
+ mkQuick <<= Def.task {
+ val cp = (fullClasspath in IntegrationTest in LocalProject("test")).value
+ val propsFile = (buildDirectory in ThisBuild).value / "quick" / "partest.properties"
+ val props = new java.util.Properties()
+ props.setProperty("partest.classpath", cp.map(_.data.getAbsolutePath).mkString(sys.props("path.separator")))
+ IO.write(props, null, propsFile)
+ } dependsOn ((distDependencies.map(products in Runtime in _) :+ mkBin): _*),
+ mkPack <<= Def.task {} dependsOn (packagedArtifact in (Compile, packageBin), mkBin),
target := (baseDirectory in ThisBuild).value / "target" / thisProject.value.id,
packageBin in Compile := {
val extraDeps = Set(scalaSwingDep, scalaParserCombinatorsDep, scalaXmlDep)
@@ -655,7 +682,7 @@ lazy val dist = (project in file("dist"))
},
cleanFiles += (buildDirectory in ThisBuild).value / "quick",
cleanFiles += (buildDirectory in ThisBuild).value / "pack",
- packageBin in Compile <<= (packageBin in Compile).dependsOn(distDependencies.map(packageBin in Compile in _): _*)
+ packagedArtifact in (Compile, packageBin) <<= (packagedArtifact in (Compile, packageBin)).dependsOn(distDependencies.map(packagedArtifact in (Compile, packageBin) in _): _*)
)
.dependsOn(distDependencies.map(p => p: ClasspathDep[ProjectReference]): _*)
@@ -708,9 +735,10 @@ lazy val mkBinImpl: Def.Initialize[Task[Seq[File]]] = Def.task {
scalaTool.writeScript(file, "windows", rootDir, outDir)
)
res.foreach { f =>
- //TODO 2.12: Use Files.setPosixFilePermissions() (Java 7+) instead of calling out to chmod
- if(Process(List("chmod", "ugo+rx", f.getAbsolutePath())).! > 0)
- throw new IOException("chmod failed")
+ if(!f.getAbsoluteFile.setExecutable(true, /* ownerOnly: */ false))
+ throw new IOException("setExecutable failed")
+ if(!f.getAbsoluteFile.setReadable(true, /* ownerOnly: */ false))
+ throw new IOException("setReadable failed")
}
res
}