summaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2015-03-10 10:20:35 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-04-17 11:45:09 -0700
commit6eae83a7cf62306cba1bffb0d14f2f43d377d59c (patch)
tree2b22d520adc7e6845c2c78f12f332b147ec6c500 /build.sbt
parent79a760dbb19f65122b567da0c030a1d57a8b8a3f (diff)
downloadscala-6eae83a7cf62306cba1bffb0d14f2f43d377d59c.tar.gz
scala-6eae83a7cf62306cba1bffb0d14f2f43d377d59c.tar.bz2
scala-6eae83a7cf62306cba1bffb0d14f2f43d377d59c.zip
Compiler jar includes interactive, scaladoc & repl
Mirror ant by disabling docs and publishing tasks in these subprojects. Class files are included by merging `mappings`: the `package` task uses it to determine which class files should end up in a jar file.
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt36
1 files changed, 25 insertions, 11 deletions
diff --git a/build.sbt b/build.sbt
index 19ada760f5..adf7eb9886 100644
--- a/build.sbt
+++ b/build.sbt
@@ -78,6 +78,17 @@ lazy val commonSettings = Seq[Setting[_]](
cleanFiles += (classDirectory in Compile).value
)
+// disable various tasks that are not needed for projects that are used
+// only for compiling code and not publishing it as a standalone artifact
+// we disable those tasks by overriding them and returning bogus files when
+// needed. This is a bit sketchy but I haven't found any better way.
+val disableDocsAndPublishingTasks = Seq[Setting[_]](
+ (doc := file("!!! NO DOCS !!!")),
+ (publishLocal := {}),
+ (publish := {}),
+ (packageBin in Compile := file("!!! NO PACKAGING !!!"))
+)
+
lazy val scalaSubprojectSettings = commonSettings ++ Seq[Setting[_]](
artifactPath in packageBin in Compile := {
// two lines below are copied over from sbt's sources:
@@ -115,16 +126,27 @@ lazy val reflect = configureAsSubproject(project).
dependsOn(library)
lazy val compiler = configureAsSubproject(project).
- settings(libraryDependencies += "org.apache.ant" % "ant" % "1.9.4").
+ settings(libraryDependencies += "org.apache.ant" % "ant" % "1.9.4",
+ // 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
+ mappings in Compile in packageBin :=
+ (mappings in Compile in packageBin).value ++
+ (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
+ ).
dependsOn(library, reflect, asm)
lazy val interactive = configureAsSubproject(project).
+ settings(disableDocsAndPublishingTasks: _*).
dependsOn(compiler)
lazy val repl = configureAsSubproject(project).
// TODO: in Ant build def, this version is defined in versions.properties
// figure out whether we also want to externalize jline's version
settings(libraryDependencies += "jline" % "jline" % "2.12").
+ settings(disableDocsAndPublishingTasks: _*).
dependsOn(compiler)
lazy val scaladoc = configureAsSubproject(project).
@@ -135,6 +157,7 @@ lazy val scaladoc = configureAsSubproject(project).
"org.scala-lang.modules" %% "scala-partest" % "1.0.5"
)
).
+ settings(disableDocsAndPublishingTasks: _*).
dependsOn(compiler)
lazy val scalap = configureAsSubproject(project).
@@ -185,18 +208,9 @@ def configureAsSubproject(project: Project): Project = {
*/
def configureAsForkOfJavaProject(project: Project): Project = {
val base = file(".") / "src" / project.id
- // disable various tasks that do not make sense for forks of Java projects
- // we disable those task by overriding them and returning bogus files when
- // needed. This is a bit sketchy but I haven't found any better way.
- val disableTasks = Seq[Setting[_]](
- (doc := file("!!! NO DOCS !!!")),
- (publishLocal := {}),
- (publish := {}),
- (packageBin in Compile := file("!!! NO PACKAGING !!!"))
- )
(project in base).
settings(commonSettings: _*).
- settings(disableTasks: _*).
+ settings(disableDocsAndPublishingTasks: _*).
settings(
sourceDirectory in Compile := baseDirectory.value,
javaSource in Compile := (sourceDirectory in Compile).value,