Skip to content

Encapsulate source paths more - #26795

Open
SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/SOURCEROOT
Open

Encapsulate source paths more#26795
SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/SOURCEROOT

Conversation

@SolalPirelli

Copy link
Copy Markdown
Contributor
  • Stop using absolute paths for SCoverage (Toli says all that's needed is a stable identifier for files)
  • Encapsulate sourceroot handling inside SourceFile so the setting value doesn't need to be passed around

Have you relied on LLM-based tools in this contribution?

No

How was the solution tested?

Covered by existing tests (this is a refactoring)

val javaextdirs: Setting[String] = PathSetting(RootSetting, "javaextdirs", "Override java extdirs classpath.", Defaults.javaExtDirs, aliases = List("--java-extension-directories"))
val sourcepath: Setting[String] = PathSetting(RootSetting, "sourcepath", "Specify location(s) of source files.", Defaults.scalaSourcePath, aliases = List("--source-path"))
val sourceroot: Setting[String] = PathSetting(RootSetting, "sourceroot", "Specify workspace root directory.", ".")
val sourceroot: Setting[AbstractFile] = FileContainerSetting(RootSetting, "sourceroot", allowsJar = false, "Specify workspace root directory.", new PlainDirectory(Directory(".")))

@SolalPirelli SolalPirelli Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I wanted to reuse the "setting for an AbstractFile", it had to be renamed as this isn't an output. (Better name suggestion than FileContainer for "thing that can contain files, like a directory or a JAR", welcome, though)

val isJar = path.ext.isJar
if !isJar && !path.isDirectory then
state.fail(s"'$arg' does not exist or is not a directory or .jar file", args)
state.fail(s"'$arg' does not exist or is not a " + helpArg, args)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only logic change of the settings part -- now if it's just a dir we don't say "directory or .jar file", just "directory"

@SolalPirelli SolalPirelli added the needs-squashing PR whose commits should be squashed by the author or via the "Squash and Merge" button label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-squashing PR whose commits should be squashed by the author or via the "Squash and Merge" button

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant