Skip to content

Commit e5ac2c2

Browse files
WojciechMazurjchyb
authored andcommitted
Make build single module
1 parent f3f985f commit e5ac2c2

File tree

7 files changed

+41
-96
lines changed

7 files changed

+41
-96
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
enablePlugins(ScalaNativePlugin)
2+
3+
import sbt._
4+
import sbt.Keys._
5+
import complete.DefaultParsers._
6+
import scala.collection.JavaConverters._
7+
8+
val runCli = inputKey[Unit](
9+
"Runs scala-native-cli with classpath and selected other options via cli arguments"
10+
)
11+
runCli := {
12+
val args = spaceDelimited("<arg>").parsed
13+
val classpath = (Compile / fullClasspath).value.map(_.data.toString())
14+
val cliPath = System.getProperty("scala-native-cli")
15+
val proc = new ProcessBuilder()
16+
.command(
17+
List("java", "-jar", cliPath)
18+
.++(args.toList)
19+
.++(classpath.toList)
20+
.asJava
21+
)
22+
23+
// Removes fake error notification - expected errors would be
24+
// reported as such, leading to failing CI and confusing output
25+
proc.redirectErrorStream(true)
26+
proc.inheritIO()
27+
28+
proc.start().waitFor() match {
29+
case 0 => ()
30+
case exitCode =>
31+
throw new RuntimeException(
32+
s"Execution of command failed with code $exitCode"
33+
) with scala.util.control.NoStackTrace
34+
}
35+
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
77
)
88
else {
9-
addSbtPlugin(
10-
"org.scala-native" % "scala-native-cli-integration-test-runner" % pluginVersion
11-
)
9+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % pluginVersion)
1210
}
1311
}
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,20 @@
44
> runCli --version
55

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

1010
# -- Fail to link without main specified
11-
> runCli --outpath target/out2 -v -v
12-
-$ exists target/out2
11+
-> runCli --outpath target/out2 -v -v
1312

1413
# -- Fail to link with an incorrect option
15-
> runCli --outpath target/out3 -v -v --gc fast --main Main$
16-
-$ exists target/out3
14+
-> runCli --outpath target/out3 -v -v --gc fast --main Main$
1715

1816
# -- Link even with an unspecified option
19-
> runCli --outpath target/out4 -v -v --unspecified --main Main$
20-
$ exists target/out4
17+
> runCli --outpath target/out4 -v -v --unspecified Main$
2118

2219
# -- Do not write nir files if not specified
23-
> runCli --outpath target/out5 -v -v --main Main$
20+
> runCli --outpath target/out5 -v -v --main Main$
2421
-$ exists optimized.hnir
2522
$ exists target/out5
2623

scala-native-cli-integration-test-runner/src/main/scala/scala/scalanative/cli/testplugin/ScalaNativeCliTestRunnerPlugin.scala

Lines changed: 0 additions & 27 deletions
This file was deleted.

scala-native-cli-integration-test-runner/src/main/scala/scala/scalanative/cli/testplugin/TestRunnerPluginInternal.scala

Lines changed: 0 additions & 57 deletions
This file was deleted.

scala-native-cli-integration-test-runner/src/test/run/integration-test/build.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)