summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--README.md57
-rw-r--r--build.sbt54
-rw-r--r--project/MiMa.scala5
-rw-r--r--project/Osgi.scala6
-rw-r--r--project/ScalaTool.scala2
-rw-r--r--project/build.sbt2
7 files changed, 46 insertions, 89 deletions
diff --git a/.gitignore b/.gitignore
index ea71d02d0b..d9710a65cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,7 @@
#
#
-# JARs aren't checked in, they are fetched by Ant / pull_binary_libs.sh
+# JARs aren't checked in, they are fetched by sbt
#
# We could be more concise with /lib/**/*.jar but that assumes
# a late-model git.
@@ -22,23 +22,20 @@
/test/files/speclib/instrumented.jar
/tools/*.jar
-# Developer specific Ant properties
+# Developer specific properties
/build.properties
/buildcharacter.properties
# might get generated when testing Jenkins scripts locally
/jenkins.properties
-# target directories for ant build
-/build
+# target directory for build
/build/
-/dists/
# other
/out/
/bin/
/sandbox/
-/.ant-targets-build.xml
# eclipse, intellij
/.classpath
diff --git a/README.md b/README.md
index 8d84daf0e5..ea28ba7497 100644
--- a/README.md
+++ b/README.md
@@ -43,8 +43,6 @@ P.S.: If you have some spare time to help out around here, we would be delighted
```
scala/
+--build.sbt The main sbt build script
-+--build.xml The deprecated Ant build script
-+--pull-binary-libs.sh Pulls binary artifacts from remote repository, used by build scripts
+--lib/ Pre-compiled libraries for the build
+--src/ All sources
+---/library Scala Standard Library
@@ -65,13 +63,11 @@ scala/
## Requirements
You need the following tools:
- - A Java SDK. The baseline version is 6 for 2.11.x, 8 for 2.12.x. It's possible
- to use a later SDK for local development, but the CI will verify against the baseline
- version.
- - sbt, we recommend the [sbt-extras](https://github.com/paulp/sbt-extras) runner
- script. It provides sensible default jvm options (stack and heap size).
- - curl (for `./pull-binary-libs.sh`, used by the sbt / ant build).
- - Apache Ant (version 1.9.3 or above) if you need to use the (deprecated) ant build.
+ - Java SDK. The baseline version is 8 for 2.12.x. It may be possible to use a
+ later SDK for local development, but the CI will verify against the baseline
+ version.
+ - sbt. We recommend the [sbt-extras](https://github.com/paulp/sbt-extras) runner
+ script. It provides sensible default jvm options (stack and heap size).
Mac OS X and Linux work. Windows may work if you use Cygwin. Community help with keeping
the build working on Windows is appreciated.
@@ -80,32 +76,25 @@ the build working on Windows is appreciated.
### Basics
-Scala is built in layers, where each layer is a complete Scala compiler and library.
-Here is a short description of the layers, from bottom to top:
-
- - `starr`: the stable reference Scala release. We use an official release of
- Scala (specified by `starr.version` in [versions.properties](versions.properties)),
- downloaded from the Central Repository.
- - `locker` (deprecated, only in ant): an intermediate layer that existed in the
- ant build to perform a bootstrap.
- - `quick`: the development layer which is incrementally built when working on
- changes in the compiler or library.
- - `strap` (deprecated, only in ant) : a test layer used to check stability of
- the build.
-
-The sbt build uses `starr` to build `quick`. This is sufficient for most development
-scenarios: changes to the library or the compiler can be tested by running the `quick`
-Scala (see below for how to do that).
-
-However, a full build of Scala (a *bootstrap*, as performed by our CI) requires two
-layers. This guarantees that every Scala version can build itself. If you change the
-code generation part of the Scala compiler, your changes will only reflect in the
-bytecode of the library and compiler after a bootstrap. See below for how to create
-a bootstrap build locally.
+During ordinary development, a new Scala build is built by the
+previously released version. For short we call the previous release
+"starr": the stable reference Scala release. Building with starr is
+sufficient for most kinds of changes.
+
+However, a full build of Scala (a *bootstrap*, as performed by our CI)
+requires two layers. This guarantees that every Scala version can
+build itself. If you change the code generation part of the Scala
+compiler, your changes will only show up in the bytecode of the
+library and compiler after a bootstrap. See below for how to do a
+bootstrap build locally.
+
+For history on how the current scheme was arrived at, see
+https://groups.google.com/d/topic/scala-internals/gp5JsM1E0Fo/discussion.
### Using the Sbt Build
Core commands:
+
- `compile` compiles all sub-projects (library, reflect, compiler, scaladoc, etc)
- `scala` / `scalac` run the REPL / compiler directly from sbt (accept options /
arguments)
@@ -133,13 +122,13 @@ Note that sbt's incremental compilation is often too coarse for the Scala compil
codebase and re-compiles too many files, resulting in long build times (check
[sbt#1104](https://github.com/sbt/sbt/issues/1104) for progress on that front). In the
meantime you can:
- - Enable "ant mode" in which sbt only re-compiles source files that were modified.
+ - Enable "Ant mode" in which sbt only re-compiles source files that were modified.
Create a file `local.sbt` containing the line `antStyle := true`.
Add an entry `local.sbt` to your `~/.gitignore`.
- Use IntelliJ IDEA for incremental compiles (see [IDE Setup](#ide-setup) below) - its
incremental compiler is a bit less conservative, but usually correct.
-#### Local Bootstrap Build
+#### Bootstrapping Locally
To perform a bootstrap using sbt
- first a build is published either locally or on a temporary repository,
@@ -176,7 +165,7 @@ In order to use IntelliJ's incremental compiler:
Now you can edit and build in IntelliJ and use the scripts (compiler, REPL) to
directly test your changes. You can also run the `scala`, `scalac` and `partest`
-commands in sbt. Enable "ant mode" (explained above) to prevent sbt's incremental
+commands in sbt. Enable "Ant mode" (explained above) to prevent sbt's incremental
compiler from re-compiling (too many) files before each `partest` invocation.
# Coding Guidelines
diff --git a/build.sbt b/build.sbt
index 4a8f349a59..b12ee931fa 100644
--- a/build.sbt
+++ b/build.sbt
@@ -17,40 +17,19 @@
* This nicely leads me to explaining goal and non-goals of this build definition. Goals are:
*
* - to be easy to tweak it in case a bug or small inconsistency is found
- * - to mimic Ant's behavior as closely as possible
* - to be super explicit about any departure from standard sbt settings
- * - to achieve functional parity with Ant build as quickly as possible
* - to be readable and not necessarily succinct
* - to provide the nicest development experience for people hacking on Scala
+ * - originally, to mimic Ant's behavior as closely as possible, so the
+ * sbt and Ant builds could be maintained in parallel. the Ant build
+ * has now been removed, so we are now free to depart from that history.
*
* Non-goals are:
*
- * - to have the shortest sbt build definition possible; we'll beat Ant definition
- * easily and that will thrill us already
+ * - to have the shortest sbt build definition possible
* - to remove irregularities from our build process right away
+ * (but let's keep making gradual progress on this)
* - to modularize the Scala compiler or library further
- *
- * It boils down to simple rules:
- *
- * - project layout is set in stone for now
- * - if you need to work on convincing sbt to follow non-standard layout then
- * explain everything you did in comments
- * - constantly check where Ant build produces class files, artifacts, what kind of other
- * files generates and port all of that to here
- *
- * Note on bootstrapping:
- *
- * Let's start with reminder what bootstrapping means in our context. It's an answer
- * to this question: which version of Scala are using to compile Scala? The fact that
- * the question sounds circular suggests trickiness. Indeed, bootstrapping Scala
- * compiler is a tricky process.
- *
- * Ant build used to have involved system of bootstrapping Scala. It would consist of
- * three layers: starr, locker and quick. The sbt build for Scala ditches layering
- * and strives to be as standard sbt project as possible. This means that we are simply
- * building Scala with latest stable release of Scala.
- * See this discussion for more details behind this decision:
- * https://groups.google.com/d/topic/scala-internals/gp5JsM1E0Fo/discussion
*/
import VersionUtil._
@@ -69,8 +48,8 @@ val asmDep = "org.scala-lang.modules" % "scala-asm" % versionPr
val jlineDep = "jline" % "jline" % versionProps("jline.version")
val antDep = "org.apache.ant" % "ant" % "1.9.4"
-/** Publish to ./dists/maven-sbt, similar to the ANT build which publishes to ./dists/maven. This
- * can be used to compare the output of the sbt and ANT builds during the transition period. Any
+/** Publish to ./dists/maven-sbt, similar to the Ant build which publishes to ./dists/maven. This
+ * can be used to compare the output of the sbt and Ant builds during the transition period. Any
* real publishing should be done with sbt's standard `publish` task. */
lazy val publishDists = taskKey[Unit]("Publish to ./dists/maven-sbt.")
@@ -134,10 +113,7 @@ lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings +
// on Scala classes
compileOrder := CompileOrder.JavaThenScala,
javacOptions in Compile ++= Seq("-g", "-source", "1.8", "-target", "1.8", "-Xlint:unchecked"),
- // we don't want any unmanaged jars; as a reminder: unmanaged jar is a jar stored
- // directly on the file system and it's not resolved through Ivy
- // Ant's build stored unmanaged jars in `lib/` directory
- unmanagedJars in Compile := Seq.empty,
+ unmanagedJars in Compile := Seq.empty, // no JARs in version control!
sourceDirectory in Compile := baseDirectory.value,
unmanagedSourceDirectories in Compile := List(baseDirectory.value),
unmanagedResourceDirectories in Compile += (baseDirectory in ThisBuild).value / "src" / thisProject.value.id,
@@ -217,7 +193,7 @@ lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings +
)
/** Extra post-processing for the published POM files. These are needed to create POMs that
- * are equivalent to the ones from the ANT build. In the long term this should be removed and
+ * are equivalent to the ones from the Ant build. In the long term this should be removed and
* POMs, scaladocs, OSGi manifests, etc. should all use the same metadata. */
def fixPom(extra: (String, scala.xml.Node)*): Setting[_] = {
/** Find elements in an XML document by a simple XPath and replace them */
@@ -314,8 +290,6 @@ def filterDocSources(ff: FileFilter): Seq[Setting[_]] = Seq(
// always required because otherwise the compiler cannot even initialize Definitions without
// binaries of the library on the classpath. Specifically, we get this error:
// (library/compile:doc) scala.reflect.internal.FatalError: package class scala does not have a member Int
- // Ant build does the same thing always: it puts binaries for documented classes on the classpath
- // sbt never does this by default (which seems like a good default)
dependencyClasspath in (Compile, doc) += (classDirectory in Compile).value,
doc in Compile <<= doc in Compile dependsOn (compile in Compile)
)
@@ -398,8 +372,8 @@ lazy val compiler = configureAsSubproject(project)
// These are only needed for the POM:
libraryDependencies ++= Seq(scalaXmlDep, jlineDep % "optional"),
// this a way to make sure that classes from interactive and scaladoc projects
- // end up in compiler jar (that's what Ant build does)
- // we need to use LocalProject references (with strings) to deal with mutual recursion
+ // end up in compiler jar. note that we need to use LocalProject references
+ // (with strings) to deal with mutual recursion
products in Compile in packageBin :=
(products in Compile in packageBin).value ++
Seq((dependencyClasspath in Compile).value.find(_.get(moduleID.key) == Some(asmDep)).get.data) ++
@@ -430,7 +404,7 @@ lazy val compiler = configureAsSubproject(project)
"*"),
"Class-Path" -> "scala-reflect.jar scala-library.jar"
),
- // Generate the ScriptEngineFactory service definition. The ant build does this when building
+ // 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),
@@ -482,7 +456,7 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target"
// There is nothing to compile for this project. Instead we use the compile task to create
// shaded versions of repl-jline and jline.jar. dist/mkBin puts all of quick/repl,
// quick/repl-jline and quick/repl-jline-shaded on the classpath for quick/bin scripts.
- // This is different from the ant build where all parts are combined into quick/repl, but
+ // This is different from the Ant build where all parts are combined into quick/repl, but
// it is cleaner because it avoids circular dependencies.
compile in Compile <<= (compile in Compile).dependsOn(Def.task {
import java.util.jar._
@@ -732,7 +706,7 @@ lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-di
(manOut ** "*.1" pair rebase(manOut, fixedManOut)).foreach { case (in, out) =>
// Generated manpages should always use LF only. There doesn't seem to be a good reason
// for generating them with the platform EOL first and then converting them but that's
- // what the ant build does.
+ // what the Ant build does.
IO.write(out, IO.readBytes(in).filterNot(_ == '\r'))
}
(htmlOut ** "*.html").get ++ (fixedManOut ** "*.1").get
diff --git a/project/MiMa.scala b/project/MiMa.scala
index 66442fc725..6c6f5efd51 100644
--- a/project/MiMa.scala
+++ b/project/MiMa.scala
@@ -4,7 +4,7 @@
// both forwards and backwards incompatibilities (possibly fixed as of
// https://github.com/typesafehub/migration-manager/commit/2844ffa48b6d2255aa64bd687703aec21dadd55e)
// * ability to pass a filter file (https://github.com/typesafehub/migration-manager/issues/102)
-// So we invoke the MiMa CLI directly; it's also what the Ant build did.
+// So we invoke the MiMa CLI directly.
import sbt._
import sbt.Keys._
@@ -29,8 +29,7 @@ object MiMa {
prev = if (isForward) curr else prev,
curr = if (isForward) prev else curr,
// TODO: it would be nicer if each subproject had its own whitelist, but for now
- // for compatibility with how Ant did things, there's just one at the root.
- // once Ant is gone we'd be free to split it up.
+ // there's just one at the root. with the Ant build gone, we would be free now to split it.
filter = (baseDirectory in ThisBuild).value / s"bincompat-$direction.whitelist.conf",
log)
}
diff --git a/project/Osgi.scala b/project/Osgi.scala
index 4177251aa4..8a62c9128a 100644
--- a/project/Osgi.scala
+++ b/project/Osgi.scala
@@ -9,9 +9,9 @@ import VersionUtil.versionProperties
/** OSGi packaging for the Scala build, distilled from sbt-osgi. We do not use sbt-osgi because it
* depends on a newer version of BND which gives slightly different output (probably OK to upgrade
- * in the future but for now it would make comparing the sbt and ant build output harder) and does
- * not allow a crucial bit of configuration that we need: Setting the classpath for BND. In sbt-osgi
- * this is always `fullClasspath in Compile` whereas we want `products in Compile in packageBin`. */
+ * in the future, now that the Ant build has been removed) and does not allow a crucial bit of
+ * configuration that we need: Setting the classpath for BND. In sbt-osgi this is always
+ * `fullClasspath in Compile` whereas we want `products in Compile in packageBin`. */
object Osgi {
val bundle = TaskKey[File]("osgiBundle", "Create an OSGi bundle.")
val bundleName = SettingKey[String]("osgiBundleName", "The Bundle-Name for the manifest.")
diff --git a/project/ScalaTool.scala b/project/ScalaTool.scala
index 5e3f20b1ba..98e18235c4 100644
--- a/project/ScalaTool.scala
+++ b/project/ScalaTool.scala
@@ -4,8 +4,6 @@ import org.apache.commons.lang3.StringUtils.replaceEach
/**
* A class that generates a shell or batch script to execute a Scala program.
- *
- * This is a simplified copy of Ant task (see scala.tools.ant.ScalaTool).
*/
case class ScalaTool(mainClass: String,
classpath: List[String],
diff --git a/project/build.sbt b/project/build.sbt
index b19238f577..a604896ded 100644
--- a/project/build.sbt
+++ b/project/build.sbt
@@ -1,2 +1,2 @@
-// Add genprod to the build; It should be moved from `src/build` to `project` once the ANT build is gone
+// Add genprod to the build; It should be moved from `src/build` to `project` now that the Ant build is gone
sources in Compile += ((baseDirectory).value.getParentFile / "src" / "build" / "genprod.scala")