From a5e64642bc706dd781708d218deaafbf34ed5da8 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Thu, 19 Feb 2015 15:05:37 +0100 Subject: Introduce `buildDirectory` setting. This settings determines location of where class files, jars, and other build products will go. By default, it's `./build-sbt`. It makes it easier to compare what Ant and sbt builds do. Also, changed `SettingKey` to `settingKey`. The latter is a macro that automatically determines `label` of a setting and takes a description as argument. Before that, `SettingKey("my desc")` would create a setting key with `label` set to "my desc". Not what we wanted. --- build.sbt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'build.sbt') diff --git a/build.sbt b/build.sbt index c0e8a4fb0d..842bf41d23 100644 --- a/build.sbt +++ b/build.sbt @@ -70,7 +70,7 @@ lazy val commonSettings = Seq[Setting[_]]( scalaSource in Compile := (sourceDirectory in Compile).value, javaSource in Compile := (sourceDirectory in Compile).value, target := (baseDirectory in ThisBuild).value / "target" / name.value, - classDirectory in Compile := (baseDirectory in ThisBuild).value / "build/quick/classes" / name.value, + classDirectory in Compile := buildDirectory.value / "quick/classes" / name.value, artifactPath in packageBin in Compile := { // two lines below are copied over from sbt's sources: // https://github.com/sbt/sbt/blob/0.13/main/src/main/scala/sbt/Defaults.scala#L628 @@ -80,7 +80,7 @@ lazy val commonSettings = Seq[Setting[_]]( // uncomment the other definition of the `resolvedArtifactName` val resolvedArtifact = artifact.value val resolvedArtifactName = s"${resolvedArtifact.name}.${resolvedArtifact.extension}" - (baseDirectory in ThisBuild).value / "build/pack/lib" / resolvedArtifactName + buildDirectory.value / "pack/lib" / resolvedArtifactName }, // given that classDirectory is overriden to be _outside_ of target directory, we have // to make sure its being cleaned properly @@ -158,8 +158,8 @@ def configureAsSubproject(project: Project): Project = { (project in base).settings(commonSettings: _*) } -lazy val copyrightString = SettingKey[String]("Copyright string.") - +lazy val buildDirectory = settingKey[File]("The directory where all build products go. By default ./build") +lazy val copyrightString = settingKey[String]("Copyright string.") lazy val generateVersionPropertiesFile = taskKey[File]("Generating version properties file.") lazy val generateVersionPropertiesFileImpl: Def.Initialize[Task[File]] = Def.task { @@ -208,3 +208,5 @@ lazy val generateVersionPropertiesFileImpl: Def.Initialize[Task[File]] = Def.tas propFile } + +buildDirectory in ThisBuild := (baseDirectory in ThisBuild).value / "build-sbt" -- cgit v1.2.3