mirror of https://github.com/sbt/sbt.git
PR comments, update README, upgrade Scala Native
This commit is contained in:
parent
e3abc56808
commit
c58f78c592
|
|
@ -14,4 +14,4 @@ metals.sbt
|
|||
src/sbt-test/projectMatrix/projectAxes/target
|
||||
src/sbt-test/projectMatrix/projectAxes/project/target
|
||||
|
||||
|
||||
.vscode
|
||||
|
|
|
|||
|
|
@ -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
|
||||
-------
|
||||
|
||||
|
|
|
|||
|
|
@ -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: _*)
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
sbt.version = 1.4.3
|
||||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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}")
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
sbt.version=1.4.0-M1
|
||||
Loading…
Reference in New Issue