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

mill codegen dependancies are "provided" #1552

Open
wants to merge 1 commit into
base: series/0.18
Choose a base branch
from

Conversation

Quafadas
Copy link

@Quafadas Quafadas commented May 29, 2024

Aims to fix #1544

PR Checklist (not all items are relevant to all PRs)

  • Added unit-tests (for runtime code)
  • Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • Added build-plugins integration tests (when reflection loading is required at codegen-time)
  • Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)
  • Updated dynamic module to match generated-code behaviour
  • Added documentation
  • Updated changelog

@Quafadas
Copy link
Author

@kubukoz This is the "I tried to read the manual" version. It's been a long time since I used SBT!

It appears, that I have not broken anything. I'm not sure though, how to test if I have "made something better"? Does this kind of thing need a test / validation?

@kubukoz
Copy link
Member

kubukoz commented May 29, 2024

how to test if I have "made something better"? Does this kind of thing need a test / validation?

can you reproduce the earlier problem in CI? If so, doing that + then applying this fix should be a good protection against regressions.

I guess we'd have to invoke Mill via the CLI, which is currently not being done here.

@Quafadas
Copy link
Author

can you reproduce the earlier problem in CI?

I'm honestly not sure quite how / where would be the best place to go about trying that. I've publishLocal'd and validated that it does clear up the original error.

I guess we'd have to invoke Mill via the CLI, which is currently not being done here.

Yes, I think this could end up being quite "heavyweight" for the risk / reward ratio. I'd follow advice...

@@ -407,21 +426,7 @@ lazy val codegen = projectMatrix
"alloyVersion" -> Dependencies.Alloy.alloyVersion
),
buildInfoPackage := "smithy4s.codegen",
libraryDependencies ++= Seq(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand the rationale behind extracting this. In theory, you shouldn't have to.

Copy link
Author

Choose a reason for hiding this comment

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

I couldn't figure out the right sbt incantation to reference the dependancies of the module directly, without extracting them into their own setting.

This could simply be weak sbt-foo .

@@ -507,7 +512,13 @@ lazy val millCodegenPlugin = projectMatrix
name := "mill-codegen-plugin",
crossVersion := CrossVersion
.binaryWith(s"mill${millPlatform(Dependencies.Mill.millVersion)}_", ""),
libraryDependencies ++= Seq(
libraryDependencies := codegenDeps.value ++ Seq(
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it weird that you'd have to specify codegenDeps.value here considering this module depends on the codegen module, and therefore should benefit from its dependencies without having to add them here.

Copy link
Author

@Quafadas Quafadas May 31, 2024

Choose a reason for hiding this comment

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

My understanding, is that the sbt := operator discards and overwrites any inherited value to this point.

Which begs the question : why not stay with the ++= operator for the "non-provided" scope. The answer to that, was that the "logic" as to which scope contains what became hard for me to follow (weak sbt again, perhaps). My choice was then to be as explicit as possible that something quite deliberate and at least a little non-standard was going on, by using the := operator in both places.

It may not be the right approach, but it set out (for me) the logic as clearly as possible... I'm not a confident sbt user, so certainly willing to stand corrected.

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem, I'll try and find the time to try it locally before making a decision of whether to approve as-is or not. Regardless, thank you very much for the contribution !

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I have to say that I think this is a surprisingly risky, potentially high maintenance sort of change. In the interim, it appears that Tobias at mill has done something which might sort this out millside - maybe it would be preferable to see if the below mill PR sorts it out in preference to merging this?

com-lihaoyi/mill#3189

As ever, thank you for taking the time to review 🙏

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.

Mill plugin (apparently) doesn't work on mill snapshot
3 participants