-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for classifiers in multiproject builds
If one project has two dependencies on another project for different classifiers in that project, this ensures that both dependencies are included.
- Loading branch information
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/sbt-test/universal/multiproject-classifiers/project/Build.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import sbt._ | ||
import Keys._ | ||
import com.typesafe.sbt.SbtNativePackager._ | ||
|
||
object MutliBuild extends Build { | ||
|
||
val appVersion = "1.0" | ||
|
||
val mySettings: Seq[Setting[_]] = | ||
packageArchetype.java_application ++ | ||
Seq( | ||
organization := "org.test", | ||
version := appVersion, | ||
TaskKey[Unit]("show-files") <<= (name, target, streams) map { (n, t, s) => | ||
System.out.synchronized { | ||
println("Files in ["+n+"]") | ||
val files = (t / "universal/stage").***.get | ||
files foreach println | ||
} | ||
} | ||
) | ||
|
||
val assets = config("assets") | ||
|
||
lazy val sub = ( | ||
Project("sub", file("sub")) | ||
settings(mySettings:_*) | ||
settings( | ||
ivyConfigurations += assets, | ||
artifact in assets := artifact.value.copy(classifier = Some("assets")), | ||
packagedArtifacts += { | ||
val file = target.value / "assets.jar" | ||
IO.zip(Seq.empty, file) | ||
(artifact in assets).value -> file | ||
}, | ||
exportedProducts in assets := { | ||
Seq( | ||
Attributed.blank(baseDirectory.value / "src" / "main" / "assets") | ||
.put(artifact.key, (artifact in assets).value) | ||
.put(AttributeKey[ModuleID]("module-id"), projectID.value) | ||
) | ||
} | ||
) | ||
) | ||
|
||
lazy val root = ( | ||
Project("root", file(".")) | ||
settings(mySettings:_*) | ||
dependsOn(sub % "compile->compile;compile->assets") | ||
) | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/universal/multiproject-classifiers/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
> show-files | ||
$ exists target/universal/stage/lib/org.test.sub-1.0.jar | ||
$ exists target/universal/stage/lib/org.test.sub-1.0-assets.jar |