Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish via coursier? #38

Open
gzm0 opened this issue Nov 2, 2021 · 2 comments
Open

Publish via coursier? #38

gzm0 opened this issue Nov 2, 2021 · 2 comments

Comments

@gzm0
Copy link
Contributor

gzm0 commented Nov 2, 2021

Follow-up from #35 (comment)

@sjrd
Copy link
Member

sjrd commented Nov 9, 2021

I have at least a sort of proof of concept that coursier could entirely replace our assembly scripts. From an empty directory, the following sequence of commands can produce and run a test.js from a foo.scala, compiled with 2.12.15 and linked with the linker v1.7.1 and the cli v1.0.0 published under _2.13:

$ mkdir bin
$ cat > foo.scala <<'EOF'
object Foo {
  def main(args: Array[String]): Unit = {
    println(s"asdf ${1 + 1}")
    new A
  }

  class A
}
EOF
$ cs launch --scala 2.12.15 scalac:2.12.15 -- -classpath "$(cs fetch --scala 2.12.15 --intransitive org.scala-js::scalajs-library:1.7.1)" "-Xplugin:$(cs fetch --scala 2.12.15 --intransitive org.scala-js:scalajs-compiler_2.12.15:1.7.1)" -d bin foo.scala
$ cs launch org.scala-js:scalajs-cli_2.13:1.0.0 org.scala-js:scalajs-linker_2.13:1.7.1 -M org.scalajs.cli.Scalajsp -- bin/Foo\$.sjsir
module class Foo$ extends java.lang.Object {
  def main;[Ljava.lang.String;V(args: java.lang.String[]) {
    mod:scala.Predef$.println;Ljava.lang.Object;V(("asdf " +[string] 2));
    new Foo$A().<init>;V()
  }
  constructor def <init>;V() {
    this.java.lang.Object::<init>;V();
    mod:Foo$<-this
  }
}
$ cs launch org.scala-js:scalajs-cli_2.13:1.0.0 org.scala-js:scalajs-linker_2.13:1.7.1 -M org.scalajs.cli.Scalajsp -- bin/Foo\$A.sjsir
class Foo$A extends java.lang.Object {
  constructor def <init>;V() {
    this.java.lang.Object::<init>;V()
  }
}
$ cs launch --scala 2.13.6 org.scala-js::scalajs-cli:1.0.0 org.scala-js::scalajs-linker:1.7.1 -M org.scalajs.cli.Scalajsld -- -s -o test.js -mm Foo.main "$(cs fetch --scala 2.12.15 --intransitive org.scala-js::scalajs-library:1.7.1)" bin
$ node test.js 
asdf 2

@gzm0
Copy link
Contributor Author

gzm0 commented Mar 31, 2024

FWIW: This seems to be the chain of forks of this repo that eventually leads into Scala CLI.

https://github.com/scala-cli/scala-js-cli
https://github.com/VirtusLab/scala-js-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants