-
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.
Merge pull request #333 from jroper/multiproject-classifiers
Added support for classifiers in multiproject builds
- Loading branch information
Showing
5 changed files
with
62 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
54 changes: 54 additions & 0 deletions
54
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,54 @@ | ||
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" | ||
val assetsDir = baseDirectory.value / "src" / "main" / "assets" | ||
val sources = assetsDir.***.filter(_.isFile) pair relativeTo(assetsDir) | ||
IO.zip(sources, 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")) |
1 change: 1 addition & 0 deletions
1
src/sbt-test/universal/multiproject-classifiers/sub/src/main/assets/foo.css
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 @@ | ||
h1 { color: blue; } |
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 |