Skip to content

build: migration to Mill 1 - #67

Merged
nafg merged 3 commits into
nafg:masterfrom
ThijsBroersen:mill-1-migration
Sep 2, 2025
Merged

build: migration to Mill 1#67
nafg merged 3 commits into
nafg:masterfrom
ThijsBroersen:mill-1-migration

Conversation

@ThijsBroersen

Copy link
Copy Markdown
Contributor

I have a working migration to Mill 1 in this branch.

VCS version is not available (yet) for Mill 1, so I left it out.

Implementations are changed a bit because Mill 1 is more strict on hermetic behaviour.

I also change the BundleParams.inputFiles to a list, as report.publicModules is plural. It is also a bit strange to me why there was just assumed the head is the main.js and the rest is ignored.

Feel free to revert or change anything on this PR.

@nafg

nafg commented Aug 29, 2025

Copy link
Copy Markdown
Owner

linux build passed!

windows build failed because you deleted mill.bat

Re VCS version, could you just recreate the behavior by shelling out to git describe?

@nafg

nafg commented Aug 29, 2025

Copy link
Copy Markdown
Owner

Actually VcsVersion is built into Mill now

@ThijsBroersen

Copy link
Copy Markdown
Contributor Author

added mill.bat again
Not sure what you mean wrt the version. Gtg for the weekend, feel free to change anything you want and merge.

@ThijsBroersen

Copy link
Copy Markdown
Contributor Author

@nafg I restored the VcsVersion mechanism!

@nafg
nafg merged commit ef39f29 into nafg:master Sep 2, 2025
4 checks passed
This was referenced Sep 2, 2025
@nafg
nafg requested a review from Copilot September 3, 2025 04:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the millbundler project from Mill 0.12.14 to Mill 1.0.4-native, updating the build system, API usage patterns, and dependency management approach.

  • Migration from Mill 0.12.x API to Mill 1.x API with updated import patterns and task definitions
  • Change from ivyDeps to mvnDeps for dependency management following Mill 1.x conventions
  • Update from Scala 2.13.16 to Scala 3.7.2 and modernize version dependencies

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
build.mill Updates build configuration to use Mill 1.x APIs and mvnDeps instead of ivyDeps
.mill-version Updates Mill version from 0.12.14 to 1.0.4-native
mill, mill.bat Updates Mill launcher scripts to support Mill 1.x features
test_common/src/io/github/nafg/millbundler/testcommon/BaseSuite.scala Migrates test infrastructure to Mill 1.x APIs with updated imports and task definitions
BundleParams.scala Changes inputFile parameter to inputFiles list with backward compatibility
ScalaJSBundleModule.scala Updates bundle processing to handle multiple input files and Mill 1.x Task API
ScalaJSWebpackModule.scala Migrates webpack integration to Mill 1.x with updated task definitions and file handling
ScalaJSRollupModule.scala Updates rollup integration for Mill 1.x compatibility
jsdeps modules Migrates JavaScript dependency management to Mill 1.x APIs
test suites Adds required millDiscover properties for Mill 1.x module discovery

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

bundle.apply()(
BundleParams(
report.dest.path / report.publicModules.head.jsFileName,
report.publicModules.map(report.dest.path / _.jsFileName).toSeq,

Copilot AI Sep 3, 2025

Copy link

Choose a reason for hiding this comment

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

The .toSeq call is redundant since map on a collection already returns a sequence. This can be simplified to just report.publicModules.map(report.dest.path / _.jsFileName).

Suggested change
report.publicModules.map(report.dest.path / _.jsFileName).toSeq,
report.publicModules.map(report.dest.path / _.jsFileName),

Copilot uses AI. Check for mistakes.

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.

Sorry copilot, but an Iterable is not a Seq. Without the .toSeq it does not compile

Seq(
"node",
rollupPath.toString,
copied.head.path.toString

Copilot AI Sep 3, 2025

Copy link

Choose a reason for hiding this comment

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

Using .head on a collection without checking if it's non-empty can cause a runtime exception if the collection is empty. Consider using .headOption with proper handling or ensuring the collection is non-empty before this call.

Suggested change
copied.head.path.toString
copied.headOption
.map(_.path.toString)
.getOrElse(throw new RuntimeException("No input files were copied; cannot run rollup"))

Copilot uses AI. Check for mistakes.

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.

This makes the failure more explicit, good change.

"devtool" -> "source-map",
"entry" -> (dir / params.inputFile.last).toString,
"output" -> ujson.Obj.from(outputCfg.view.mapValues(ujson.Str)),
"entry" -> (dir / params.inputFiles.head.last).toString,

Copilot AI Sep 3, 2025

Copy link

Choose a reason for hiding this comment

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

Using .head on a collection without checking if it's non-empty can cause a runtime exception if the collection is empty. Consider using .headOption with proper handling or ensuring the collection is non-empty before this call.

Suggested change
"entry" -> (dir / params.inputFiles.head.last).toString,
"entry" -> params.inputFiles.headOption
.map(f => (dir / f.last).toString)
.getOrElse(throw new IllegalArgumentException("inputFiles is empty")),

Copilot uses AI. Check for mistakes.
@nafg

nafg commented Sep 3, 2025

Copy link
Copy Markdown
Owner

@ThijsBroersen perhaps I should have reviewed all the code before merging it. See #69 but also I belatedly had @copilot review it, if you could take a look at the comments it added

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.

3 participants