Skip to content

fix Scala 3 publishing #616

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
Jul 28, 2022
Merged
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
22 changes: 0 additions & 22 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
crossScalaVersions := Seq("2.13.8", "2.12.16", "3.1.3"),
scalaVersion := "2.12.16",

// Don't publish for Scala 3.1 or later, only from 3.0
publish / skip := (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, x)) if x > 0 => true
case _ => false
}),

scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) =>
Seq("-language:Scala2")
Expand Down Expand Up @@ -161,20 +155,4 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
s"-Xplugin:$jarPath"
},
Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v"),
// Scala Native doesn't support Scala 3.0
Compile / nativeLink := { if(isScala30(scalaVersion.value)) null else (Compile / nativeLink).value },
Test / nativeLink := { if(isScala30(scalaVersion.value)) null else (Test / nativeLink).value },
Test / test := { if(isScala30(scalaVersion.value)) {} else (Test / test).value },
Compile / sources := { if(isScala30(scalaVersion.value)) Nil else (Compile / sources).value },
Test / sources := { if(isScala30(scalaVersion.value)) Nil else (Test / sources).value },
libraryDependencies := { if(isScala30(scalaVersion.value)) Nil else libraryDependencies.value },
Test / scalacOptions := { if(isScala30(scalaVersion.value)) Nil else (Test / scalacOptions).value },
publish / skip := { isScala30(scalaVersion.value) },
)

def isScala30(scalaVersion: String) = {
CrossVersion.partialVersion(scalaVersion) match {
case Some((3, 0)) => true
case _ => false
}
}