Skip to content

Commit b508e87

Browse files
committed
Make -usejavacp a private setting as -Yusejavacp (preserving old API as an alias)
1 parent ad18d9b commit b508e87

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

compiler/src/dotty/tools/dotc/config/PathResolver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class PathResolver(using c: Context) {
194194
*/
195195
object Calculated {
196196
def scalaHome: String = Defaults.scalaHome
197-
def useJavaClassPath: Boolean = settings.usejavacp.value || Defaults.useJavaClassPath
197+
def useJavaClassPath: Boolean = settings.Yusejavacp.value || Defaults.useJavaClassPath
198198
def javaBootClassPath: String = cmdLineOrElse("javabootclasspath", Defaults.javaBootClassPath)
199199
def javaExtDirs: String = cmdLineOrElse("javaextdirs", Defaults.javaExtDirs)
200200
def javaUserClassPath: String = if (useJavaClassPath) Defaults.javaUserClassPath else ""

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ private sealed trait YSettings:
403403
val YlogClasspath: Setting[Boolean] = BooleanSetting(ForkSetting, "Ylog-classpath", "Output information about what classpath is being applied.")
404404
val YdisableFlatCpCaching: Setting[Boolean] = BooleanSetting(ForkSetting, "YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.")
405405
val YnoStdlibPatches: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-stdlib-patches", "Do not patch stdlib files (temporary and only to be used for the stdlib migration)", false)
406-
407406
val Yreporter: Setting[String] = StringSetting(ForkSetting, name = "Yreporter", helpArg = "<class>", descr = "Specify a dotty.tools.dotc.reporting.Reporter", default = "dotty.tools.dotc.reporting.ConsoleReporter")
408407

409408
val Yscala2Unpickler: Setting[String] = StringSetting(ForkSetting, "Yscala2-unpickler", "", "Control where we may get Scala 2 symbols from. This is either \"always\", \"never\", or a classpath.", "always")
@@ -447,8 +446,8 @@ private sealed trait YSettings:
447446
val YprofileExternalTool: Setting[List[String]] = PhasesSetting(ForkSetting, "Yprofile-external-tool", "Enable profiling for a phase using an external tool hook. Generally only useful for a single phase.", "typer", depends = List(YprofileEnabled -> true))
448447
val YprofileRunGcBetweenPhases: Setting[List[String]] = PhasesSetting(ForkSetting, "Yprofile-run-gc", "Run a GC between phases - this allows heap size to be accurate at the expense of more time. Specify a list of phases, or *", "_", depends = List(YprofileEnabled -> true))
449448
val YprofileTrace: Setting[String] = StringSetting(ForkSetting, "Yprofile-trace", "file", s"Capture trace of compilation in JSON Chrome Trace format to the specified file. This option requires ${YprofileEnabled.name}. The output file can be visualized using https://ui.perfetto.dev/.", "", depends = List(YprofileEnabled -> true))
450-
451449
val YbestEffort: Setting[Boolean] = BooleanSetting(ForkSetting, "Ybest-effort", "Enable best-effort compilation attempting to produce betasty to the META-INF/best-effort directory, regardless of errors, as part of the pickler phase.")
450+
val Yusejavacp: Setting[Boolean] = BooleanSetting(ForkSetting, "Yusejavacp", "Utilize the java.class.path in classpath resolution.", aliases = List("--use-java-class-path", "-usejavacp", "--usejavacp"))
452451
val YwithBestEffortTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Ywith-best-effort-tasty", "Allow to compile using best-effort tasty files. If such file is used, the compiler will stop after the pickler phase.")
453452

454453
val YmagicOffsetHeader: Setting[String] = StringSetting(ForkSetting, "Ymagic-offset-header", "header", "Specify the magic header comment that marks the start of the actual code in generated wrapper scripts. Example: -Ymagic-offset-header:SOURCE_CODE_START. Then, in the source, the magic comment `///SOURCE_CODE_START:<ORIGINAL_FILE_PATH>` marks the start of user code. The comment should be suffixed by `:<ORIGINAL_FILE_PATH>` to indicate the original file.", "")

compiler/test/dotty/tools/dotc/classpath/MultiReleaseJarTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class MultiReleaseJarTest extends dotty.tools.backend.jvm.DottyBytecodeTest {
3838

3939
def apiMethods(jarPath: Path, release: String): Set[String] = {
4040
given ctx: Context = initCtx.fresh
41-
ctx.settings.usejavacp.update(true)
41+
ctx.settings.Yusejavacp.update(true)
4242
ctx.settings.classpath.update(jarPath.toAbsolutePath.toString)
4343
ctx.settings.javaOutputVersion.update(release)
4444
ctx.initialize()
@@ -76,7 +76,7 @@ class MultiReleaseJarTest extends dotty.tools.backend.jvm.DottyBytecodeTest {
7676

7777
def classExists(className: String, release: String): Boolean = {
7878
given ctx: Context = initCtx.fresh
79-
ctx.settings.usejavacp.update(true)
79+
ctx.settings.Yusejavacp.update(true)
8080
ctx.settings.javaOutputVersion.update(release)
8181
ctx.initialize()
8282
val classFile = ctx.platform.classPath.findClassFile(className)

scaladoc/test/dotty/tools/scaladoc/snippets/SnippetCompilerTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import dotty.tools.io.{AbstractFile, VirtualDirectory}
77

88
class SnippetCompilerTest {
99
val compiler = SnippetCompiler(
10-
Seq(SnippetCompilerSetting(testContext.settings.usejavacp, true))
10+
Seq(SnippetCompilerSetting(testContext.settings.Yusejavacp, true))
1111
)
1212
def wrapFn: String => WrappedSnippet = (str: String) => WrappedSnippet(
1313
str,

scaladoc/test/dotty/tools/scaladoc/testUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def testArgs(files: Seq[File] = Nil, dest: File = new File("notUsed")) = Scalado
6060

6161
def testContext =
6262
val ctx = (new ContextBase).initialCtx.fresh.setReporter(new TestReporter)
63-
ctx.setSetting(ctx.settings.usejavacp, true)
63+
ctx.setSetting(ctx.settings.Yusejavacp, true)
6464
ctx
6565

6666
def testDocContext(files: Seq[File] = Nil) = DocContext(testArgs(files), testContext)

0 commit comments

Comments
 (0)