Add support for unmanagedBase (lib) (#91)

* Fix #90

---------

Co-authored-by: Kizuki Yasue <kizuki-yasue@m3.com>
This commit is contained in:
kijuky 2024-03-20 00:03:11 +09:00 committed by GitHub
parent 458a172b8f
commit 7a9088ae71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 49 additions and 0 deletions

View File

@ -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,

View File

@ -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

View File

@ -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)
}

View File

@ -0,0 +1,3 @@
object Main extends App {
println(com.example.Lib.getMessage)
}

View File

@ -0,0 +1,3 @@
object Main extends App {
println(com.example.Lib.getMessage)
}

View File

@ -0,0 +1,7 @@
package com.example;
public class Lib {
public static String getMessage() {
return "Hello, World!";
}
}

View File

@ -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