File tree Expand file tree Collapse file tree 8 files changed +25
-11
lines changed
cli/src/main/scala/scala/cli
integration/src/test/scala/scala/cli/integration Expand file tree Collapse file tree 8 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -433,6 +433,7 @@ trait Core extends ScalaCliCrossSbtModule
433
433
| def ammoniteVersion = " ${Deps .ammonite.dep.version}"
434
434
| def millVersion = " ${InternalDeps .Versions .mill}"
435
435
| def lefouMillwRef = " ${InternalDeps .Versions .lefouMillwRef}"
436
+ | def maxScalaNativeForMillExport = " ${Deps .Versions .maxScalaNativeForMillExport}"
436
437
|
437
438
| def scalafmtOrganization = " ${Deps .scalafmtCli.dep.module.organization.value}"
438
439
| def scalafmtName = " ${Deps .scalafmtCli.dep.module.name.value}"
Original file line number Diff line number Diff line change @@ -148,7 +148,15 @@ object Export extends ScalaCommand[ExportOptions] {
148
148
val inputs = options.shared.inputs(args.all).orExit(logger)
149
149
CurrentParams .workspaceOpt = Some (inputs.workspace)
150
150
val baseOptions =
151
- initialBuildOptions.copy(mainClass = options.mainClass.mainClass.filter(_.nonEmpty))
151
+ initialBuildOptions
152
+ .copy(
153
+ scalaNativeOptions = initialBuildOptions.scalaNativeOptions.copy(
154
+ maxDefaultNativeVersions =
155
+ if shouldExportToMill then List (Constants .maxScalaNativeForMillExport)
156
+ else Nil
157
+ ),
158
+ mainClass = options.mainClass.mainClass.filter(_.nonEmpty)
159
+ )
152
160
153
161
val (sourcesMain, optionsMain0) =
154
162
prepareBuild(
Original file line number Diff line number Diff line change @@ -70,10 +70,8 @@ final case class MillProjectDescriptor(
70
70
)
71
71
}
72
72
73
- private def scalaNativeSettings (options : ScalaNativeOptions ): MillProject = {
74
- val scalaNativeVersion = Some (options.version.getOrElse(Constants .scalaNativeVersion))
75
- MillProject (scalaNativeVersion = scalaNativeVersion)
76
- }
73
+ private def scalaNativeSettings (options : ScalaNativeOptions ): MillProject =
74
+ MillProject (scalaNativeVersion = Some (options.finalVersion))
77
75
78
76
private def dependencySettings (
79
77
mainOptions : BuildOptions ,
Original file line number Diff line number Diff line change @@ -96,9 +96,6 @@ trait ExportCommonTestDefinitions { _: ScalaCliSuite & TestScalaVersionArgs =>
96
96
test(" Scala.js" ) {
97
97
simpleTest(ExportTestProjects .jsTest(actualScalaVersion))
98
98
}
99
- test(" Scala Native" ) {
100
- simpleTest(ExportTestProjects .nativeTest(actualScalaVersion))
101
- }
102
99
test(" Ensure test framework NPE is not thrown when depending on logback" ) {
103
100
logbackBugCase()
104
101
}
Original file line number Diff line number Diff line change @@ -96,4 +96,9 @@ abstract class ExportMillTestDefinitions extends ScalaCliSuite
96
96
test(" JVM with compiler plugin" ) {
97
97
jvmTestCompilerPlugin()
98
98
}
99
+
100
+ test(" Scala Native" ) {
101
+ // FIXME this should be adjusted to Scala Native 0.5.x syntax once Mill gets support for it
102
+ simpleTest(ExportTestProjects .nativeTest(actualScalaVersion, useNative04Syntax = true ))
103
+ }
99
104
}
Original file line number Diff line number Diff line change @@ -38,4 +38,8 @@ abstract class ExportSbtTestDefinitions extends ScalaCliSuite
38
38
39
39
override val runMainArgs : Seq [String ] = Seq (" run" )
40
40
override val runTestsArgs : Seq [String ] = Seq (" test" )
41
+
42
+ test(" Scala Native" ) {
43
+ simpleTest(ExportTestProjects .nativeTest(actualScalaVersion))
44
+ }
41
45
}
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ object ExportTestProjects {
96
96
TestInputs (os.rel / " Test.scala" -> testFile)
97
97
}
98
98
99
- def nativeTest (scalaVersion : String ): TestInputs = {
99
+ def nativeTest (scalaVersion : String , useNative04Syntax : Boolean = false ): TestInputs = {
100
100
val nl = " \\ n"
101
101
val testFile =
102
102
if (scalaVersion.startsWith(" 3." ))
@@ -109,7 +109,7 @@ object ExportTestProjects {
109
109
|object Test:
110
110
| def main(args: Array[String]): Unit =
111
111
| val message = "Hello from " + "exported Scala CLI project" + " $nl"
112
- | Zone {
112
+ | Zone { ${ if (useNative04Syntax) " implicit z => " else " " }
113
113
| val io = StdioHelpers(stdio)
114
114
| io.printf(c"%s", toCString(message))
115
115
| }
@@ -124,7 +124,7 @@ object ExportTestProjects {
124
124
|object Test {
125
125
| def main(args: Array[String]): Unit = {
126
126
| val message = "Hello from " + "exported Scala CLI project" + " $nl"
127
- | Zone.acquire { implicit z =>
127
+ | Zone ${ if (useNative04Syntax) " " else " .acquire" } { implicit z =>
128
128
| val io = StdioHelpers(stdio)
129
129
| io.printf(c"%s", toCString(message))
130
130
| }
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ object Deps {
102
102
def maxScalaNativeForToolkit = scalaNative04
103
103
def maxScalaNativeForTypelevelToolkit = scalaNative04
104
104
def maxScalaNativeForScalaPy = scalaNative04
105
+ def maxScalaNativeForMillExport = scalaNative04
105
106
def scalaPackager = " 0.1.29"
106
107
def signingCli = " 0.2.3"
107
108
def signingCliJvmVersion = 17
You can’t perform that action at this time.
0 commit comments