Skip to content

Commit fe17616

Browse files
committedJul 23, 2019
Drop sbt 0.13.x support
1 parent 6360501 commit fe17616

File tree

11 files changed

+58
-194
lines changed

11 files changed

+58
-194
lines changed
 

Diff for: ‎DEVELOPING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,5 @@ following incantations.
184184

185185
> ++SCALA_VERSION
186186
> ;compiler/publishLocal;library/publishLocal;testInterface/publishLocal;testBridge/publishLocal;jUnitRuntime/publishLocal;jUnitPlugin/publishLocal
187-
> ++2.10.7
187+
> ++2.12.8
188188
> ;ir/publishLocal;io/publishLocal;logging/publishLocal;linker/publishLocal;jsEnvs/publishLocal;jsEnvsTestKit/publishLocal;nodeJSEnv/publishLocal;testAdapter/publishLocal;sbtPlugin/publishLocal

Diff for: ‎Jenkinsfile

+3-6
Original file line numberDiff line numberDiff line change
@@ -370,21 +370,19 @@ def Tasks = [
370370

371371
"sbtplugin-test": '''
372372
setJavaVersion 1.8
373-
SBT_VER_OVERRIDE=$sbt_version_override
374373
# Publish Scala.js artifacts locally
375374
# Then go into standalone project and test
376375
npm install &&
377376
sbt ++2.11.12 compiler/publishLocal library/publishLocal \
378377
testInterface/publishLocal testBridge/publishLocal \
379378
jUnitPlugin/publishLocal jUnitRuntime/publishLocal &&
380-
sbt ++$toolsscala ${SBT_VER_OVERRIDE:+^^$SBT_VER_OVERRIDE} \
379+
sbt ++$toolsscala \
381380
ir/publishLocal logging/publishLocal \
382381
linker/publishLocal jsEnvs/publishLocal \
383382
nodeJSEnv/publishLocal testAdapter/publishLocal \
384383
sbtPlugin/publishLocal &&
385384
cd sbt-plugin-test &&
386385
setJavaVersion $java &&
387-
if [ -n "$SBT_VER_OVERRIDE" ]; then echo "sbt.version=$SBT_VER_OVERRIDE" > ./project/build.properties; fi &&
388386
sbt noDOM/run \
389387
noDOM/testHtml multiTestJS/testHtml \
390388
test \
@@ -456,13 +454,12 @@ mainScalaVersions.each { scalaVersion ->
456454
}
457455
quickMatrix.add([task: "test-suite-ecma-script5-force-polyfills", scala: mainScalaVersion, java: mainJavaVersion, testSuite: "testSuite"])
458456
allJavaVersions.each { javaVersion ->
459-
quickMatrix.add([task: "tools-sbtplugin", scala: "2.12.8", sbt_version_override: "", java: javaVersion])
457+
quickMatrix.add([task: "tools-sbtplugin", scala: "2.12.8", java: javaVersion])
460458
quickMatrix.add([task: "tools", scala: "2.10.7", java: javaVersion])
461459
quickMatrix.add([task: "tools", scala: "2.11.12", java: javaVersion])
462460
}
463461
quickMatrix.add([task: "partestc", scala: "2.11.0", java: mainJavaVersion])
464-
quickMatrix.add([task: "sbtplugin-test", toolsscala: "2.10.7", sbt_version_override: "0.13.17", java: mainJavaVersion])
465-
quickMatrix.add([task: "sbtplugin-test", toolsscala: "2.12.8", sbt_version_override: "", java: mainJavaVersion])
462+
quickMatrix.add([task: "sbtplugin-test", toolsscala: "2.12.8", java: mainJavaVersion])
466463

467464
// The 'full' matrix
468465
def fullMatrix = quickMatrix.clone()

Diff for: ‎project/Build.scala

+2-7
Original file line numberDiff line numberDiff line change
@@ -785,13 +785,8 @@ object Build {
785785
normalizedName := "sbt-scalajs",
786786
bintrayProjectName := "sbt-scalajs-plugin", // "sbt-scalajs" was taken
787787
sbtPlugin := true,
788-
sbtVersion in pluginCrossBuild := {
789-
scalaVersion.value match {
790-
case v if v.startsWith("2.10.") => "0.13.17"
791-
case _ => "1.0.0"
792-
}
793-
},
794-
crossScalaVersions := Seq("2.10.7", "2.12.8"),
788+
crossScalaVersions := Seq("2.12.8"),
789+
sbtVersion := "1.0.0",
795790
scalaBinaryVersion :=
796791
CrossVersion.binaryScalaVersion(scalaVersion.value),
797792
previousArtifactSetting,

Diff for: ‎project/build.sbt

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ unmanagedSourceDirectories in Compile ++= {
2525
root / "test-adapter/src/main/scala",
2626
root / "test-common/src/main/scala",
2727
root / "sbt-plugin/src/main/scala",
28-
root / "sbt-plugin/src/main/scala-sbt-1.0"
2928
)
3029
}
3130

Diff for: ‎sbt-plugin-test/build.sbt

+2-5
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,8 @@ lazy val multiTestJVM = project.in(file("multiTest/jvm")).
164164
// Test platformDepsCrossVersion (as a setting, it's evaluated when loading the build)
165165
platformDepsCrossVersion := {
166166
val value = platformDepsCrossVersion.value
167-
if (!sbtVersion.value.startsWith("0.")) {
168-
// In 0.13, CrossVersions do not have a meaningful ==, but they do in 1.0
169-
assert(value == CrossVersion.binary,
170-
"platformDepsCrossVersion should be CrossVersion.binary in multiTestJVM")
171-
}
167+
assert(value == CrossVersion.binary,
168+
"platformDepsCrossVersion should be CrossVersion.binary in multiTestJVM")
172169
value
173170
}
174171
).

Diff for: ‎sbt-plugin/src/main/scala-sbt-0.13/org/scalajs/sbtplugin/SBTCompat.scala

-64
This file was deleted.

Diff for: ‎sbt-plugin/src/main/scala-sbt-1.0/org/scalajs/sbtplugin/SBTCompat.scala

-71
This file was deleted.

Diff for: ‎sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSCrossVersion.scala

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import sbt._
1616

1717
import org.scalajs.ir.ScalaJSVersions
1818

19-
import SBTCompat._
20-
2119
object ScalaJSCrossVersion {
2220
private final val ReleaseVersion =
2321
raw"""(\d+)\.(\d+)\.(\d+)""".r
@@ -32,8 +30,16 @@ object ScalaJSCrossVersion {
3230
case _ => full
3331
}
3432

35-
def scalaJSMapped(cross: CrossVersion): CrossVersion =
36-
crossVersionAddScalaJSPart(cross, "sjs" + currentBinaryVersion)
33+
def scalaJSMapped(cross: CrossVersion): CrossVersion = cross match {
34+
case CrossVersion.Disabled =>
35+
CrossVersion.constant("sjs" + currentBinaryVersion)
36+
case cross: sbt.librarymanagement.Constant =>
37+
cross.withValue("sjs" + currentBinaryVersion + "_" + cross.value)
38+
case cross: CrossVersion.Binary =>
39+
cross.withPrefix("sjs" + currentBinaryVersion + "_" + cross.prefix)
40+
case cross: CrossVersion.Full =>
41+
cross.withPrefix("sjs" + currentBinaryVersion + "_" + cross.prefix)
42+
}
3743

3844
val binary: CrossVersion = scalaJSMapped(CrossVersion.binary)
3945

Diff for: ‎sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPlugin.scala

+1-4
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,7 @@ object ScalaJSPlugin extends AutoPlugin {
181181
Seq(
182182
scalaJSStage := Stage.FastOpt,
183183

184-
scalaJSLinkerConfig := {
185-
StandardLinker.Config()
186-
.withParallel(ScalaJSPluginInternal.DefaultParallelLinker)
187-
},
184+
scalaJSLinkerConfig := StandardLinker.Config(),
188185

189186
jsEnv := new NodeJSEnv(),
190187

Diff for: ‎sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPluginInternal.scala

+37-26
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ import org.scalajs.ir.Printers.IRTreePrinter
3939
import org.scalajs.testing.adapter.{TestAdapter, HTMLRunnerBuilder, TestAdapterInitializer}
4040

4141
import Loggers._
42-
import SBTCompat._
43-
import SBTCompat.formatImplicits._
44-
import SBTCompat.formatImplicits.seqFormat
42+
43+
import sjsonnew.BasicJsonProtocol._
44+
import sjsonnew.BasicJsonProtocol.seqFormat
4545

4646
/** Implementation details of `ScalaJSPlugin`. */
4747
private[sbtplugin] object ScalaJSPluginInternal {
@@ -85,26 +85,6 @@ private[sbtplugin] object ScalaJSPluginInternal {
8585
private[sbtplugin] def closeAllTestAdapters(): Unit =
8686
createdTestAdapters.getAndSet(Nil).foreach(_.close())
8787

88-
/* #2798 -- On Java 9+, the parallel collections on 2.10 die with a
89-
* `NumberFormatException` and prevent the linker from working.
90-
*
91-
* By default, we therefore pre-emptively disable the parallel optimizer in
92-
* case the parallel collections cannot deal with the current version of
93-
* Java.
94-
*
95-
* TODO This will automatically "fix itself" once we upgrade to sbt 1.x,
96-
* which uses Scala 2.12. We should get rid of that workaround at that point
97-
* for tidiness, though.
98-
*/
99-
val DefaultParallelLinker: Boolean = {
100-
try {
101-
scala.util.Properties.isJavaAtLeast("1.8")
102-
true
103-
} catch {
104-
case _: NumberFormatException => false
105-
}
106-
}
107-
10888
private def enhanceIRVersionNotSupportedException[A](body: => A): A = {
10989
try {
11090
body
@@ -131,9 +111,40 @@ private[sbtplugin] object ScalaJSPluginInternal {
131111
}
132112
}
133113

134-
/** Patches the IncOptions so that .sjsir files are pruned as needed. */
135-
def scalaJSPatchIncOptions(incOptions: IncOptions): IncOptions =
136-
SBTCompat.scalaJSPatchIncOptions(incOptions)
114+
/** Patches the IncOptions so that .sjsir files are pruned as needed.
115+
*
116+
* This complicated logic patches the ClassfileManager factory of the given
117+
* IncOptions with one that is aware of .sjsir files emitted by the Scala.js
118+
* compiler. This makes sure that, when a .class file must be deleted, the
119+
* corresponding .sjsir file are also deleted.
120+
*/
121+
def scalaJSPatchIncOptions(incOptions: IncOptions): IncOptions = {
122+
import xsbti.compile.{ClassFileManager, ClassFileManagerUtil}
123+
124+
val sjsirFileManager = new ClassFileManager {
125+
private[this] val inherited =
126+
ClassFileManagerUtil.getDefaultClassFileManager(incOptions)
127+
128+
def delete(classes: Array[File]): Unit = {
129+
inherited.delete(classes.flatMap { classFile =>
130+
if (classFile.getPath.endsWith(".class")) {
131+
val f = new File(classFile.getPath.stripSuffix(".class") + ".sjsir")
132+
if (f.exists) List(f)
133+
else Nil
134+
} else {
135+
Nil
136+
}
137+
})
138+
}
139+
140+
def generated(classes: Array[File]): Unit = {}
141+
def complete(success: Boolean): Unit = {}
142+
}
143+
144+
val newExternalHooks =
145+
incOptions.externalHooks.withExternalClassFileManager(sjsirFileManager)
146+
incOptions.withExternalHooks(newExternalHooks)
147+
}
137148

138149
/** Settings for the production key (e.g. fastOptJS) of a given stage */
139150
private def scalaJSStageSettings(stage: Stage,

Diff for: ‎scripts/publish.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ fi
1010
COMPILER_VERSIONS="2.11.0 2.11.1 2.11.2 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.11 2.11.12 2.12.1 2.12.2 2.12.3 2.12.4 2.12.5 2.12.6 2.12.7 2.12.8 2.13.0"
1111
BIN_VERSIONS="2.11.12 2.12.8 2.13.0"
1212
JVM_BIN_VERSIONS="2.10.7 2.11.12 2.12.8"
13-
SBT_VERSION="2.10.7"
14-
SBT1_VERSION="2.12.8"
15-
SBT1_SBTVERSION="1.0.0"
13+
SBT_VERSION="2.12.8"
1614

1715
COMPILER="compiler jUnitPlugin"
1816
LIBS="library irJS loggingJS linkerJS testInterface testBridge jUnitRuntime"
@@ -46,5 +44,4 @@ for v in $JVM_BIN_VERSIONS; do
4644
done
4745

4846
# Publish sbt-plugin
49-
$CMD "++$SBT_VERSION" "sbtPlugin/publishSigned"
50-
$CMD "++$SBT1_VERSION" "^^$SBT1_SBTVERSION" "sbtPlugin/publishSigned"
47+
$CMD "++$SBT_VERSION" sbtPlugin/publishSigned"

0 commit comments

Comments
 (0)
Please sign in to comment.