Skip to content

Conversation

ShreckYe
Copy link
Contributor

Consolidated follow-ups of #4586.

A summary of changes:

  1. rename Config to MavenAndGradleCommonConfig in BuildGenUtil to make it clearer

  2. rename optional in BuildGenUtil to renderIfArgsNonEmpty to make it more consistent with the other function names

  3. remove moduleOptionTree in BuildGenBase.convert which seems redundant

  4. convert generic type parameters to abstract type members for BuildGenBase and its subtypes

    Also see the TODO comment which is resolved and removed and https://github.com/com-lihaoyi/mill/pull/4586/files#r1970795027. As these types M, D, and I are only used in the trait and its subtypes, I think parameterization is not needed here, so replacing these type parameters with type members make them more readable and also consistent with the type member C.

  5. remove some TODOs of slight significance without resolving them and convert some into ordinary comments

  6. replace Yoda conditions

  7. rename IrBuild to IrModuleBuild

  8. Rename IrTrait to IrBaseInfo and replace the original references of IrBaseInfo with Option[IrBaseInfo]

    The original name IrTrait seems too broad and is not very readable.

  9. rename extractScopedDeps to extractConfigurationDeps in GradleBuildGenMain

  10. Change I to (BuildExport, Tree[Node[Option[Project]]]) in SbtBuildGenMain and refactor getBaseInfo to retrieve buildExport.projects directly

See the resolved and removed TODOs for more detailed explanations of the changes. Also see the added TODO comments showing some alternative renaming options and remove them before merging.

Copilot AI and others added 30 commits September 12, 2025 04:02
… object declaration, add overrides

Co-authored-by: ShreckYe <[email protected]>
…`java` plugin applied in Gradle too` and replace some Yoda conditions
…71-fd7144c9d4ef

Convert generic type parameters to abstract type members in BuildGenBase.scala
Achieved by replacing `null ([=!]=) (\w+)` with `$2 $1 null` using regex.
Prompt:
```text
Find and replace all Yoda conditions using regex.
```
…of `IrBaseInfo` with `Option[IrBaseInfo]`

The original name `IrTrait` looks too broad.
Comment on lines 8 to 11
type M
type D
type I
type C
Copy link
Member

Choose a reason for hiding this comment

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

Can we have more descriptive names here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, they are respectively Module, Dependency, Input, and Config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also just noticed that D/Dependency is no longer used in the current implementation. Shall I remove it or just keep it for possible use and better readability?

Copy link
Member

Choose a reason for hiding this comment

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

If it's unused, remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed D and renamed M and I. C is kept as renaming it would conflict with the Config nested classes. I guess it can be renamed to something like ConfigT if needed, but I am not sure whether this is conventional in Scala.

@ShreckYe ShreckYe marked this pull request as ready for review September 16, 2025 07:41
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