-
-
Notifications
You must be signed in to change notification settings - Fork 417
Improve the init
buildgen
code resolving some TODOs
#5866
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: ShreckYe <[email protected]>
… object declaration, add overrides Co-authored-by: ShreckYe <[email protected]>
…make the name clearer
…tps://github.com/ShreckYe/mill into copilot/fix-9475931d-2457-49c4-9a71-fd7144c9d4ef
…`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. ```
…g' into improve-init-guildgen
…nto improve-init-guildgen
…-members' into improve-init-guildgen
…odo' into improve-init-guildgen
…of `IrBaseInfo` with `Option[IrBaseInfo]` The original name `IrTrait` looks too broad.
…ldGenMain` and refactor `getBaseInfo` to retrieve `buildExport.projects` directly
type M | ||
type D | ||
type I | ||
type C |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Consolidated follow-ups of #4586.
A summary of changes:
rename
Config
toMavenAndGradleCommonConfig
inBuildGenUtil
to make it clearerrename
optional
inBuildGenUtil
torenderIfArgsNonEmpty
to make it more consistent with the other function namesremove
moduleOptionTree
inBuildGenBase.convert
which seems redundantconvert generic type parameters to abstract type members for
BuildGenBase
and its subtypesAlso 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
, andI
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 memberC
.remove some TODOs of slight significance without resolving them and convert some into ordinary comments
replace Yoda conditions
rename
IrBuild
toIrModuleBuild
Rename
IrTrait
toIrBaseInfo
and replace the original references ofIrBaseInfo
withOption[IrBaseInfo]
The original name
IrTrait
seems too broad and is not very readable.rename
extractScopedDeps
toextractConfigurationDeps
inGradleBuildGenMain
Change
I
to(BuildExport, Tree[Node[Option[Project]]])
inSbtBuildGenMain
and refactorgetBaseInfo
to retrievebuildExport.projects
directlySee 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.