Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/test-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ test -s out || fail "scalajsp bin/Foo$.sjsir: empty output"
scalajsp bin/Foo\$A.sjsir > out
test -s out || fail "scalajsp bin/Foo\$A.sjsir: empty output"

scalajsld -o test.js -mm Foo.main bin
scalajsld -s -o test.js -mm Foo.main bin
test -s test.js || fail "scalajsld: empty output"
test -s test.js.map || fail "scalajsld: empty source map"

node test.js > got.run
cat > want.run <<EOF
Expand Down
16 changes: 14 additions & 2 deletions src/main/scala/org/scalajs/cli/Scalajsld.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import scala.concurrent.ExecutionContext.Implicits.global

import java.io.File
import java.net.URI
import java.nio.file.Path

object Scalajsld {

Expand Down Expand Up @@ -169,8 +170,19 @@ object Scalajsld {

val linker = StandardImpl.linker(config)
val logger = new ScalaConsoleLogger(options.logLevel)
val outFile = PathOutputFile(options.output.toPath())
val output = LinkerOutput(outFile)

val output = {
val js = options.output.toPath()
val sm = js.resolveSibling(js.getFileName().toString() + ".map")

def relURI(f: Path) =
new URI(null, null, f.getFileName().toString, null)

LinkerOutput(PathOutputFile(js))
.withSourceMap(PathOutputFile(sm))
.withSourceMapURI(relURI(sm))
.withJSFileURI(relURI(js))
}

val cache = StandardImpl.irFileCache().newCache

Expand Down