Skip to content

Commit 01381a1

Browse files
Pass scalajs-javalib around when needed
1 parent 9532482 commit 01381a1

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Diff for: cli/src/org/scalajs/cli/Scalajsld.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object Scalajsld {
4747
sourceMap: Boolean = false,
4848
relativizeSourceMap: Option[URI] = None,
4949
checkIR: Boolean = false,
50-
stdLib: Option[File] = None,
50+
stdLib: Seq[File] = Nil,
5151
jsHeader: String = "",
5252
logLevel: Level = Level.Info
5353
)
@@ -164,12 +164,12 @@ object Scalajsld {
164164
.action { (x, c) => c.copy(relativizeSourceMap = Some(x.toURI)) }
165165
.text("Relativize source map with respect to given path (meaningful with -s)")
166166
opt[Unit]("noStdlib")
167-
.action { (_, c) => c.copy(stdLib = None) }
167+
.action { (_, c) => c.copy(stdLib = Nil) }
168168
.text("Don't automatically include Scala.js standard library")
169-
opt[File]("stdlib")
169+
opt[String]("stdlib")
170170
.valueName("<scala.js stdlib jar>")
171171
.hidden()
172-
.action { (x, c) => c.copy(stdLib = Some(x)) }
172+
.action { (x, c) => c.copy(stdLib = x.split(File.pathSeparator).map(new File(_)).toSeq) }
173173
.text("Location of Scala.js standard libarary. This is set by the " +
174174
"runner script and automatically prepended to the classpath. " +
175175
"Use -n to not include it.")
@@ -208,7 +208,7 @@ object Scalajsld {
208208
}
209209

210210
for (options <- parser.parse(args, Options())) {
211-
val classpath = (options.stdLib.toList ++ options.cp).map(_.toPath())
211+
val classpath = (options.stdLib ++ options.cp).map(_.toPath())
212212
val moduleInitializers = options.moduleInitializers
213213

214214
val semantics =

Diff for: tests/test/src/org/scalajs/cli/tests/Tests.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,24 @@ class Tests extends munit.FunSuite {
2626
|""".stripMargin
2727
)
2828

29+
val scalaJsLibraryCp = os.proc("cs", "fetch", "--classpath", "-E", "org.scala-lang:scala-library", s"org.scala-js::scalajs-library:$scalaJsVersion").call(cwd = dir).out.trim()
30+
2931
os.makeDir.all(dir / "bin")
3032
os.proc(
3133
"cs",
3234
"launch",
3335
"scalac:2.13.6",
3436
"--",
3537
"-classpath",
36-
os.proc("cs", "fetch", "--intransitive", s"org.scala-js::scalajs-library:$scalaJsVersion").call(cwd = dir).out.trim(),
38+
scalaJsLibraryCp,
3739
s"-Xplugin:${os.proc("cs", "fetch", "--intransitive", s"org.scala-js:scalajs-compiler_2.13.6:$scalaJsVersion").call(cwd = dir).out.trim()}",
3840
"-d", "bin", "foo.scala"
3941
).call(cwd = dir, stdin = os.Inherit, stdout = os.Inherit)
4042

4143
val res = os.proc(
4244
launcher,
4345
"--stdlib",
44-
os.proc("cs", "fetch", "--intransitive", s"org.scala-js::scalajs-library:$scalaJsVersion").call(cwd = dir).out.trim(),
46+
scalaJsLibraryCp,
4547
"-s", "-o", "test.js", "-mm", "Foo.main", "bin"
4648
).call(cwd = dir, stderr = os.Pipe)
4749
val expectedInOutput = "Warning: using a single file as output (--output) is deprecated since Scala.js 1.3.0. Use --outputDir instead."
@@ -60,7 +62,7 @@ class Tests extends munit.FunSuite {
6062
os.proc(
6163
launcher,
6264
"--stdlib",
63-
os.proc("cs", "fetch", "--intransitive", s"org.scala-js::scalajs-library:$scalaJsVersion").call(cwd = dir).out.trim(),
65+
scalaJsLibraryCp,
6466
"-s",
6567
"--outputDir",
6668
"test-output",

0 commit comments

Comments
 (0)