How do you Cross Compile to Scala.JS with Gradle

二次信任 提交于 2020-01-04 11:04:42

问题


When adding Scala.JS dependencies in SBT you use %%%. E.g.

libraryDependencies += "be.doeraene" %%% "scalajs-jquery" % "0.9.0"

How is this done in the Gradle Scala plugin?


回答1:


%%% = the scala version + scalajs version. So something like:

val scalaJsDomV = "0.9.1"
libraryDependencies ++= Seq(
   "org.scala-js" %%% "scalajs-dom" % scalaJsDomV
)

would be

compile "org.scala-js:scalajs-dom_sjs0.6_2.12:0.9.1"

Or if you used the ext for multiple used versions it would be something like:

ext {
    versions = [
        js: 'sjs0.6', 
        major: '2.12', // major scala version
    ]
    versions['scala'] = versions.major + '.2'
}
dependencies {
    ...
    compile "org.scala-js:scalajs-dom_${versions.js}_${versions.major}:0.9.1"
}

Note that there is also a plugin that can help with scalajs: https://github.com/gtache/scalajs-gradle



来源:https://stackoverflow.com/questions/39594587/how-do-you-cross-compile-to-scala-js-with-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!