Compile Kotlin code to JavaScript through the Scala.js compiler
A full technical report is available under the docs/report directory. Useful resources include the Kotlin Documentation and the Scala.js Website.
sbt "run {list_of_source_files} -d {output_sjsir_dir} -kotlin-home {kotlin_home_directory}"
To compile the Kotlin Standard Library use the -Xallow-kotlin-package
option to ignore the package kotlin
reservation.
- A gradle plugin is also available with an example project here
- A basic maven plugin is available here
All tests are stored under src/test
and can be run with sbt test
.
Before running them, create the folders src/test/resources/out
and src/test/resources/benchmark_out
.
You will need to install the same version of Kotlin which is used by SBT.
To do so, either install it from here https://kotlinlang.org/docs/tutorials/command-line.html and/or change the path to the directory by changing the KOTLIN_HOME value in BlackBoxTest.scala
The tests require the presence of the Scala.js library jar file inside src/test/resources/lib
. It should be included in this repository.
If you need to change the Scala.js version in use for the tests, be sure to change the referenced .jar
inside the BlackBoxTest.scala
file.
A test has been setup to check that the IR generated for the files constituting the Kotlin Standard Library is valid.
Because the standard library is not compilable yet, the test has been disabled by default. It can be enabled in file src/test/scala/KotlinStdLibTest
.
Benchmarks are available in src/test/scala/BenchmarkTest
. Outputs are written to the benchmark_out
directory mentioned above.