Skip to content

Commit

Permalink
Merge pull request #363 from ThoughtWorksInc/scala-js-1.0
Browse files Browse the repository at this point in the history
Cross build for Scala.js 1.x and 0.6
  • Loading branch information
Atry authored Apr 26, 2020
2 parents af0bd80 + 41c5119 commit 0d46ba0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
22 changes: 22 additions & 0 deletions project/plugins.sbt.scalajs06
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0d46ba0

Please sign in to comment.