Skip to content

Commit

Permalink
Merge pull request #376 from sjrd/drop-scalajs-0.6.x
Browse files Browse the repository at this point in the history
Drop support for Scala.js 0.6.x, and some cleanups
  • Loading branch information
sjrd authored Oct 20, 2020
2 parents 06f75a3 + 74d0154 commit 08d6e48
Show file tree
Hide file tree
Showing 52 changed files with 66 additions and 949 deletions.
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ env:
- secure: YXQWJjmqrib8ePEp/Ds7US9P5+medDAsKc8X/zHcwoNIGIpJF6QyBqkvLJNq5IkM05K0AF8AGmz2BlS1XECIYkTdQVS0dITrEFuiaiiUzURNlhJGjtw10NAS99+dW3M/T4MKWvTgWcIsgEx0ttsTlMedWpm7aFS4Zn9i3sx2iUSHmck74JTHUcI/1DltgwTu73euxgNBPSl6ICDKEcwRgjCor55/HLbhiHBS6nx/OVPiazFrsnOG8psfn8NZUJMYiNK4FL69BxHHyvs1mQx0U24Yxbg/r2U+QrPihq5Xk9MglDz13wjxu0WrVQdFZzLRxmnTXpRr/Kx9l4xN4IMvg0hNeJ0tBCq2g3i1XXeIkf0LM0ZoImV7pB4JWUYywUyGwz5/NLiJH82dVpXO3YtHl5kF22+Vtd+IOSWmVkx4bW+UTW3vLXDyxfULscNLGb3yeuTcW10NLAlXSakNvukyYoA3K7BGoN4J3v36CzKcO3wD1hzSChhd3ivngtuKF+rdKiJTjzVd/hnwTF7xZ7CNpGSDoggT/NQ4oHIWTdWBcMDI61H76eMOittphBOOfYEcXYPwBrDSMHDnPKyoNdWc3VItCAYp5dqZxtNxkclIEzGHjOEB03II5zDhF+uv4YPxaf2IYhhcLsdE5JHltpa9CVnTciJdrJ6nKx4vNBqzRhM=
- secure: CGqZrHZPgWOVZcjCL4iDJRlYPeC46Ko53ZufP4UtKpC7bdXgzqsbLVinI0EYwjZ0MZNUFQhOSKCK+2tNcnVA0EkhzMLSBE2sHXQ3fwO3EsoSGLCEOKh2LSrxb2S2AXHJer2/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1jwaDJq1lh78WYWqR8uq9husZas+VNVMwFAyt3w3ew/d3Z0kcmzOaujZC3OFmI20qd3+Aep9o32Qn1rCmRXmfD5IQFDx1OoR6bjfwDNoa2YDE/a9fH8MfFWqDam6C5PDOL0EPTe/PJUUY4Kk+6/x2Tm5bhQEXXt0RxZ23FBI=
matrix:
- SCALAJS_VERSION="1.0.0"
- SCALAJS_VERSION="0.6.33"
jdk:
- openjdk11
before_install:
Expand All @@ -22,13 +19,10 @@ before_install:
tar xv -C travis -f travis/secrets.tar;
fi
script:
- sbt -no-colors ";test;runScripted"
- sbt -no-colors ";test;scripted"
after_success:
- if [ $TRAVIS_PULL_REQUEST = 'false' ] && [ -n "$TRAVIS_TAG" ]; then
if [ $SCALAJS_VERSION = '1.0.0' ]; then
sbt scalajs-bundler-linker/publishSigned;
fi;
sbt "; sbt-scalajs-bundler/publishSigned; sbt-web-scalajs-bundler/publishSigned; sonatypeReleaseAll; manual/makeSite; manual/ghpagesPushSite";
sbt "; scalajs-bundler-linker/publishSigned; sbt-scalajs-bundler/publishSigned; sbt-web-scalajs-bundler/publishSigned; sonatypeReleaseAll; manual/makeSite; manual/ghpagesPushSite";
fi
cache:
yarn: true
Expand Down
18 changes: 1 addition & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,11 @@ We use [sbt-scripted](http://eed3si9n.com/testing-sbt-plugins) to test the plugi
the way tests are launched to filter tests according to their compatibility with major versions of sbt and Scala.js:

- tests can have a `project/build.properties` file defining a specific sbt version they are compatible with,
- test names suffixed with `_sjs-0.6` are only compatible with Scala.js 0.6.

The version of Scala.js to use is provided by the `SCALAJS_VERSION` environment variable. You can set the sbt version
to use with the standard `^^` operator.

To run all the tests:

~~~ sh
$ sbt runScripted
~~~

Or, with a specific sbt version:

~~~ bash
$ sbt ^^1.2.8 runScripted
~~~

Or, with a specific Scala.js version (Scala.js 1.x also requires sbt 1.x):

~~~ bash
$ SCALAJS_VERSION=1.0.0 sbt ^^1.2.8 runScripted
$ sbt scripted
~~~

To run a single test:
Expand Down
6 changes: 1 addition & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
version: '{build}'
os: Windows Server 2012
environment:
matrix:
- CI_SBT_VERSION: 1.2.8
SCALAJS_VERSION: 1.0.0
install:
- ps: Install-Product node 12
- cmd: choco install sbt --version 1.4.0 -ia "INSTALLDIR=""C:\sbt"""
- cmd: SET PATH=C:\sbt\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g
build: off
test_script:
- cmd: sbt ";^^%CI_SBT_VERSION%;test;runScripted"
- cmd: sbt ";test;scripted"
cache:
- C:\sbt
- C:\Users\appveyor\.ivy2\cache
Expand Down
91 changes: 11 additions & 80 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
val runScripted = taskKey[Unit]("Run supported sbt scripted tests")

val scalaJSVersion = sys.env.getOrElse("SCALAJS_VERSION", "1.0.0")
val isScalaJS1x = scalaJSVersion.startsWith("1.")
val scalaJSSourceDirectorySuffix = if (isScalaJS1x) "sjs-1.x" else "sjs-0.6"

// This project is only used with Scala.js 1.x
lazy val `scalajs-bundler-linker` =
project.in(file("scalajs-bundler-linker"))
.settings(
Expand All @@ -17,27 +12,18 @@ val `sbt-scalajs-bundler` =
.enablePlugins(SbtPlugin, BuildInfoPlugin)
.settings(commonSettings)
.settings(
name := (if (isScalaJS1x) "sbt-scalajs-bundler" else "sbt-scalajs-bundler-sjs06"),
description := "Module bundler for Scala.js projects",
libraryDependencies += "com.google.jimfs" % "jimfs" % "1.1",
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.7",
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion),
unmanagedSourceDirectories in Compile += (sourceDirectory in Compile).value / s"scala-$scalaJSSourceDirectorySuffix",
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "scalajsbundler.sbtplugin.internal",
// When supported, add: buildInfoOptions += sbtbuildinfo.BuildInfoOption.PackagePrivate
if (isScalaJS1x) {
scriptedDependencies := {
val () = scriptedDependencies.value
val () = publishLocal.value
val () = (publishLocal in `scalajs-bundler-linker`).value
}
} else {
scriptedDependencies := {
val () = scriptedDependencies.value
val () = publishLocal.value
}
}
scriptedDependencies := {
val () = scriptedDependencies.value
val () = publishLocal.value
val () = (publishLocal in `scalajs-bundler-linker`).value
},
)

val `sbt-web-scalajs-bundler` =
Expand All @@ -48,24 +34,14 @@ val `sbt-web-scalajs-bundler` =
// sbt-web-scalajs does not support sbt 1.2.x
crossSbtVersions := List("1.3.0"),
sbtVersion in pluginCrossBuild := "1.3.0",

if (isScalaJS1x) {
scriptedDependencies := {
val () = scriptedDependencies.value
val () = publishLocal.value
val () = (publishLocal in `sbt-scalajs-bundler`).value
val () = (publishLocal in `scalajs-bundler-linker`).value
}
} else {
scriptedDependencies := {
val () = scriptedDependencies.value
val () = publishLocal.value
val () = (publishLocal in `sbt-scalajs-bundler`).value
}
scriptedDependencies := {
val () = scriptedDependencies.value
val () = publishLocal.value
val () = (publishLocal in `sbt-scalajs-bundler`).value
val () = (publishLocal in `scalajs-bundler-linker`).value
},
name := (if (isScalaJS1x) "sbt-web-scalajs-bundler" else "sbt-web-scalajs-bundler-sjs06"),
description := "Module bundler for Scala.js projects (integration with sbt-web-scalajs)",
addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % (if (isScalaJS1x) "1.1.0" else "1.1.0-0.6"))
addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.1.0")
)
.dependsOn(`sbt-scalajs-bundler`)

