diff --git a/.travis.yml b/.travis.yml index d6fe51cfb..a23a60a43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,8 +31,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/project/plugins.sbt b/project/plugins.sbt index 5f5a157cb..d07cde43a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -12,4 +12,6 @@ addSbtPlugin("com.thoughtworks.example" % "sbt-example" % "7.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1") + +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 000000000..4a8b1fb81 --- /dev/null +++ b/project/plugins.sbt.scalajs06 @@ -0,0 +1,22 @@ +// 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, +) + +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 != Some(JSPlatform) + ) + } + """) + Seq(file) +}.taskValue