PR comments, update README, upgrade Scala Native

This commit is contained in:
Anton Sviridov 2020-11-19 12:52:57 +00:00
parent e3abc56808
commit c58f78c592
9 changed files with 76588 additions and 12 deletions

2
.gitignore vendored
View File

@ -14,4 +14,4 @@ metals.sbt
src/sbt-test/projectMatrix/projectAxes/target
src/sbt-test/projectMatrix/projectAxes/project/target
.vscode

View File

@ -152,7 +152,7 @@ lazy val app = (projectMatrix in file("app"))
This will create `appConfig1_22_11`, `appConfig1_22_12`, and `appConfig1_32_12` respectively producing `app_config1.3_2.12`, `app_config1.2_2.11`, and `app_config1.2_2.12` artifacts.
### referncing the generated subprojects
### referencing the generated subprojects
You might want to reference to one of the projects within `build.sbt`.
@ -164,6 +164,29 @@ lazy val appConfig12_212 = app.finder(config13, VirtualAxis.jvm)("2.12.8")
In the above `core12` returns `Project` type.
### accessing axes from subprojects
Each generated subproject can access the values for all the axes using `virtualAxes` key:
```scala
lazy val platformTest = settingKey[String]("")
lazy val core = (projectMatrix in file("core"))
.settings(
name := "core"
)
.jsPlatform(scalaVersions = Seq("2.12.12", "2.11.12"))
.jvmPlatform(scalaVersion = Seq("2.12.12", "2.13.3"))
.settings(
platformTest := {
if(virtualAxes.value.contains(VirtualAxis.jvm))
"JVM project"
else
"JS project"
}
)
```
credits
-------

View File

@ -263,7 +263,7 @@ object ProjectMatrix {
inConfig(Compile)(makeSources(nonScalaDirSuffix, svDirSuffix)),
inConfig(Test)(makeSources(nonScalaDirSuffix, svDirSuffix)),
projectDependencies := projectDependenciesTask.value,
ProjectMatrixKeys.projectAxes := axes
ProjectMatrixKeys.virtualAxes := axes
)
.settings(self.settings)
.configure(transforms: _*)

View File

@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicBoolean
import scala.language.experimental.macros
trait ProjectMatrixKeys {
val projectAxes = settingKey[Seq[VirtualAxis]]("Virtual axes for the project")
val virtualAxes = settingKey[Seq[VirtualAxis]]("Virtual axes for the project")
}
object ProjectMatrixKeys extends ProjectMatrixKeys

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
sbt.version = 1.4.3

View File

@ -3,4 +3,4 @@ sys.props.get("plugin.version") match {
case _ => sys.error("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
}
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")

View File

@ -40,16 +40,16 @@ lazy val custom =
lazy val platformSettings = Seq[Def.Setting[_]](
platformTest := {
if(projectAxes.value.contains(sbt.VirtualAxis.js)) "js-platform"
else if(projectAxes.value.contains(sbt.VirtualAxis.jvm)) "jvm-platform"
else throw new RuntimeException(s"Something must be wrong (built-in platforms test) - projectAxes value is ${projectAxes.value}")
if(virtualAxes.value.contains(sbt.VirtualAxis.js)) "js-platform"
else if(virtualAxes.value.contains(sbt.VirtualAxis.jvm)) "jvm-platform"
else throw new RuntimeException(s"Something must be wrong (built-in platforms test) - virtualAxes value is ${virtualAxes.value}")
}
)
lazy val customSettings = Seq[Def.Setting[_]](
configTest := {
if(projectAxes.value.contains(config12)) "config for 1.2"
else if (projectAxes.value.contains(config13)) "config for 1.3"
else throw new RuntimeException(s"Something must be wrong (custom axis test ) - projectAxes value is ${projectAxes.value}")
if(virtualAxes.value.contains(config12)) "config for 1.2"
else if (virtualAxes.value.contains(config13)) "config for 1.3"
else throw new RuntimeException(s"Something must be wrong (custom axis test ) - virtualAxes value is ${virtualAxes.value}")
}
)

View File

@ -1 +0,0 @@
sbt.version=1.4.0-M1