Expand Down Expand Up @@ -150,7 +126,6 @@ inThisBuild(List(

lazy val commonSettings = List(
publishTo := sonatypePublishTo.value,
runScripted := runScriptedTask.value,
scriptedLaunchOpts ++= Seq(
"-Dplugin.version=" + version.value,
s"-Dscalajs.version=$scalaJSVersion",
Expand All @@ -168,48 +143,4 @@ lazy val noPublishSettings =
publishLocal := {}
)

// Run all the sbt-scripted tests that are compatible with both the selected sbt version
// and the selected Scala.js version
def runScriptedTask = Def.taskDyn {
val sbtBinVersion = (sbtBinaryVersion in pluginCrossBuild).value
val base = sbtTestDirectory.value

def isCompatible(directory: File): Boolean = {
val buildProps = new java.util.Properties()
IO.load(buildProps, directory / "project" / "build.properties")
val sbtIncompatibility =
Option(buildProps.getProperty("sbt.version"))
.flatMap { version =>
val requiredBinVersion = CrossVersion.binarySbtVersion(version)
if (requiredBinVersion == sbtBinVersion) None
else Some(s"it requires sbt $requiredBinVersion")
}
val scalaJSIncompatibility =
if (directory.name.endsWith("_sjs-0.6") && !scalaJSVersion.startsWith("0.6")) Some(s"it requires Scala.js 0.6")
else if (directory.name.endsWith("_sjs-1") && !scalaJSVersion.startsWith("1.")) Some("it requires Scala.js 1.x")
else None

sbtIncompatibility.orElse(scalaJSIncompatibility) match {
case Some(reason) =>
val testName = directory.relativeTo(base).getOrElse(directory)
streams.value.log.info(s"Skipping $testName since $reason")
false
case None =>
true
}
}

val testDirectoryFinder = base * AllPassFilter * AllPassFilter filter { _.isDirectory }
val tests = for {
test <- testDirectoryFinder.get
if isCompatible(test)
path <- Path.relativeTo(base)(test)
} yield path.replace('\\', '/')

if (tests.nonEmpty)
Def.task(scripted.toTask(tests.mkString(" ", " ", "")).value)
else
Def.task(streams.value.log.warn("No tests can be run for this sbt version"))
}

ivyLoggingLevel in ThisBuild := UpdateLogging.Quiet

This file was deleted.

Loading

0 comments on commit 08d6e48

Please sign in to comment.