From 5f287e21fbe57ee58d7f4b419119d92d8b9a534a Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Sun, 19 Apr 2020 01:35:47 -0700 Subject: [PATCH 1/2] Upgrade Binding.scala --- js/js.sbt | 2 +- shared/build.sbt | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/js/js.sbt b/js/js.sbt index b9ca758..0d772f1 100644 --- a/js/js.sbt +++ b/js/js.sbt @@ -1,6 +1,6 @@ enablePlugins(Example) -libraryDependencies += "com.thoughtworks.binding" %%% "jspromisebinding" % "12.0.0-M0" +libraryDependencies += "com.thoughtworks.binding" %%% "jspromisebinding" % "12.0.0-M1" addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3") diff --git a/shared/build.sbt b/shared/build.sbt index bdbf43e..55917e8 100644 --- a/shared/build.sbt +++ b/shared/build.sbt @@ -1,14 +1,11 @@ libraryDependencies += "org.scalatest" %%% "scalatest" % "3.1.1" % Test -libraryDependencies += "com.thoughtworks.binding" %%% "binding" % "12.0.0-M0" - -libraryDependencies += "com.thoughtworks.binding" %%% "futurebinding" % "12.0.0-M0" - -libraryDependencies += "com.thoughtworks.binding" %%% "futurebinding" % "12.0.0-M0" +libraryDependencies += "com.thoughtworks.binding" %%% "binding" % "12.0.0-M1" +libraryDependencies += "com.thoughtworks.binding" %%% "futurebinding" % "12.0.0-M1" libraryDependencies += "org.typelevel" %% "simulacrum" % "1.0.0" libraryDependencies += "com.thoughtworks.enableIf" %% "enableif" % "1.1.7" -scalacOptions += "-Ymacro-annotations" \ No newline at end of file +scalacOptions += "-Ymacro-annotations" From a304b6182f47c3dbfabd4f58703a0a87f755e24c Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Sat, 18 Apr 2020 18:39:23 -0700 Subject: [PATCH 2/2] Cross build for Scala.js 1.x and 0.6 --- .travis.yml | 8 +++++++- build.sbt | 6 +++--- js/js.sbt | 8 +++----- project/plugins.sbt | 6 +++++- project/plugins.sbt.scalajs06 | 28 ++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 project/plugins.sbt.scalajs06 diff --git a/.travis.yml b/.travis.yml index db8bf19..082841e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,8 +29,14 @@ before_deploy: deploy: - provider: script - script: sbt ++$TRAVIS_SCALA_VERSION "set every Seq(sonatypeSessionName := \"Travis Job $TRAVIS_JOB_NAME $TRAVIS_JOB_NUMBER ($TRAVIS_JOB_WEB_URL)\", publishTo := sonatypePublishToBundle.value)" publishSigned sonatypeBundleRelease + script: sbt $SBT_ARGS ++$TRAVIS_SCALA_VERSION "set every Seq(sonatypeSessionName := \"Travis Job $TRAVIS_JOB_NAME $TRAVIS_JOB_NUMBER ($TRAVIS_JOB_WEB_URL)\", publishTo := sonatypePublishToBundle.value)" publishSigned sonatypeBundleRelease skip_cleanup: true on: all_branches: true condition: $GITHUB_PERSONAL_ACCESS_TOKEN + +env: + - SBT_ARGS= + - SBT_ARGS=--addPluginSbtFile=project/plugins.sbt.scalajs06 + +sbt_args: $SBT_ARGS diff --git a/build.sbt b/build.sbt index ce476a5..327e552 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,9 @@ +import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} + Global / parallelExecution := false publish / skip := true organization in ThisBuild := "com.thoughtworks.binding" -lazy val bindable = crossProject in file(".") -lazy val bindableJVM = bindable.jvm -lazy val bindableJS = bindable.js +lazy val bindable = crossProject(JVMPlatform, JSPlatform) in file(".") diff --git a/js/js.sbt b/js/js.sbt index 0d772f1..af177c2 100644 --- a/js/js.sbt +++ b/js/js.sbt @@ -1,11 +1,9 @@ +enablePlugins(ScalaJSBundlerPlugin) + enablePlugins(Example) libraryDependencies += "com.thoughtworks.binding" %%% "jspromisebinding" % "12.0.0-M1" addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.10.3") -jsDependencies in Test += RuntimeDOM - -inConfig(Test) { - jsEnv := RhinoJSEnv().value -} +requireJsDomEnv in Test := true diff --git a/project/plugins.sbt b/project/plugins.sbt index 52350fb..e04eb57 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -8,7 +8,11 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1") + +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") + +addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.17.0") addSbtPlugin("com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0") diff --git a/project/plugins.sbt.scalajs06 b/project/plugins.sbt.scalajs06 new file mode 100644 index 0000000..6b61161 --- /dev/null +++ b/project/plugins.sbt.scalajs06 @@ -0,0 +1,28 @@ +// An optional sbt file to replace Scala.js 1.0 with 0.6 +dependencyOverrides += Defaults.sbtPluginExtra( + "org.scala-js" % "sbt-scalajs" % "0.6.32", + sbtBinaryVersion.value, + scalaBinaryVersion.value, +) + +dependencyOverrides += Defaults.sbtPluginExtra( + "ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0-0.6", + sbtBinaryVersion.value, + scalaBinaryVersion.value, +) + +Compile / sourceGenerators += Def.task { + val file = (Compile / sourceManaged).value / "SkipPublishForNonScalaJSProjects.scala" + IO.write(file, """ + import scalajscrossproject.ScalaJSCrossPlugin.autoImport._ + import sbtcrossproject.CrossPlugin.autoImport._ + import sbt._, Keys._ + object SkipPublishForNonScalaJSProjects extends AutoPlugin { + override def trigger = allRequirements + override def projectSettings = Seq( + publish / skip := crossProjectPlatform.value != JSPlatform + ) + } + """) + Seq(file) +}.taskValue