Skip to content

Remove the compat30Native project from sbt #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ lazy val scala212 = "2.12.15"
lazy val scala213 = "2.13.6"
lazy val scala30 = "3.0.2"

lazy val compat = MultiScalaCrossProject(JSPlatform, JVMPlatform, NativePlatform)(
lazy val compat = new MultiScalaCrossProject(
"compat",
_.settings(ScalaModulePlugin.scalaModuleSettings)
.settings(commonSettings)
Expand Down Expand Up @@ -85,7 +85,8 @@ lazy val compat = MultiScalaCrossProject(JSPlatform, JVMPlatform, NativePlatform
)
},
)
.jsSettings(
.disablePlugins(ScalafixPlugin),
_.jsSettings(
scalacOptions ++= {
val x = (LocalRootProject / baseDirectory).value.toURI.toString
val y = "https://raw.githubusercontent.com/scala/scala-collection-compat/" + sys.process
Expand All @@ -100,9 +101,8 @@ lazy val compat = MultiScalaCrossProject(JSPlatform, JVMPlatform, NativePlatform
},
Test / fork := false // Scala.js cannot run forked tests
)
.jsEnablePlugins(ScalaJSJUnitPlugin)
.disablePlugins(ScalafixPlugin)
.nativeSettings(
.jsEnablePlugins(ScalaJSJUnitPlugin),
_.nativeSettings(
nativeLinkStubs := true,
addCompilerPlugin(
"org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full
Expand All @@ -112,10 +112,10 @@ lazy val compat = MultiScalaCrossProject(JSPlatform, JVMPlatform, NativePlatform
)
)

val compat211 = compat(scala211)
val compat212 = compat(scala212)
val compat213 = compat(scala213)
val compat30 = compat(scala30)
val compat211 = compat(Seq(JSPlatform, JVMPlatform, NativePlatform), scala211)
val compat212 = compat(Seq(JSPlatform, JVMPlatform, NativePlatform), scala212)
val compat213 = compat(Seq(JSPlatform, JVMPlatform, NativePlatform), scala213)
val compat30 = compat(Seq(JSPlatform, JVMPlatform), scala30)

lazy val compat211JVM = compat211.jvm
lazy val compat211JS = compat211.js
Expand Down
34 changes: 14 additions & 20 deletions project/MultiScalaProject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,33 @@ trait MultiScala {
}
}

object MultiScalaCrossProject {
def apply(platforms: Platform*)(name: String,
configure: CrossProject => CrossProject): MultiScalaCrossProject =
new MultiScalaCrossProject(platforms, name, configure)
}

class MultiScalaCrossProject(platforms: Seq[Platform],
name: String,
configure: CrossProject => CrossProject)
class MultiScalaCrossProject(name: String,
configureCommonJvm: CrossProject => CrossProject,
configureJs: CrossProject => CrossProject,
configureNative: CrossProject => CrossProject)
extends MultiScala {

def apply(scalaV: String): CrossProject = apply(scalaV, scalaV, x => x)

def apply(
scalaV: String,
scalaVJs: String,
configurePerScala: CrossProject => CrossProject = x => x
platforms: Seq[Platform],
scalaV: String
): CrossProject = {
val hasJs = platforms.contains(JSPlatform)
val hasNative = platforms.contains(NativePlatform)
val projectId = projectIdPerScala(name, scalaV)
val resultingProject =
val res =
CrossProject(
id = projectId,
base = file(s".cross/$projectId")
)(platforms: _*)
.crossType(CrossType.Full)
.withoutSuffixFor(JVMPlatform)
.settings(moduleName := name)
.jvmSettings(scalaVersion := scalaV)
.jsSettings(scalaVersion := scalaVJs)
.nativeSettings(scalaVersion := scalaV)
.settings(scalaVersion := scalaV)
.settings(srcFull(name))

configurePerScala(configure(resultingProject))
val conf = configureCommonJvm
.andThen(if (hasJs) configureJs else identity)
.andThen(if (hasNative) configureNative else identity)
conf(res)
}
}

Expand Down