@@ -245,8 +245,12 @@ commands +=
245245def minimizedSourceDirectory =
246246 file(" tests/minimized/src/main/java" ).getAbsoluteFile
247247
248- def semanticdbCompileOptions =
249- Def .setting {
248+ lazy val minimizedSettings = List [Def .Setting [_]](
249+ autoScalaLibrary := false ,
250+ (publish / skip) := true ,
251+ (run / fork) := true ,
252+ (Compile / unmanagedSourceDirectories) += minimizedSourceDirectory,
253+ (Compile / javacOptions) ++=
250254 List [String ](
251255 s " -Arandomtimestamp= ${System .nanoTime()}" ,
252256 List (
@@ -258,13 +262,6 @@ def semanticdbCompileOptions =
258262 s " -targetroot: ${(Compile / semanticdbTargetRoot).value}"
259263 ).mkString(" " )
260264 )
261- }
262- lazy val minimizedSettings = List [Def .Setting [_]](
263- autoScalaLibrary := false ,
264- (publish / skip) := true ,
265- (run / fork) := true ,
266- (Compile / unmanagedSourceDirectories) += minimizedSourceDirectory,
267- (Compile / javacOptions) ++= semanticdbCompileOptions.value
268265)
269266
270267lazy val minimized = project
@@ -279,65 +276,26 @@ lazy val minimized8 = project
279276 .dependsOn(agent, plugin)
280277 .disablePlugins(JavaFormatterPlugin )
281278
282- def javaModuleExports =
283- List (
284- " -J--add-exports" ,
285- " -Jjdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" ,
286- " -J--add-exports" ,
287- " -Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" ,
288- " -J--add-exports" ,
289- " -Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED" ,
290- " -J--add-exports" ,
291- " -Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" ,
292- " -J--add-exports" ,
293- " -Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
294- )
295-
296- def compileWithJava17 =
297- Def .task {
298- val args = ListBuffer .empty[String ]
299- val javaSources = (minimized8 / Compile / sources)
300- .value
301- .map(_.getAbsolutePath)
302- val javac = (Compile / javaHome)
303- .value
304- .get
305- .toPath
306- .resolve(" bin" )
307- .resolve(" javac" )
308- .toString
309- val compileClasspath = List (
310- " -classpath" ,
311- (Compile / dependencyClasspath)
312- .value
313- .map(_.data.getAbsolutePath)
314- .mkString(java.io.File .pathSeparator)
315- )
316- val outputDirectory = (Compile / classDirectory).value
317- IO .delete(outputDirectory)
318-
319- args += javac
320- args ++= javaModuleExports
321- args ++= List (" -d" , outputDirectory.getAbsolutePath)
322- args ++= semanticdbCompileOptions.value
323- args ++= compileClasspath
324- args ++= javaSources
325- val exit = scala.sys.process.Process (args.toList).!
326- if (exit != 0 ) {
327- throw new RuntimeException (" javac compilation failed" ) with NoStackTrace
328- }
329- }
330-
331279lazy val minimized17 = project
332280 .in(file(" tests/minimized/.j17" ))
333281 .settings(
334282 minimizedSettings,
335- Compile / sources := Nil ,
336283 javaToolchainJvmIndex :=
337284 Some (" https://github.com/coursier/jvm-index/blob/master/index.json" ),
338285 javaToolchainVersion := " temurin:17" ,
339- Compile / compile :=
340- (Compile / compile).dependsOn(compileWithJava17).value
286+ javacOptions ++=
287+ List (
288+ " -J--add-exports" ,
289+ " -Jjdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" ,
290+ " -J--add-exports" ,
291+ " -Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" ,
292+ " -J--add-exports" ,
293+ " -Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED" ,
294+ " -J--add-exports" ,
295+ " -Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" ,
296+ " -J--add-exports" ,
297+ " -Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
298+ )
341299 )
342300 .dependsOn(agent, plugin)
343301 .disablePlugins(JavaFormatterPlugin )
0 commit comments