Skip to content

Commit 63e8c04

Browse files
authored
Automatically add $ to main class (#4)
1 parent 9bca24e commit 63e8c04

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

cli/src/main/scala/scala/scalanative/cli/utils/ConfigConverter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ object ConfigConverter {
8585
.withWorkdir(Paths.get(options.config.workdir).toAbsolutePath())
8686
.withCompilerConfig(nativeConfig)
8787
.withClassPath(classPath)
88-
.withMainClass(main)
88+
.withMainClass(main + "$")
8989

9090
val verbosity = Tag.unwrap(options.logger.verbose)
9191
val logger = new FilteredLogger(verbosity)

cli/src/sbt-test/integration/cli/test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44
> runCli --version
55

66
# -- Link and check if outpath exists
7-
> runCli --outpath target/out1.exe -v -v --main Main$
7+
> runCli --outpath target/out1.exe -v -v --main Main
88
$ exists target/out1.exe
99
> runExec ./target/out1.exe
1010

1111
# -- Fail to link without main specified
1212
-> runCli --outpath target/out2 -v -v
1313

1414
# -- Fail to link with an incorrect option
15-
-> runCli --outpath target/out3 -v -v --gc fast --main Main$
15+
-> runCli --outpath target/out3 -v -v --gc fast --main Main
1616

1717
# -- Link even with an unspecified option
18-
> runCli --outpath target/out4 -v -v --unspecified --main Main$
18+
> runCli --outpath target/out4 -v -v --unspecified --main Main
1919

2020
# -- Do not write nir files if not specified
21-
> runCli --outpath target/out5 -v -v --main Main$
21+
> runCli --outpath target/out5 -v -v --main Main
2222
-$ exists optimized.hnir
2323
$ exists target/out5
2424

2525
# -- Write nir files to workdir if specified
2626
$ mkdir native-dir
27-
> runCli --outpath target/out6 -v -v --workdir native-dir --dump --main Main$
27+
> runCli --outpath target/out6 -v -v --workdir native-dir --dump --main Main
2828
$ exists native-dir/optimized.hnir
2929
$ exists target/out6
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
> runScript scala-native-c Main.scala
22
$ exists Main$.nir
33

4-
> runScript scala-native-ld --main Main$ . -o scala-native-out.exe -v -v
4+
> runScript scala-native-ld --main Main . -o scala-native-out.exe -v -v
55
$ exists scala-native-out.exe
66
> runExec ./scala-native-out.exe

cli/src/test/scala/scala/scalanative/cli/utils/ConfigConverterTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import scala.scalanative.cli.options.MiscOptions
1616
class ConfigConverterTest extends AnyFlatSpec {
1717
val dummyLoggerOptions = LoggerOptions()
1818
val dummyNativeConfigOptions = NativeConfigOptions()
19-
val dummyConfigOptions = ConfigOptions(main = Some("Main$"))
19+
val dummyConfigOptions = ConfigOptions(main = Some("Main"))
2020
val dummyMiscOptions = MiscOptions()
2121

2222
val dummyArguments =
2323
Seq("A.jar", "B.jar")
24-
val dummyMain = "Main$"
24+
val dummyMain = "Main"
2525

2626
val dummyCliOptions = CliOptions(
2727
config = dummyConfigOptions,

0 commit comments

Comments
 (0)