Skip to content

Commit 1eaf275

Browse files
Add 2.13 support (#45)
For the interpolators module
1 parent 97a24a1 commit 1eaf275

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

.travis.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
2-
set -ex
2+
set -exo pipefail
33

44
TEST_VERSION="0.1.0-test"
55
sbt \
6-
test \
6+
+test \
77
mimaReportBinaryIssues \
88
'set version in ThisBuild := "'"$TEST_VERSION"'"' \
9-
publishLocal 2>&1 | grep -v 'Maybe this is program'
9+
publishLocal 2>&1 | grep -v 'Maybe this is ' | grep -v '^Renamed '
1010

1111
# test that things work from JDK 11
1212
# not actually building things from it, running into weird proguard issues…

build.sbt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lazy val finalPackageBin = taskKey[File]("")
2222
lazy val interface = project
2323
.enablePlugins(SbtProguard)
2424
.settings(
25-
skip.in(publish) := scalaVersion.value != Settings.scala212,
25+
skip.in(publish) := scalaVersion.value != Settings.scala213,
2626
finalPackageBin := {
2727
import org.pantsbuild.jarjar._
2828
import org.pantsbuild.jarjar.util.StandaloneJarProcessor
@@ -90,7 +90,7 @@ lazy val interface = project
9090
},
9191

9292
Settings.shared,
93-
Settings.mima,
93+
Settings.mima(),
9494
libraryDependencies += "io.get-coursier" %% "coursier" % "2.0.0-RC2-6",
9595

9696
libraryDependencies += "com.lihaoyi" %% "utest" % "0.7.1" % Test,
@@ -108,15 +108,23 @@ lazy val interface = project
108108
mimaPreviousArtifacts := mimaPreviousArtifacts.value.filter(_.revision != "0.0.1"),
109109

110110
// was cross-versioned publishing in 0.0.1
111-
mimaPreviousArtifacts += organization.value %% "interface" % "0.0.1",
111+
mimaPreviousArtifacts ++= {
112+
val sv = scalaVersion.value
113+
// TODO When removing 2.12 support in the future, use org % interface_2.12 below?
114+
val is212 = sv.startsWith("2.12")
115+
if (is212)
116+
Set(organization.value %% "interface" % "0.0.1")
117+
else
118+
Set.empty[ModuleID]
119+
},
112120

113121
)
114122

115123
lazy val interpolators = project
116124
.dependsOn(interface)
117125
.settings(
118126
Settings.shared,
119-
Settings.mima,
127+
Settings.mima(no213 = true),
120128
libraryDependencies ++= Seq(
121129
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
122130
"com.lihaoyi" %% "utest" % "0.7.1" % Test

interface/src/main/scala/coursier/internal/api/ApiHelper.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,13 @@ object ApiHelper {
232232
.getDependencies
233233
.asScala
234234
.map(dependency)
235+
.toVector
235236

236237
val repositories = fetch
237238
.getRepositories
238239
.asScala
239240
.map(repository)
241+
.toVector
240242

241243
val cache0 = cache(fetch.getCache)
242244

@@ -323,6 +325,7 @@ object ApiHelper {
323325
.getRepositories
324326
.asScala
325327
.map(repository)
328+
.toVector
326329

327330
val res = coursier.complete.Complete(cache0)
328331
.withRepositories(repositories)

project/Settings.scala

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,32 @@ import sbt.Keys._
55

66
object Settings {
77

8+
def scala213 = "2.13.0"
89
def scala212 = "2.12.8"
910

1011
lazy val shared = Seq(
11-
scalaVersion := scala212,
12-
crossScalaVersions := Seq(scala212),
12+
scalaVersion := scala213,
13+
crossScalaVersions := Seq(scala213, scala212),
1314
scalacOptions += "-target:jvm-1.8",
1415
javacOptions ++= Seq(
1516
"-source", "1.8",
1617
"-target", "1.8"
1718
)
1819
)
1920

20-
lazy val mima = Seq(
21+
private val filterOut = Set("0.0.1")
22+
private def no213Versions = (0 to 8).map("0.0." + _).toSet
23+
def mima(no213: Boolean = false) = Seq(
2124
MimaPlugin.autoImport.mimaPreviousArtifacts := {
22-
Mima.binaryCompatibilityVersions.map { ver =>
23-
(organization.value % moduleName.value % ver).cross(crossVersion.value)
24-
}
25+
val sv = scalaVersion.value
26+
val is213 = sv.startsWith("2.13.")
27+
Mima.binaryCompatibilityVersions
28+
.filter(v => !filterOut(v))
29+
.filter(v => !is213 || !no213 || !no213Versions(v))
30+
.map { ver =>
31+
(organization.value % moduleName.value % ver)
32+
.cross(crossVersion.value)
33+
}
2534
}
2635
)
2736

0 commit comments

Comments
 (0)