@@ -12,6 +12,7 @@ import $file.project.settings, settings.{
1212 PublishLocalNoFluff ,
1313 ScalaCliCrossSbtModule ,
1414 ScalaCliScalafixModule ,
15+ ScalaCliCompile ,
1516 localRepoResourcePath ,
1617 platformExecutableJarExtension ,
1718 workspaceDirName
@@ -418,22 +419,14 @@ class Options(val crossScalaVersion: String) extends BuildLikeModule {
418419 }
419420}
420421
421- trait ScalaParse extends SbtModule with ScalaCliPublishModule with settings. ScalaCliCompile {
422+ trait ScalaParse extends SbtModule with ScalaCliPublishModule with ScalaCliCompile {
422423 def ivyDeps = super .ivyDeps() ++ Agg (Deps .scalaparse)
423424 def scalaVersion = Scala .defaultInternal
424425}
425426
426- trait Scala3Runtime extends SbtModule with ScalaCliPublishModule with settings. ScalaCliCompile {
427- def ivyDeps = super .ivyDeps() ++ Agg ( Deps .scalaparse)
427+ trait Scala3Runtime extends SbtModule with ScalaCliPublishModule with ScalaCliCompile {
428+ def ivyDeps = super .ivyDeps()
428429 def scalaVersion = Scala .scala3
429- def jar = T {
430- val original = super .jar().path
431- // scala3RuntimeFixes.jar is also used within
432- // resource-config.json and BytecodeProcessor.scala
433- val dest = original / os.up / " scala3RuntimeFixes.jar"
434- os.copy(original, dest)
435- PathRef (dest)
436- }
437430}
438431
439432class Scala3Graal (val crossScalaVersion : String ) extends BuildLikeModule {
@@ -443,15 +436,21 @@ class Scala3Graal(val crossScalaVersion: String) extends BuildLikeModule {
443436 )
444437
445438 def resources = T .sources {
446- super .resources() ++ Seq (`scala3-runtime`.jar())
439+ val extraResourceDir = T .dest / " extra"
440+ // scala3RuntimeFixes.jar is also used within
441+ // resource-config.json and BytecodeProcessor.scala
442+ os.copy.over(
443+ `scala3-runtime`.jar().path,
444+ extraResourceDir / " scala3RuntimeFixes.jar" ,
445+ createFolders = true
446+ )
447+ super .resources() ++ Seq (mill.PathRef (extraResourceDir))
447448 }
448449}
449450
450451trait Scala3GraalProcessor extends ScalaModule {
451- def moduleDeps = Seq (`scala3-graal`(Scala .scala3))
452- def scalaVersion = Scala .scala3
453- // Make sure that we put jar on run classpath
454- def runClasspath = T (`scala3-graal`(Scala .scala3).jar() +: super .runClasspath())
452+ def moduleDeps = Seq (`scala3-graal`(Scala .scala3))
453+ def scalaVersion = Scala .scala3
455454 def finalMainClass = " scala.cli.graal.CoursierCacheProcessor"
456455}
457456
@@ -519,7 +518,7 @@ class Build(val crossScalaVersion: String) extends BuildLikeModule {
519518 }
520519}
521520
522- trait CliOptions extends SbtModule with ScalaCliPublishModule with settings. ScalaCliCompile {
521+ trait CliOptions extends SbtModule with ScalaCliPublishModule with ScalaCliCompile {
523522 def ivyDeps = super .ivyDeps() ++ Agg (
524523 Deps .caseApp,
525524 Deps .jsoniterCore,
@@ -553,9 +552,6 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
553552 `scala3-graal`(myScalaVersion)
554553 )
555554
556- // We are adding graal as compile deps and adding jat on classpath since we want to build a native image from jar not from directories
557- def runClasspath = T (Seq (`scala3-graal`(myScalaVersion).jar()) ++ super .runClasspath())
558-
559555 def repositories = super .repositories ++ customRepositories
560556
561557 def ivyDeps = super .ivyDeps() ++ Agg (
@@ -587,8 +583,6 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
587583trait Cli3 extends Cli {
588584 override def myScalaVersion = Scala .scala3
589585
590- val argsFile = os.pwd / os.RelPath (" out" ) / " .graal-cp-args"
591-
592586 override def nativeImageClassPath = T {
593587 // TODO - results are cached - need to add inputs or caching method
594588 val classpath = super .nativeImageClassPath().map(_.path).mkString(File .pathSeparator)
0 commit comments