Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to mill 0.12.5 and refactor mill scripts #4616

Merged
merged 6 commits into from
Jan 18, 2025

Conversation

unlsycn
Copy link
Contributor

@unlsycn unlsycn commented Jan 14, 2025

This PR migrates to Mill 0.12.5 and refactors the Mill build scripts according to the recommended practice, which includes the following changes:

  1. All modules except chisel have been split into separate package.mill in subfolders, and the publish flow has been separated into release.mill. build.mill contains only
    the utility traits and modules for easy reuse in packages and the chisel module, which Mill requires to be declared inside the top-level module.

  2. Due to RootModule and Cross cannot be applied to the same module com-lihaoyi/mill#3693, CrossModule have been moved to {module}.cross (e.g. firrtl[2.13.15] => firrtl.cross[2.13.15] as a workaround, and it does not affect the directory hierarchy.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • Internal or build-related (includes code refactoring/cleanup)

Desired Merge Strategy

  • Squash: The PR will be squashed and merged (choose this if you have no preference).
  • Rebase: You will rebase the PR onto master and it will be merged with a merge commit.

Release Notes

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.6.x, 5.x, or 6.x depending on impact, API modification or big change: 7.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash), clean up the commit message, and label with Please Merge.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

common.mill Outdated Show resolved Hide resolved
@unlsycn unlsycn force-pushed the mill-bump branch 4 times, most recently from 4a56e09 to baab46e Compare January 18, 2025 13:12
Copy link
Member

@sequencer sequencer left a comment

Choose a reason for hiding this comment

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

I didn't expect introduced so many package.mill files, but anyway that looks good to me since it's recommended by the official mill.

But My key concern is package.mill always requires importing from the root build.mill, I understand this is because the cross dependencies of these modules. But is possible to only declare the dependencies requirements from each sub-folder and fill by the build.mill, like what my common.sc originally did.

The second nit is, I think the build.mill is still too much of things, please reduce it by splitting it into multiple files, I think the core build.mill should only maintain the publish flow.

build.mill Show resolved Hide resolved

// Java Codegen for all declared functions.
// All of these functions are not private API which is subject to change.
trait CIRCTPanamaBinding extends HasJextractGeneratedSources {
Copy link
Member

Choose a reason for hiding this comment

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

HasJextractGeneratedSources, you can add a panama.mill file storing it, In the future, a contribution point is push our Jextract + Panama as plugin to official mill plugin.

stdlib/package.mill Show resolved Hide resolved
build.mill Show resolved Hide resolved
build.mill Outdated Show resolved Hide resolved
@unlsycn unlsycn marked this pull request as ready for review January 18, 2025 18:54
@sequencer sequencer added Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. Dependency Update Updates a dependency, will be included in release notes labels Jan 18, 2025
@chiselbot chiselbot merged commit 908d77e into chipsalliance:main Jan 18, 2025
17 checks passed
@seldridge
Copy link
Member

seldridge commented Jan 19, 2025

Thanks for this.

I'm seeing both failures during the publish step [1], during nightly ci [2], and locally when switching branches. The switching branches I'm confused about, but this is acting like there is a stale file that it is trying to compile which was removed:

# ./mill 'chisel[2.13.15].test.testOnly' chiselTests.LayerSpec  
[372/372] ============================== chisel[2.13.15].test.testOnly chiselTests.LayerSpec ==============================
1 tasks failed
chisel[2.13.15].test.discoveredTestClasses java.lang.NoClassDefFoundError: chisel3/Placeholder
    java.base/java.lang.Class.getDeclaredMethods0(Native Method)
    java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
    java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
    mill.testrunner.TestRunnerUtils$.$anonfun$matchFingerprints$1(TestRunnerUtils.scala:99)
    mill.testrunner.TestRunnerUtils$.$anonfun$matchFingerprints$1$adapted(TestRunnerUtils.scala:89)
    scala.collection.ArrayOps$.find$extension(ArrayOps.scala:694)
    mill.testrunner.TestRunnerUtils$.matchFingerprints(TestRunnerUtils.scala:89)
    mill.testrunner.TestRunnerUtils$.$anonfun$discoverTests$3(TestRunnerUtils.scala:64)
    geny.Generator$Mapped.$anonfun$generate$4(Generator.scala:288)
    geny.Generator$Mapped.$anonfun$generate$4(Generator.scala:288)
    geny.Generator$Filtered.$anonfun$generate$3(Generator.scala:281)
    geny.Generator$Mapped.$anonfun$generate$4(Generator.scala:288)
    os.walk$stream$$anon$2$$anon$3.visitFile(ListOps.scala:258)
    os.walk$stream$$anon$2$$anon$3.visitFile(ListOps.scala:239)
    java.base/java.nio.file.Files.walkFileTree(Files.java:2725)
    os.walk$stream$$anon$2.generate(ListOps.scala:239)
    geny.Generator$Mapped.generate(Generator.scala:288)
    geny.Generator$Filtered.generate(Generator.scala:281)
    geny.Generator$Mapped.generate(Generator.scala:288)
    geny.Generator$Mapped.generate(Generator.scala:288)
    geny.Generator.foreach(Generator.scala:49)
    geny.Generator.foreach$(Generator.scala:49)
    geny.Generator$Mapped.foreach(Generator.scala:286)
    geny.Generator.toBuffer(Generator.scala:132)
    geny.Generator.toBuffer$(Generator.scala:130)
    geny.Generator$Mapped.toBuffer(Generator.scala:286)
    geny.Generator.toVector(Generator.scala:140)
    geny.Generator.toVector$(Generator.scala:140)
    geny.Generator$Mapped.toVector(Generator.scala:286)
    geny.Generator.toSeq(Generator.scala:137)
    geny.Generator.toSeq$(Generator.scala:137)
    geny.Generator$Mapped.toSeq(Generator.scala:286)
    mill.testrunner.TestRunnerUtils$.$anonfun$discoverTests$2(TestRunnerUtils.scala:49)
    mill.api.AggWrapper$Agg$Mutable.$anonfun$flatMap$1(AggWrapper.scala:114)
    mill.api.AggWrapper$Agg$Mutable.$anonfun$flatMap$1$adapted(AggWrapper.scala:114)
    scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619)
    scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617)
    scala.collection.AbstractIterator.foreach(Iterator.scala:1303)
    mill.api.AggWrapper$Agg$Mutable.flatMap(AggWrapper.scala:114)
    mill.api.AggWrapper$Agg$Mutable.flatMap(AggWrapper.scala:76)
    mill.testrunner.TestRunnerUtils$.discoverTests(TestRunnerUtils.scala:47)
    mill.testrunner.DiscoverTestsMain$.$anonfun$main0$1(DiscoverTestsMain.scala:22)
    mill.util.Jvm$.inprocess(Jvm.scala:480)
    mill.testrunner.DiscoverTestsMain$.main0(DiscoverTestsMain.scala:30)
    mill.scalalib.TestModule.$anonfun$discoveredTestClasses$3(TestModule.scala:43)
