Skip to content

Conversation

@ajaychandran
Copy link
Contributor

@ajaychandran ajaychandran commented Nov 1, 2025

Follow up to #5428 that adds several enhancements and fixes to enable build functionality.

  • Set mill-jvm-version to system.
  • Added support for converting BOM modules.
  • Added mappings for depManagement, sourcesFolders, sources, resources, test forkArgs.
  • Added workaround for running Junit5 tests.
  • Added mapping for Gradle dependency version range.

Summary of code changes

  • libs/init/package.mill: Added mock tests to check build functionality post migration. Migrated modules to Scala 3.8.0-RC2; this bumps the minimum JDK requirement to version 17.
  • libs.init.buildgen.api: Added ModuleSpec.Value and ModuleSpec.Values to capture cross-version specific values and inheritance relationships for module members defined in ModuleSpec.
  • libs.init.buildgen: Added BuildGen for generating meta-build types and writing build files using ModuleSpec.
  • libs.init.buildgen.test: Updated BuildGenChecker to test implementations with a custom JAVA_HOME.
  • libs.init.gradle.exportplugin: Updated BuildModelBuilder.toPackage and added enhancements/fixes.
  • libs.init.gradle: Refactored and updated GradleBuildGenMain.
  • libs.init.gradle.test: Removed tests for Gradle version 6.0 and 7.0 and added test for version 7.2 (minimum version that runs on JDK 17).
  • libs.init.maven: Added workaround to retain BOM dependencies and fixed configuring system properties in Modeler. Refactored Plugins and fixed errorProneMvnDeps derivation. Refactored and updated MavenBuildGenMain.
  • libs.init.sbt.exportplugin: Updated ExportBuildPlugin.exportProject and added enhancements/fixes.
  • libs.init.sbt: Refactored and updated SbtBuildGenMain.

Pending items

@lihaoyi
Copy link
Member

lihaoyi commented Nov 1, 2025

@ajaychandran if the heuristics to guess the java version from the compiler flags don't work well in practice, maybe we should just go with mill-java-version: system then. Trying to look at the user JAVA_HOME and expecting the user to set it to the right place is probably too error prone for new Mill users to do reliably

@ajaychandran
Copy link
Contributor Author

@ajaychandran if the heuristics to guess the java version from the compiler flags don't work well in practice, maybe we should just go with mill-java-version: system then. Trying to look at the user JAVA_HOME and expecting the user to set it to the right place is probably too error prone for new Mill users to do reliably

We auto-detect the JVM version from the system JDK in ModuleConfig.JavaHomeModule.system and set a concrete version for jvmId. The user is not required to set a version anywhere.
Only the environment needs to be set up with the correct JAVA_HOME. This should already be true on a development system.

Using mill-java-version: system will also work. The loss of build reproducibility is acceptable I suppose.

@lihaoyi
Copy link
Member

lihaoyi commented Nov 1, 2025

Got it. If we want to auto-detect the JVM version, how about just shelling out to java -version? That should give us a version to use and would be simpler than the logic you currently have in lazy val system

@ajaychandran
Copy link
Contributor Author

On second thoughts, I will make the switch to the mill-java-version: system option.
This will minimize changes to any CI workflows and is semantically more accurate.

@ajaychandran ajaychandran marked this pull request as draft November 1, 2025 16:58
@ajaychandran ajaychandran changed the title Fixed mapping for jvmId in build conversions WIP: Fix build functionality post auto-migration Nov 3, 2025
@ajaychandran
Copy link
Contributor Author

@lihaoyi The PR description has been updated with the summary of code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants