@@ -25,6 +25,13 @@ inThisBuild(
2525 homepage := Some (url(" https://github.com/sourcegraph/scip-java" )),
2626 dynverSeparator := " -" ,
2727 PB .protocVersion := V .protobuf,
28+ autoScalaLibrary := false ,
29+ crossPaths := false ,
30+ // Pin bytecode to major 55 so sbt-assembly's older ASM can shade it.
31+ Compile / javacOptions ++= Seq (" --release" , " 11" ),
32+ incOptions ~= { old =>
33+ old.withEnabled(false ).withApiDebug(true )
34+ },
2835 licenses :=
2936 List (" Apache-2.0" -> url(" http://www.apache.org/licenses/LICENSE-2.0" )),
3037 developers :=
@@ -55,7 +62,6 @@ lazy val scipShared = project
5562 .in(file(" scip-shared" ))
5663 .settings(
5764 moduleName := " scip-shared" ,
58- javaOnlySettings,
5965 libraryDependencies +=
6066 " org.scip-code" % " scip-java-bindings" % V .scipBindings
6167 )
@@ -64,7 +70,6 @@ lazy val gradlePlugin = project
6470 .in(file(" scip-gradle-plugin" ))
6571 .settings(
6672 name := " scip-gradle" ,
67- javaOnlySettings,
6873 publish / skip := true ,
6974 libraryDependencies ++=
7075 List (
@@ -76,7 +81,6 @@ lazy val gradlePlugin = project
7681lazy val javacPlugin = project
7782 .in(file(" scip-javac" ))
7883 .settings(
79- javaOnlySettings,
8084 moduleName := " scip-javac" ,
8185 // Scoped to compile so doc tasks (which reject -g) are unaffected.
8286 Compile / compile / javacOptions += " -g" ,
@@ -138,9 +142,7 @@ lazy val javacPlugin = project
138142lazy val scip = project
139143 .in(file(" scip-aggregator" ))
140144 .settings(
141- publishMavenStyle := true ,
142145 moduleName := " scip-aggregator" ,
143- javaOnlySettings,
144146 libraryDependencies ++=
145147 Seq (
146148 " org.scip-code" % " scip-java-bindings" % V .scipBindings,
@@ -159,7 +161,6 @@ lazy val mavenPlugin = project
159161 .in(file(" scip-maven-plugin" ))
160162 .settings(
161163 moduleName := " scip-maven-plugin" ,
162- javaOnlySettings,
163164 libraryDependencies ++=
164165 Seq (
165166 " org.apache.maven" % " maven-plugin-api" % " 3.6.3" ,
@@ -189,11 +190,8 @@ lazy val cli = project
189190 .enablePlugins(KotlinPlugin , PackPlugin )
190191 .settings(
191192 moduleName := " scip-java" ,
192- crossPaths := false ,
193- autoScalaLibrary := false ,
194193 kotlinVersion := V .kotlinVersion,
195194 kotlincJvmTarget := " 11" ,
196- Compile / javacOptions ++= Seq (" --release" , " 11" ),
197195 (Compile / mainClass) := Some (" com.sourcegraph.scip_java.ScipJava" ),
198196 (run / baseDirectory) := (ThisBuild / baseDirectory).value,
199197 // ScipJava.main can call System.exit, so we always fork the JVM when
@@ -235,11 +233,10 @@ lazy val cli = project
235233 preserveExecutable = true
236234 )
237235 val propsFile = out.resolve(" scip-java.properties" ).toFile
238- val copiedJars = outs.map { case (_, out) => out }
239236 // Build version consumed at runtime by BuildInfo.version (Kotlin).
240237 IO .write(propsFile, s " version= ${version.value}\n " )
241238
242- propsFile +: copiedJars
239+ propsFile +: outs.map(_._2)
243240 }
244241 .taskValue
245242 )
@@ -264,10 +261,6 @@ lazy val scipKotlinc = project
264261 name := " scip-kotlinc" ,
265262 moduleName := " scip-kotlinc" ,
266263 description := " A kotlinc plugin to emit SCIP information" ,
267- crossPaths := false ,
268- autoScalaLibrary := false ,
269- // Pin bytecode to major 55 so sbt-assembly's older ASM can shade it.
270- Compile / javacOptions ++= Seq (" --release" , " 11" ),
271264 kotlinVersion := V .kotlinVersion,
272265 kotlincJvmTarget := " 1.8" ,
273266 kotlincOptions ++= Seq (" -Xinline-classes" , " -Xcontext-parameters" ),
@@ -353,8 +346,6 @@ lazy val scipKotlincMinimized = project
353346 .enablePlugins(KotlinPlugin )
354347 .settings(
355348 publish / skip := true ,
356- crossPaths := false ,
357- autoScalaLibrary := false ,
358349 kotlinVersion := V .kotlinVersion,
359350 kotlincJvmTarget := " 1.8" ,
360351 kotlinLib(" stdlib" ),
@@ -441,34 +432,28 @@ lazy val scipKotlincMinimized = project
441432 .value
442433 )
443434
444- def minimizedSourceDirectory =
445- file(" tests/minimized/src/main/java" ).getAbsoluteFile
446-
447- lazy val minimizedSettings = List [Def .Setting [_]](
448- autoScalaLibrary := false ,
449- (publish / skip) := true ,
450- (publishLocal / skip) := true ,
451- (run / fork) := true ,
452- (Compile / unmanagedSourceDirectories) += minimizedSourceDirectory,
453- libraryDependencies ++= List (" org.projectlombok" % " lombok" % " 1.18.22" ),
454- // Fork javac so it receives real file paths instead of sbt's `vf://` virtual-file URIs
455- // (see the comment on `scipKotlincMinimized` for the long story).
456- javaHome := Some (file(System .getProperty(" java.home" ))),
457- Compile / javacOptions ++= javacModuleOptions,
458- javacOptions +=
459- List (
460- s " -Xplugin:scip " ,
461- s " -text:on " ,
462- s " -verbose " ,
463- s " -sourceroot: ${(ThisBuild / baseDirectory).value}" ,
464- s " -targetroot: ${(Compile / semanticdbTargetRoot).value}" ,
465- s " -randomtimestamp= ${System .nanoTime()}"
466- ).mkString(" " )
467- )
468-
469435lazy val minimized = project
470436 .in(file(" tests/minimized/.j11" ))
471- .settings(minimizedSettings, javaOnlySettings)
437+ .settings(
438+ publish / skip := true ,
439+ run / fork := true ,
440+ (Compile / unmanagedSourceDirectories) +=
441+ file(" tests/minimized/src/main/java" ).getAbsoluteFile,
442+ libraryDependencies += " org.projectlombok" % " lombok" % " 1.18.22" ,
443+ // Fork javac so it receives real file paths instead of sbt's `vf://` virtual-file URIs
444+ // (see the comment on `scipKotlincMinimized` for the long story).
445+ javaHome := Some (file(System .getProperty(" java.home" ))),
446+ Compile / javacOptions ++= javacModuleOptions,
447+ javacOptions +=
448+ List (
449+ s " -Xplugin:scip " ,
450+ s " -text:on " ,
451+ s " -verbose " ,
452+ s " -sourceroot: ${(ThisBuild / baseDirectory).value}" ,
453+ s " -targetroot: ${(Compile / semanticdbTargetRoot).value}" ,
454+ s " -randomtimestamp= ${System .nanoTime()}"
455+ ).mkString(" " )
456+ )
472457 .dependsOn(javacPlugin)
473458
474459def javacModuleOptions = List (
@@ -483,8 +468,6 @@ lazy val buildTools = project
483468 .in(file(" tests/buildTools" ))
484469 .enablePlugins(KotlinPlugin )
485470 .settings(
486- crossPaths := false ,
487- autoScalaLibrary := false ,
488471 publish / skip := true ,
489472 kotlinVersion := V .kotlinVersion,
490473 kotlincJvmTarget := " 11" ,
@@ -510,40 +493,23 @@ lazy val buildTools = project
510493lazy val snapshots = project
511494 .in(file(" tests/snapshots" ))
512495 .settings(
513- javaOnlySettings,
514- javaTestSettings,
496+ publish / skip := true ,
497+ Test / fork := true ,
498+ // Open the JDK-internal javac packages to the in-process javac the tests
499+ // drive; on JDK 17+ this is required or the reflective access fails.
500+ Test / javaOptions ++= javacModuleOptions.map(_.stripPrefix(" -J" )),
501+ // Pin the JDK version embedded in stdlib SCIP symbols (e.g. `jdk 11
502+ // java/lang/String#`) so snapshots are stable across JDK 11/17/21.
503+ Test / javaOptions += " -Dscip.jdk.version=11" ,
504+ libraryDependencies += " com.github.sbt.junit" % " jupiter-interface" %
505+ JupiterKeys .jupiterVersion.value % Test ,
515506 Compile / mainClass := Some (" tests.SaveSnapshots" ),
516507 Compile / run / fork := true ,
517508 Test / javaOptions ++= snapshotPathOptions.value,
518509 Compile / run / javaOptions ++= snapshotPathOptions.value
519510 )
520511 .dependsOn(cli)
521512
522- lazy val javaOnlySettings = List [Def .Setting [_]](
523- autoScalaLibrary := false ,
524- incOptions ~= { old =>
525- old.withEnabled(false ).withApiDebug(true )
526- },
527- crossPaths := false ,
528- // Pin bytecode to major 55 so sbt-assembly's older ASM can shade it.
529- Compile / javacOptions ++= Seq (" --release" , " 11" )
530- )
531-
532- lazy val javaTestSettings = List [Def .Setting [_]](
533- (publish / skip) := true ,
534- autoScalaLibrary := false ,
535- crossPaths := false ,
536- Test / fork := true ,
537- // Open the JDK-internal javac packages to the in-process javac the tests
538- // drive; on JDK 17+ this is required or the reflective access fails.
539- Test / javaOptions ++= javacModuleOptions.map(_.stripPrefix(" -J" )),
540- // Pin the JDK version embedded in stdlib SCIP symbols (e.g. `jdk 11
541- // java/lang/String#`) so snapshots are stable across JDK 11/17/21.
542- Test / javaOptions += " -Dscip.jdk.version=11" ,
543- libraryDependencies += " com.github.sbt.junit" % " jupiter-interface" %
544- JupiterKeys .jupiterVersion.value % Test
545- )
546-
547513// Runtime paths for the snapshot generator, passed as -D system properties.
548514// Depending on `minimized/compile` here guarantees a fresh targetroot whenever
549515// `snapshots/test` or `snapshots/run` evaluate javaOptions.
0 commit comments