add java sources folders (#85)

* add java sources folders
* add test

---------

Co-authored-by: Miguel Villa <miguel.villa@siriusxm.com>
This commit is contained in:
Miguel Vilá 2023-12-27 17:48:46 -05:00 committed by GitHub
parent 8d27205428
commit 7181625be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 80 additions and 1 deletions

View File

@ -334,7 +334,8 @@ object ProjectMatrix {
private def makeSources(dirSuffix: String, svDirSuffix: String): Setting[_] = {
unmanagedSourceDirectories ++= Seq(
scalaSource.value.getParentFile / s"scala${dirSuffix}",
scalaSource.value.getParentFile / s"scala$svDirSuffix"
scalaSource.value.getParentFile / s"scala$svDirSuffix",
javaSource.value.getParentFile / s"java${dirSuffix}"
)
}

View File

@ -0,0 +1,9 @@
package com.config;
public class MyClass {
public static String configValue() {
return "1.2";
}
}

View File

@ -0,0 +1,9 @@
package com.config;
public class MyClass {
public static String configValue() {
return "1.3";
}
}

View File

@ -0,0 +1,5 @@
package com.config
object Main extends App {
println(s"Version: ${MyClass.configValue()}")
}

View File

@ -0,0 +1,41 @@
ThisBuild / organization := "com.example"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / publishMavenStyle := true
ThisBuild / ivyPaths := {
val base = (ThisBuild / baseDirectory).value
IvyPaths(base, Some(base / "ivy-cache"))
}
publish / skip := true
lazy val config12 = ConfigAxis("Config1_2", "-config1.2")
lazy val config13 = ConfigAxis("Config1_3", "-config1.3")
lazy val scala212 = "2.12.10"
lazy val app = (projectMatrix in file("app"))
.settings(
name := "app",
ivyPaths := (ThisBuild / ivyPaths).value
)
.customRow(
scalaVersions = Seq(scala212),
axisValues = Seq(config12, VirtualAxis.jvm),
_.settings(
moduleName := name.value + "_config1.2",
libraryDependencies += "com.typesafe" % "config" % "1.2.1"
)
)
.customRow(
scalaVersions = Seq(scala212),
axisValues = Seq(config13, VirtualAxis.jvm),
_.settings(
moduleName := name.value + "_config1.3",
libraryDependencies += "com.typesafe" % "config" % "1.3.3"
)
)
lazy val appConfig12_212 = app.finder(config13, VirtualAxis.jvm)(scala212)
.settings(
publishMavenStyle := true
)

View File

@ -0,0 +1,5 @@
import sbt._
case class ConfigAxis(idSuffix: String, directorySuffix: String) extends VirtualAxis.WeakAxis {
}

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,4 @@
> publishLocal
$ exists ivy-cache/local/com.example/app_config1.2_2.12/0.1.0-SNAPSHOT/poms/app_config1.2_2.12.pom
$ exists ivy-cache/local/com.example/app_config1.3_2.12/0.1.0-SNAPSHOT/poms/app_config1.3_2.12.pom