Skip to content

Commit

Permalink
Support sbt 1.5.x along with 1.4.x (Fixes #290) (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindberg authored Apr 12, 2021
1 parent 2574431 commit dfaf906
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 24 deletions.
3 changes: 1 addition & 2 deletions docs/library-developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ Have a look at [mobx-slinky](https://github.com/ScalablyTyped/mobx-slinky)

## Requirements

**This plugin needs sbt 1.4.x**. Not higher or lower.
This is unfortunate, but some more design work is needed to avoid this.
**This plugin needs sbt 1.4.x or 1.5.x**.

Since we generate source code, it should work with any combination of
Scala 2.12 / 2.13 and Scala.js 1.x.
Expand Down
3 changes: 1 addition & 2 deletions docs/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ If you really want more than one conversion make sure to [shade](conversion-opti

## Requirements

**This plugin needs sbt 1.4.x**. Not higher or lower.
This is unfortunate, but some more design work is needed to avoid this.
**This plugin needs sbt 1.4.x or 1.5.x**.

Since we generate source code, it should work with any combination of
Scala 2.12 / 2.13 and Scala.js 1.x.
Expand Down
4 changes: 2 additions & 2 deletions release.sc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ case class DemoRepo(repo: String, name: String)(implicit path: os.Path) {
val pluginsFile = path / "project" / "plugins.sbt"
val newLines = os.read.lines(pluginsFile).flatMap {
case line if line.contains(s"""addSbtPlugin("org.scala-js" % "sbt-scalajs" %""") =>
Some(s"""addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.0")""")
Some(s"""addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")""")
case line if line.contains(s"""addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" %""") =>
Some(s"""addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")""")
case line if line.contains(s"""addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" %""") =>
Expand All @@ -25,7 +25,7 @@ case class DemoRepo(repo: String, name: String)(implicit path: os.Path) {
None
case line => Some(line)
}
os.write.over(path / "project" / "build.properties", "sbt.version=1.4.9")
os.write.over(path / "project" / "build.properties", "sbt.version=1.5.0")
os.write.over(pluginsFile, newLines.mkString("\n"))
%.sbt("compile", "dist")
%.git("add", "-A")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ object ScalablyTypedPluginBase extends AutoPlugin {
override lazy val globalSettings =
Seq(
Global / Keys.onLoad := (state => {
val old = (Global / Keys.onLoad).value
val ret = old(state)
val sbtVersion = Keys.sbtVersion.value
val Supported = "1.4"
if (!sbtVersion.startsWith(Supported)) {
val msg =
s"This version of the ScalablyTyped plugin only supports sbt $Supported.x . You're currently using $sbtVersion"
sys.error(msg)
val old = (Global / Keys.onLoad).value
val ret = old(state)
Keys.sbtVersion.value match {
case valid if valid.startsWith("1.4") || valid.startsWith("1.5") => ret
case invalid =>
sys.error(
s"This version of the ScalablyTyped plugin only supports sbt 1.4.x or 1.5.x. You're currently using $invalid",
)
}
ret
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.2
sbt.version=1.5.0
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
resolvers += Resolver.bintrayRepo("oyvindberg", "converter")

{
val pluginVersion = System.getProperty("plugin.version")
if (pluginVersion == null)
throw new RuntimeException("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
else addSbtPlugin("org.scalablytyped.converter" % """sbt-converter""" % pluginVersion)
}
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
resolvers += Resolver.bintrayRepo("oyvindberg", "converter")

val pluginVersion = System.getProperty("plugin.version")
if (pluginVersion == null)
throw new RuntimeException("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
else addSbtPlugin("org.scalablytyped.converter" % """sbt-converter""" % pluginVersion)

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.2
sbt.version=1.5.0
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
resolvers += Resolver.bintrayRepo("oyvindberg", "converter")

val pluginVersion = System.getProperty("plugin.version")
if (pluginVersion == null)
throw new RuntimeException("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
else addSbtPlugin("org.scalablytyped.converter" % """sbt-converter""" % pluginVersion)

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")

0 comments on commit dfaf906

Please sign in to comment.