Skip to content

Commit c788225

Browse files
committed
Add "scala-" prefix to the name of a subproject.
Scala artifacts (like library or compiler) are published are published with "scala-" prefix in their name. We keep project ids short so we can refer to projects simply by e.g. `library` and not `scala-library`. Given that `name` settings will have a different value, we switch to `Project.id` when construsting paths for target directories.
1 parent 111c425 commit c788225

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

build.sbt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ lazy val commonSettings = Seq[Setting[_]](
7070
sourceDirectories in Compile := Seq(sourceDirectory.value),
7171
scalaSource in Compile := (sourceDirectory in Compile).value,
7272
javaSource in Compile := (sourceDirectory in Compile).value,
73-
target := (baseDirectory in ThisBuild).value / "target" / name.value,
74-
target in Compile in doc := buildDirectory.value / "scaladoc" / name.value,
75-
classDirectory in Compile := buildDirectory.value / "quick/classes" / name.value,
73+
target := (baseDirectory in ThisBuild).value / "target" / thisProject.value.id,
74+
target in Compile in doc := buildDirectory.value / "scaladoc" / thisProject.value.id,
75+
classDirectory in Compile := buildDirectory.value / "quick/classes" / thisProject.value.id,
7676
// given that classDirectory is overriden to be _outside_ of target directory, we have
7777
// to make sure its being cleaned properly
7878
cleanFiles += (classDirectory in Compile).value
@@ -171,7 +171,8 @@ lazy val root = (project in file(".")).
171171
*/
172172
def configureAsSubproject(project: Project): Project = {
173173
val base = file(".") / "src" / project.id
174-
(project in base).settings(scalaSubprojectSettings: _*)
174+
(project in base).settings(scalaSubprojectSettings: _*).
175+
settings(name := s"scala-${project.id}")
175176
}
176177

177178
/**
@@ -200,7 +201,8 @@ def configureAsForkOfJavaProject(project: Project): Project = {
200201
settings(
201202
sourceDirectory in Compile := baseDirectory.value,
202203
javaSource in Compile := (sourceDirectory in Compile).value,
203-
sources in Compile in doc := Seq.empty
204+
sources in Compile in doc := Seq.empty,
205+
classDirectory in Compile := buildDirectory.value / "libs/classes" / thisProject.value.id
204206
)
205207
}
206208

0 commit comments

Comments
 (0)