Skip to content

Commit

Permalink
Add support for unmanagedBase (lib) (#91)
Browse files Browse the repository at this point in the history
* Fix #90

---------

Co-authored-by: Kizuki Yasue <kizuki-yasue@m3.com>
  • Loading branch information
kijuky and Kizuki Yasue authored Mar 19, 2024
1 parent 458a172 commit 7a9088a
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/scala/sbt/internal/ProjectMatrix.scala
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ object ProjectMatrix {
target := base.getAbsoluteFile / "target" / svDirSuffix.dropWhile(_ == '-'),
crossTarget := Keys.target.value,
sourceDirectory := base.getAbsoluteFile / "src",
unmanagedBase := base.getAbsoluteFile / "lib",
inConfig(Compile)(makeSources(nonScalaDirSuffix, svDirSuffix)),
inConfig(Test)(makeSources(nonScalaDirSuffix, svDirSuffix)),
projectDependencies := projectDependenciesTask.value,
Expand Down
15 changes: 15 additions & 0 deletions src/sbt-test/projectMatrix/lib/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ThisBuild / version := "0.1.0-SNAPSHOT"

lazy val util = projectMatrix
.jvmPlatform(scalaVersions = Seq("2.12.19", "2.13.13"))

lazy val root = (projectMatrix in file("."))
.dependsOn(util)
.jvmPlatform(scalaVersions = Seq("2.12.19"))

// ss is second system
lazy val ss = projectMatrix
.dependsOn(util)
.jvmPlatform(scalaVersions = Seq("2.13.13"))

lazy val strayJar = project
5 changes: 5 additions & 0 deletions src/sbt-test/projectMatrix/lib/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sys.props.get("plugin.version") match {
case Some(x) => addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % x)
case _ => sys.error("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
}
3 changes: 3 additions & 0 deletions src/sbt-test/projectMatrix/lib/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Main extends App {
println(com.example.Lib.getMessage)
}
3 changes: 3 additions & 0 deletions src/sbt-test/projectMatrix/lib/ss/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Main extends App {
println(com.example.Lib.getMessage)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example;

public class Lib {
public static String getMessage() {
return "Hello, World!";
}
}
15 changes: 15 additions & 0 deletions src/sbt-test/projectMatrix/lib/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# debug
#> unmanagedBase

# make jar
> strayJar/package

# check root
$ mkdir lib
$ copy-file strayJar/target/scala-2.12/strayJar_2.12-0.1.0-SNAPSHOT.jar lib/strayJar.jar
> root2_12/compile

# check ss
$ mkdir ss/lib
$ copy-file strayJar/target/scala-2.12/strayJar_2.12-0.1.0-SNAPSHOT.jar ss/lib/strayJar.jar
> ss/compile

0 comments on commit 7a9088a

Please sign in to comment.