Skip to content

Commit

Permalink
Included required resources in jars
Browse files Browse the repository at this point in the history
Static resources are stored along source files in our current layout.
Therefore we set resourceDirectory to be sourceDirectory but make sure
that includeFilter includes nothing by default. Subprojects like library
or compiler set their own include filters.

The include filters have been ported from the Ant build definition.

Generate properties for: library, reflect, compiler & actors.
  • Loading branch information
gkossakowski authored and adriaanm committed Apr 17, 2015
1 parent 42dace1 commit e29646b
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ lazy val commonSettings = Seq[Setting[_]](
sourceDirectories in Compile := Seq(sourceDirectory.value),
scalaSource in Compile := (sourceDirectory in Compile).value,
javaSource in Compile := (sourceDirectory in Compile).value,
// resources are stored along source files in our current layout
resourceDirectory in Compile := (sourceDirectory in Compile).value,
// each subproject has to ask specifically for files they want to include
includeFilter in unmanagedResources in Compile := NothingFilter,
target := (baseDirectory in ThisBuild).value / "target" / thisProject.value.id,
target in Compile in doc := buildDirectory.value / "scaladoc" / thisProject.value.id,
classDirectory in Compile := buildDirectory.value / "quick/classes" / thisProject.value.id,
Expand Down Expand Up @@ -108,13 +112,18 @@ lazy val scalaSubprojectSettings = commonSettings ++ Seq[Setting[_]](
val resolvedArtifact = artifact.value
val resolvedArtifactName = s"${resolvedArtifact.name}.${resolvedArtifact.extension}"
buildDirectory.value / "pack/lib" / resolvedArtifactName
},
}
)

lazy val generatePropertiesFileSettings = Seq[Setting[_]](
copyrightString := "Copyright 2002-2013, LAMP/EPFL",
resourceGenerators in Compile += generateVersionPropertiesFile.map(file => Seq(file)).taskValue,
generateVersionPropertiesFile := generateVersionPropertiesFileImpl.value
)

val libIncludes: FileFilter = "*.tmpl" | "*.xml" | "*.js" | "*.css" | "rootdoc.txt"
lazy val library = configureAsSubproject(project).
settings(generatePropertiesFileSettings: _*).
settings(
name := "scala-library",
scalacOptions in Compile ++= Seq[String]("-sourcepath", (scalaSource in Compile).value.toString),
Expand All @@ -128,14 +137,20 @@ lazy val library = configureAsSubproject(project).
scalacOptions in Compile in doc ++= {
val libraryAuxDir = (baseDirectory in ThisBuild).value / "src/library-aux"
Seq("-doc-no-compile", libraryAuxDir.toString)
}
},
includeFilter in unmanagedResources in Compile := libIncludes
) dependsOn (forkjoin)

lazy val reflect = configureAsSubproject(project).
settings(generatePropertiesFileSettings: _*).
settings(name := "scala-reflect").
dependsOn(library)

val compilerIncludes: FileFilter =
"*.tmpl" | "*.xml" | "*.js" | "*.css" | "*.html" | "*.properties" | "*.swf" |
"*.png" | "*.gif" | "*.gif" | "*.txt"
lazy val compiler = configureAsSubproject(project).
settings(generatePropertiesFileSettings: _*).
settings(
name := "scala-compiler",
libraryDependencies += "org.apache.ant" % "ant" % "1.9.4",
Expand All @@ -146,7 +161,8 @@ lazy val compiler = configureAsSubproject(project).
(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
(mappings in Compile in packageBin in LocalProject("repl")).value,
includeFilter in unmanagedResources in Compile := compilerIncludes
).
dependsOn(library, reflect, asm)

Expand Down Expand Up @@ -178,6 +194,7 @@ lazy val scalap = configureAsSubproject(project).
// deprecated Scala Actors project
// TODO: it packages into actors.jar but it should be scala-actors.jar
lazy val actors = configureAsSubproject(project).
settings(generatePropertiesFileSettings: _*).
settings(name := "scala-actors").
dependsOn(library)

Expand Down

0 comments on commit e29646b

Please sign in to comment.