Comments (18)
@ngbinh @johnynek I managed to create the .sjsir files in https://gist.github.com/muller/728f3d4c45ec593f1fde4fce19d686ea.
I am working now on execute the linking part with a genrule, what should give me the JavaScript file.
from rules_scala.
I too have had luck getting rules_scala to build me .sjsir files, with the following in my WORKSPACE
scala_maven_import_external(
name = "org_scala_js_scalajs_compiler",
artifact = "org.scala-js:scalajs-compiler_2.12.8:0.6.28",
licenses = ["notice"],
server_urls = [
"https://repo.maven.apache.org/maven2/",
],
)
bind(
name = 'jar/org/scala_js/scalajs_compiler_2_12_8_0_6_28',
actual = '@org_scala_js_scalajs_compiler//jar'
)
and in my BUILD
's scala-library
plugins = ["@org_scala_js_scalajs_compiler//jar"]
is all that's needed to make scala emit a .jar file with .sjsir files inside it. The linker program above worked perfectly, even to fullOptJS
things, by modifying the Linker's Config object.
I'd love to have support for scalajs, and AFAICT this involves adding support for scalajs by changing new_scala_default_repository
to support scalajs importing by including the fully version-qualified org.scalajs
scalajs-compiler
, scalajs-ir
, and scalajs-tools
into the included libraries if it's a JS project, and an additional target rule similar to the existing scaladoc/tut ones.
If i have time in the coming weeks, i'll format this stuff out as a PR
from rules_scala.
I was able to get things mostly working! It's still quite rough and definitely not ready for review, as there are many open questions, but if anyone is interested in taking a look / making suggestions, the rules_scala
changes are here: ConsultingMD#14 and there is an example repo that uses them with a compatible toolchain here: https://github.com/gvacaliuc/bazel-scalapb-grpcweb-example.
from rules_scala.
it would be nice to have support for scalajs. I have not looked at it.
from rules_scala.
thanks!
from rules_scala.
Nice work!
It would be great to have this be an easy option we could set up with a scala toolchain #170
from rules_scala.
I just added the linker to the gist. Now it is possible to write .scala and get .js out.
@johnynek I don't fully understand the toolchains. I will have a look on #170, see if I can port this gist to use it.
from rules_scala.
note that with #380 we can probably think about how to do this again.
We might need to look at adding scalajs support to scala_import.
from rules_scala.
from rules_scala.
scala.js uses maven jars for its compiled code. So, for scala_import, you could also say this scala library exists for jvm and js (and maybe later, native).
Then when we go to compile a library that we want scalajs for, we make sure all dependencies are scala, or transitively depend on scala_import with js. That might work.
from rules_scala.
Amazing that it is so easy! I'd love to see a PR with docs, or better a small example that we can add to the tests.
It would be interesting to think about how to not have to define two separate build targets. It could be that aspects could be useful here. If a target only defines scala dependencies, then we could possibly generate all the internal scalajs_library targets with an aspect.
from rules_scala.
from rules_scala.
I've completed a linker to turn the SJSIR/class files into js, and have added some checks to make it successfully build JS. I'm going to clean up my code and submit a PR soon - need to finish
- Tests
- Removing hacks
- Passing arguments to the linker
from rules_scala.
from rules_scala.
@ittaiz any progress around scalajs integration?
from rules_scala.
None on my side.
@DhashS are you interested in picking it up? @avitaln FYI
from rules_scala.
Hi everyone, I'm interested in playing with this, but I wanted to see if anyone had done any work before getting in too deep.
I'm mostly hoping to get scalapb and 🤞 scalapb-grpcweb working, the latter of which depends on a very new version of scala.js (1.5.0). I was able to get a simple build working (no scalapb) with @muller 's gist + an updated scala.js linker: https://gist.github.com/2201dda3b4acdeb0a9206f5073060745.
If anyone has pointers or suggestions, please drop em here!
from rules_scala.
No update but I wish you a lot of luck!
from rules_scala.
Related Issues (20)
- Upgrade CI tests to use Bazel 6 HOT 2
- rules_scala cause IJ plugin failures with Bazel@HEAD
- Support for specifying test classes and/or test cases when using junit tests HOT 4
- warning: [path] bad path element
- [Scala 2.13.12] Issue with scala.tools.nsc.reporters.Reporter when compiling
- FYI - Discussion for SIP-51: drop 2.13 library forwards binary compatibility
- rules_scala support for JDK 21 HOT 42
- Add add_opens and add_exports support HOT 1
- Scalafmt fails with Build without the bytes HOT 20
- Support Scala 3.3.1
- SemanticdbInfo.plugin_jar should be File not string HOT 2
- coverage creates the offline.jar into same directory for tests with different directories
- Bazel 7 - scala_proto_aspect rule must declare '@@bazel_tools//tools/jdk:toolchain_type' toolchain in order to use java_common HOT 1
- Can't run a bazel executable within bazel on Windows HOT 10
- javacopts order differs from java_library
- strict_deps_mode = error complains about dependencies that aren't referenced HOT 3
- use newer version of scalafmt
- How to set JVM version? rules_scala keeps insisting on using Java 11 HOT 1
- Unreadable test result
- test_scala_proto_server test is flaky on MacOS CI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_scala.