java.lang.ClassNotFoundException: chisel3.Placeholder
    java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
    mill.api.ClassLoader$$anon$1.findClass(ClassLoader.scala:27)
    java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    java.base/java.lang.Class.getDeclaredMethods0(Native Method)
    java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
    java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
    mill.testrunner.TestRunnerUtils$.$anonfun$matchFingerprints$1(TestRunnerUtils.scala:99)
    mill.testrunner.TestRunnerUtils$.$anonfun$matchFingerprints$1$adapted(TestRunnerUtils.scala:89)
    scala.collection.ArrayOps$.find$extension(ArrayOps.scala:694)
    mill.testrunner.TestRunnerUtils$.matchFingerprints(TestRunnerUtils.scala:89)
    mill.testrunner.TestRunnerUtils$.$anonfun$discoverTests$3(TestRunnerUtils.scala:64)
    geny.Generator$Mapped.$anonfun$generate$4(Generator.scala:288)
    geny.Generator$Mapped.$anonfun$generate$4(Generator.scala:288)
    geny.Generator$Filtered.$anonfun$generate$3(Generator.scala:281)
    geny.Generator$Mapped.$anonfun$generate$4(Generator.scala:288)
    os.walk$stream$$anon$2$$anon$3.visitFile(ListOps.scala:258)
    os.walk$stream$$anon$2$$anon$3.visitFile(ListOps.scala:239)
    java.base/java.nio.file.Files.walkFileTree(Files.java:2725)
    os.walk$stream$$anon$2.generate(ListOps.scala:239)
    geny.Generator$Mapped.generate(Generator.scala:288)
    geny.Generator$Filtered.generate(Generator.scala:281)
    geny.Generator$Mapped.generate(Generator.scala:288)
    geny.Generator$Mapped.generate(Generator.scala:288)
    geny.Generator.foreach(Generator.scala:49)
    geny.Generator.foreach$(Generator.scala:49)
    geny.Generator$Mapped.foreach(Generator.scala:286)
    geny.Generator.toBuffer(Generator.scala:132)
    geny.Generator.toBuffer$(Generator.scala:130)
    geny.Generator$Mapped.toBuffer(Generator.scala:286)
    geny.Generator.toVector(Generator.scala:140)
    geny.Generator.toVector$(Generator.scala:140)
    geny.Generator$Mapped.toVector(Generator.scala:286)
    geny.Generator.toSeq(Generator.scala:137)
    geny.Generator.toSeq$(Generator.scala:137)
    geny.Generator$Mapped.toSeq(Generator.scala:286)
    mill.testrunner.TestRunnerUtils$.$anonfun$discoverTests$2(TestRunnerUtils.scala:49)
    mill.api.AggWrapper$Agg$Mutable.$anonfun$flatMap$1(AggWrapper.scala:114)
    mill.api.AggWrapper$Agg$Mutable.$anonfun$flatMap$1$adapted(AggWrapper.scala:114)
    scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619)
    scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617)
    scala.collection.AbstractIterator.foreach(Iterator.scala:1303)
    mill.api.AggWrapper$Agg$Mutable.flatMap(AggWrapper.scala:114)
    mill.api.AggWrapper$Agg$Mutable.flatMap(AggWrapper.scala:76)
    mill.testrunner.TestRunnerUtils$.discoverTests(TestRunnerUtils.scala:47)
    mill.testrunner.DiscoverTestsMain$.$anonfun$main0$1(DiscoverTestsMain.scala:22)
    mill.util.Jvm$.inprocess(Jvm.scala:480)
    mill.testrunner.DiscoverTestsMain$.main0(DiscoverTestsMain.scala:30)
    mill.scalalib.TestModule.$anonfun$discoveredTestClasses$3(TestModule.scala:43)

chisel3.Placeholder is something I have committed on a branch, but is now gone after changing and building on main.

Any idea what is going on?

Given that CI is actually broken, can this be blamelessly reverted while it gets figured out?

@sequencer
Copy link
Member

Any idea what is going on?

I think it was blamed to random issue from mill side, may GitHub Action + mill don't work well together.

Given that CI is actually broken, can this be blamelessly reverted while it gets figured out?

I personally think it just only a small tweak on CI, ask @unlsycn fix this today, otherwise revert this.

@unlsycn unlsycn mentioned this pull request Jan 20, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependency Update Updates a dependency, will be included in release notes Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants