sbt-dynscalajs-test-bridge


License

License

Categories

Categories

JavaScript Languages Scala
GroupId

GroupId

be.doeraene
ArtifactId

ArtifactId

sbt-dynscalajs-test-bridge_sjs0.6_2.13
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

sbt-dynscalajs-test-bridge
sbt-dynscalajs-test-bridge
Project URL

Project URL

https://github.com/sjrd/sbt-dynscalajs
Project Organization

Project Organization

be.doeraene
Source Code Management

Source Code Management

https://github.com/sjrd/sbt-dynscalajs

Download sbt-dynscalajs-test-bridge_sjs0.6_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/be.doeraene/sbt-dynscalajs-test-bridge_sjs0.6_2.13/ -->
<dependency>
    <groupId>be.doeraene</groupId>
    <artifactId>sbt-dynscalajs-test-bridge_sjs0.6_2.13</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/be.doeraene/sbt-dynscalajs-test-bridge_sjs0.6_2.13/
implementation 'be.doeraene:sbt-dynscalajs-test-bridge_sjs0.6_2.13:1.0.0'
// https://jarcasting.com/artifacts/be.doeraene/sbt-dynscalajs-test-bridge_sjs0.6_2.13/
implementation ("be.doeraene:sbt-dynscalajs-test-bridge_sjs0.6_2.13:1.0.0")
'be.doeraene:sbt-dynscalajs-test-bridge_sjs0.6_2.13:jar:1.0.0'
<dependency org="be.doeraene" name="sbt-dynscalajs-test-bridge_sjs0.6_2.13" rev="1.0.0">
  <artifact name="sbt-dynscalajs-test-bridge_sjs0.6_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='be.doeraene', module='sbt-dynscalajs-test-bridge_sjs0.6_2.13', version='1.0.0')
)
libraryDependencies += "be.doeraene" % "sbt-dynscalajs-test-bridge_sjs0.6_2.13" % "1.0.0"
[be.doeraene/sbt-dynscalajs-test-bridge_sjs0.6_2.13 "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.1
org.scala-js : scalajs-library_2.13 jar 0.6.28
org.scala-js : scalajs-test-interface_2.13 jar 0.6.28

Project Modules

There are no modules declared in this project.

sbt-dynscalajs

Build Status

Dynamically switch between the JVM and JS targets in an sbt build, as well as between different versions of Scala.js.

Do not use this project if

You want something supported

sbt-dynscalajs was written as a proof of concept. The author does not intend to improve it nor to fix bugs. Therefore, you should expect to fix things yourself.

The author only intends to update it to make it work with newer versions of Scala.js, should they break the proof of concept.

You develop Scala.js-specific things

sbt-dynscalajs only has the most basic features necessary to build, run and test with Scala.js a project mainly intended for the JVM. It does not have features targeted at Scala.js users. Things that are absent include, but are not limited to:

  • Support for a shared cross-compiling project used by a JVM server and a JS server
  • crossProject (the plugin replaces that mechanism)
  • jsDependencies, testHtml, scalajsp
  • Support for downstream sbt plugins extending Scala.js (e.g., scalajs-bundler, sbt-jsdependencies, sbt-web-scalajs)

Do use this project if

All of the following apply:

  • You are prepared to fix bugs and improve the plugin yourself
  • You maintain a Scala library and are mostly interested in its JVM flavour
  • You want to build, test and publish the Scala.js version of your library
  • You do not like crossProject, and/or you do not like environment variables to switch between Scala.js 0.6.x and 1.x

Setup

Add the following dependency in your project/plugins.sbt file.

addSbtPlugin("be.doeraene" % "sbt-dynscalajs" % "1.0.0")

You will also need to enable the DynScalaJSPlugin auto-plugin on projects you want to cross-compile, e.g.

lazy val foo = project.
  enablePlugins(DynScalaJSPlugin).
  ...

In the future, DynScalaJSPlugin may become auto-triggered so that this is not necessary, but we stay safe for now.

Finally:

  • Make sure your project uses sbt 1.x, minimum 1.2.1.
  • Dependencies on other Scala/Scala.js libraries should use %%% instead of %%, as if you were using sbt-crossproject.
  • If your project has a main method that you want to run, make sure to put scalaJSUseMainModuleInitializer := true in that project's settings.

If you were using sbt-scalajs

You must remove sbt-scalajs from your project. sbt-dynscalajs is not compatible with sbt-scalajs, as it completely redefines its API. Having both on the classpath of your build will break everything.

All crossProjects should be replaced by simple projects enabling the DynScalaJSPlugin auto-plugin.

Usage

Once everything is setup, you can start sbt. By default, all your projects are configured for the JVM, as if you had done nothing. All tasks will behave as usual for a JVM project.

To switch to Scala.js, enter:

> set dynScalaJSVersion := Some("1.0.0")

or another supported version of Scala.js.

Magic! All the projects with enablePlugins(DynScalaJSPlugin) have been turned into Scala.js projects, using the specified version of Scala.js. You can now use the most common Scala.js tasks, such as fastOptJS and fullOptJS and scalaJSStage. Moreover, run and test (and testOnly/testQuick) behave as on a Scala.js project.

Supported versions of Scala.js

The current version of sbt-dynscalajs has been tested with:

  • Scala.js 0.6.28
  • Scala.js 0.6.32
  • Scala.js 1.0.0

Later versions in the 0.6.x and 1.x cycles are expected to be compatible as well.

Versions

Version
1.0.0
0.4.0
0.3.0