-
Notifications
You must be signed in to change notification settings - Fork 8
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
Revert "Revert "chore: move codegen logic (#206)"" #209
Revert "Revert "chore: move codegen logic (#206)"" #209
Conversation
LGTM (again) but want to make sure at least one crypto-tools member acks too, given the impact |
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.
LGTM
import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; | ||
import software.amazon.polymorph.traits.LocalServiceTrait; | ||
import software.amazon.polymorph.traits.PositionalTrait; | ||
import software.amazon.polymorph.traits.ReferenceTrait; |
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.
These kinds of basically whitespace changes are annoying.
It would be wonderful to have a linter/formater for this
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.
Ack, I'll look into auto-formatting for a future PR.
@@ -71,14 +71,14 @@ jobs: | |||
uses: actions/setup-java@v3 | |||
with: | |||
distribution: 'corretto' | |||
java-version: 8 |
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.
This is wrong.
Our public Java products MUST support Java 8.
i.e: The Code Generator needs Java 17.
But the Generated Code MUST support and MUST BE tested in Java 8.
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.
Ack. I will fix this and other instances in a follow-up PR.
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.
This PR was massive.
In addition to moving the entire codegen repo,
it compromised our testing
and refactoring our outstanding PRs to accommodate this refactor is, frankly, an annoying waste of time.
In the future, please attempt to make smaller PRs.
There was no reason, at all, to refactor the Import statements.
But because the import statements were refactored along with all the file movement,
outstanding PRs that actually deliver value must be manually refactored to account for this PR.
@@ -64,7 +64,7 @@ jobs: | |||
- name: Setup Maven Action | |||
uses: s4u/setup-maven-action@v1.7.0 | |||
with: | |||
java-version: 8 |
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.
This is wrong. This is the Java Version used for installing the Danfy Runtime Jar and the Dafny Java Conversion Library. It MUST be Java 8. Please Revert.
Our public Java products MUST support Java 8.
i.e: The Code Generator needs Java 17.
But the Generated Code MUST support and MUST BE tested in Java 8.
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.
Ack. I will fix this and other instances in a follow-up PR.
Some extra context on this particular instance, for posterity - the setup-maven-action
annoyingly overrides the default Java version with whichever java-version
specified. That is, if you setup-java
for Java 17, and later setup-maven-action
for Java 8, then future java
and gradle
invocations will use Java 8 by default - and gradle
doesn't yet know how to automatically locate the Java 17 installation even if the project it's compiling demands Java 17. The change in this PR is the same workaround I applied in #177.
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.
PR to revert/fix Java version changes: #221
|
||
# TODO: This has been added has a workaround for https://issues.apache.org/jira/browse/MNG-7679 | ||
# Remove this when the latest version has been patched | ||
- name: Setup Maven Action | ||
uses: s4u/setup-maven-action@v1.7.0 | ||
with: | ||
java-version: 8 |
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.
This is wrong.
Our public Java products MUST support Java 8.
i.e: The Code Generator needs Java 17.
But the Generated Code MUST support and MUST BE tested in Java 8.
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.
Ack, will fix - see details in #209 (comment)
@@ -87,7 +87,7 @@ jobs: | |||
- name: Setup Maven Action | |||
uses: s4u/setup-maven-action@v1.7.0 | |||
with: | |||
java-version: 8 | |||
java-version: 17 |
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.
This is wrong.
This is the Java Version used for installing the Danfy Runtime Jar and the Dafny Java Conversion Library.
It MUST be Java 8. Please Revert.
Our public Java products MUST support Java 8.
i.e: The Code Generator needs Java 17.
But the Generated Code MUST support and MUST BE tested in Java 8.
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.
Ack, will fix - see details in #209 (comment)
import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; | ||
import software.amazon.polymorph.traits.PositionalTrait; | ||
import software.amazon.polymorph.utils.ModelUtils; |
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 am annoyed by almost all of these Import statement changes.
I do not understand the value they add.
Nor do I understand the heuristic used to determine the order of these import statements.
Alphabetically, traits
is after smithyjava
. As is utils
.
Surely this was enough change in this PR as is without these pointless import changes?
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.
Yup I was mildly annoyed too. We should discuss our collective formatting preferences on #211.
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.
To expand on this - I let IntelliJ IDEA handle the refactoring of moving the code, and it performed these import changes according to its default formatting settings, without me noticing. I should've taken a closer look at the diff and reverted them.
import software.amazon.polymorph.smithyjava.generator.library.ShimLibrary; | ||
import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; | ||
import software.amazon.polymorph.utils.ModelUtils; |
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.
Confusion: What is the heuristics for ordering Import statements?
It does not appear to be consistent.
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.
This resulted from IDE auto-formatting - details in #209 (comment)
|
||
import software.amazon.smithy.model.Model; | ||
import software.amazon.smithy.model.shapes.ResourceShape; | ||
import software.amazon.smithy.model.shapes.ServiceShape; | ||
import software.amazon.smithy.utils.StringUtils; | ||
|
||
import static software.amazon.polymorph.smithydafny.DafnyNameResolver.traitNameForServiceClient; | ||
import static software.amazon.polymorph.utils.DafnyNameResolverHelpers.dafnyCompilesExtra_; |
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.
Confusion: When is it acceptable to have a static import?
This PR has pointlessly removed quiet a few of them while leaving others,
seemingly at random.
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.
This resulted from IDE auto-formatting - details in #209 (comment)
@texastony - I'm very sorry this caused you this much trouble. We had some offline discussions about this change that might not have reached you in time, and I did want to make sure we didn't make it without cryptools awareness so we were careful not to merge without an extra approval (or rather accidentally merged and then reverted :). I definitely agree in principle that smaller PRs are always better, but in this case I think moving code in chunks would have been a lot of overhead, and it was better to rip the bandaid off quickly. We knew this would cause some PR merge headaches, but is there testing we're not aware of that it also broke? Your point about the simultaneous import refactorings is valid and other reviewers pointed it out too. We cut #211 to try to avoid a future occurrence. We'll respond to your comments and where applicable get changes in ASAP to address them. |
To echo Robin's comment - sorry about the churn. We'll communicate more clearly in the future to try to find better timing in case of big changes like these.
I agree that the import-related changes were annoying and I should've caught and reverted them, instead of relying on the IDE refactoring tooling to do the right thing. I'll be careful to isolate file copying from code changes going forward. |
See #206