Skip to content

Commit 79a73be

Browse files
authored
Merge pull request #266 from Atry/cross-build-scala-js
Cross build for Scala.js 0.6 and 1.x
2 parents d76398c + 1c461a6 commit 79a73be

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ before_deploy:
3333

3434
deploy:
3535
- provider: script
36-
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
36+
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
3737
skip_cleanup: true
3838
on:
3939
all_branches: true
4040
condition: $GITHUB_PERSONAL_ACCESS_TOKEN
41+
42+
env:
43+
- SBT_ARGS=
44+
- SBT_ARGS=--addPluginSbtFile=project/plugins.sbt.scala-js.0.6
45+
46+
sbt_args: $SBT_ARGS

Binding/build.sbt.shared

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ description := "Reactive data-binding for Scala. This artifact is available for
22

33
libraryDependencies += "com.thoughtworks.enableIf" %% "enableif" % "1.1.7"
44

5-
libraryDependencies += "com.thoughtworks.sde" %%% "core" % "3.3.2"
5+
libraryDependencies += "com.thoughtworks.sde" %%% "core" % "3.3.4"
66

77
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.1.1" % Test
88

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
22

3-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32")
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1")
44

55
addSbtPlugin("com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.0.0")
66

project/plugins.sbt.scala-js.0.6

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// An optional sbt file to replace Scala.js 1.0 with 0.6
2+
dependencyOverrides += Defaults.sbtPluginExtra(
3+
"org.scala-js" % "sbt-scalajs" % "0.6.32",
4+
sbtBinaryVersion.value,
5+
scalaBinaryVersion.value,
6+
)
7+
8+
Compile / sourceGenerators += Def.task {
9+
val file = (Compile / sourceManaged).value / "SkipPublishForNonScalaJSProjects.scala"
10+
IO.write(file, """
11+
import scalajscrossproject.ScalaJSCrossPlugin.autoImport._
12+
import sbtcrossproject.CrossPlugin.autoImport._
13+
import sbt._, Keys._
14+
object SkipPublishForNonScalaJSProjects extends AutoPlugin {
15+
override def trigger = allRequirements
16+
override def projectSettings = Seq(
17+
publish / skip := crossProjectPlatform.value != JSPlatform
18+
)
19+
}
20+
""")
21+
Seq(file)
22+
}.taskValue

0 commit comments

Comments
 (0)