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

Deterministic Code Generation #65

Closed
wants to merge 41 commits into from

Conversation

SergejT34
Copy link

@SergejT34 SergejT34 commented Feb 11, 2019

Problem:
There are some Octane Enterprise installations behind a firewall, so code generation could not be done on each build.

Solution:
Change the code generator to generate reproducible java code:

  • All Enums in Phases & Lists are ASC sorted
  • All ctors, getters & setters in EntityModels are ASC sorted
  • if/else branches & switch cases are ASC sorted
    => run generator twice, and the generated code will remain the same

Improvements:

@slbruce
Copy link
Contributor

slbruce commented Feb 14, 2019

Wow! This is quite comprehensive. We will have a look as soon as we can!

@slbruce
Copy link
Contributor

slbruce commented May 2, 2019

@SergejT34 could you contact me on [email protected]? I would like to set up a meeting to discuss these changes

<includes>
<include>sdk-generate-entity-models-maven-plugin/src/**/java/**/*.java</include>
</includes>
<eclipse>
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of using a code formatter, however will this work (integrate) with IntelliJ, we use that internally?

Copy link
Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

we also use intellij at emundo 😉 and all our projects has a build step in our ci to enforce correct formatting.
https://github.com/diffplug/spotless/tree/master/plugin-gradle
https://github.com/diffplug/spotless/tree/master/plugin-maven

@@ -188,6 +189,27 @@
<!-- mvn com.mycila:license-maven-plugin:format (add headers if missing) -->
<!-- mvn com.mycila:license-maven-plugin:remove (remove existing header) -->
Copy link
Contributor

Choose a reason for hiding this comment

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

these for comment lines need to be next to the relevant maven plugin

* @param doNotValidateCertificate - Disables validating server SSL certificates
* @return a new Octane instance which has the set context and is correctly authenticated
*/
public Octane build(final boolean doNotValidateCertificate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this flag should be a step in the build process, with a default value. Going by our current "convention" I guess it would be a method called SkipSslCertificateValidation(boolean skipCertificateValidation).

Copy link
Contributor

Choose a reason for hiding this comment

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

I need to think about this one

this(urlDomain, false);
}

public GoogleHttpClient(final String urlDomain, final boolean doNotValidateCertificate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good to have :) ! Sad that it's needed.

@slbruce
Copy link
Contributor

slbruce commented Mar 1, 2020

We decided to fix some of these issues in different ways. You can see the updates. If there are still issues that you want to fix open a new PR (but make them smaller and more self-contained! :) )

@slbruce slbruce closed this Mar 1, 2020
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.

Generator generates bad code if there are duplicate lists
5 participants