From 77128cd1a460b6b8c1bb9adc664e0685a1ba1d61 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 2 Mar 2020 11:00:23 +0100 Subject: [PATCH] Add Scala.JS 1.0 support (#159) --- .travis.yml | 9 +++++++++ project/Settings.scala | 13 +++++++++++++ project/plugins.sbt | 5 ++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67dccec..fb7d2b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,17 @@ jobs: - scala: 2.11.12 - scala: 2.12.10 - scala: 2.13.1 + - env: SCALAJS_VERSION=0.6.32 + name: "Scala.JS 0.6" + script: sbt -batch +testJS/test - stage: release script: sbt ci-release + - stage: release + env: + - SCALAJS_VERSION=0.6.32 + - CI_RELEASE=+coreJS/publishSigned + name: "Scala.JS 0.6" + script: sbt ci-release branches: only: - master diff --git a/project/Settings.scala b/project/Settings.scala index a0a5c6c..93053c5 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -12,6 +12,13 @@ object Settings { lazy val shared = Seq( scalaVersion := scala212, crossScalaVersions := Seq(scala213, scala212, scala211), + crossScalaVersions := { + val former = crossScalaVersions.value + if (isScalaJs1.value) + former.filter(!_.startsWith("2.11.")) + else + former + }, scalacOptions ++= { scalaBinaryVersion.value match { case "2.11" => @@ -33,4 +40,10 @@ object Settings { testFrameworks += new TestFramework("utest.runner.Framework") ) + lazy val isScalaJs1 = Def.setting { + def scalaJsVersion = Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.0.0") + sbtcrossproject.CrossPlugin.autoImport.crossProjectPlatform.?.value.contains(scalajscrossproject.JSPlatform) && + scalaJsVersion.startsWith("1.") + } + } diff --git a/project/plugins.sbt b/project/plugins.sbt index 418e723..449e67d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,8 +1,11 @@ plugins_( "com.geirsson" % "sbt-ci-release" % "1.5.2", "com.typesafe" % "sbt-mima-plugin" % "0.7.0", - "org.scala-js" % "sbt-scalajs" % "0.6.32", "org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0" ) def plugins_(modules: ModuleID*) = modules.map(addSbtPlugin) + +val scalaJsVersion = Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.0.0") + +addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJsVersion)