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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
828d4db
Adding Spotless plugin to enforce codestyle & sample formattings
SergejT34 Feb 6, 2019
e45dc84
Apply spotless plugin on generator module
SergejT34 Feb 6, 2019
6d933c7
Reenable submodules
SergejT34 Feb 6, 2019
cad14cb
Adding some license headers
SergejT34 Feb 6, 2019
65a6acb
Changed phase generation to sort entities & phases in ASC
SergejT34 Feb 6, 2019
9d7751b
Fixing import order file after addind license header. No empty lines …
SergejT34 Feb 6, 2019
0dc7777
Generated Lists generates ordered file now
robertschreib Feb 7, 2019
032ce19
Changed Entity generation to sort getter & setters by field name in A…
SergejT34 Feb 7, 2019
e39ae06
Changed if else chains in EntityModel template with string switch cas…
SergejT34 Feb 7, 2019
bcb69eb
Changed EntityList AvailableFields & SortableFields generation to sor…
SergejT34 Feb 7, 2019
a8e0849
Tuning spotless settings
SergejT34 Feb 8, 2019
54e8a1c
Changed Octane & GoogleHttpClient to allow disabling validating serve…
SergejT34 Feb 8, 2019
19796be
Adding helper to replace accented characters in field names
SergejT34 Feb 8, 2019
20040e1
Added maven parameter to ignore ssl certificates
SergejT34 Feb 8, 2019
f5f3734
Renamed import order file
SergejT34 Feb 8, 2019
67a1aef
Changed generator to sign out after everything is done
SergejT34 Feb 8, 2019
e3642cc
Changed list generator to query root list_nodes
SergejT34 Feb 8, 2019
341ef8f
Changed phase generator to build proper enum names
SergejT34 Feb 8, 2019
02f4fa5
Improved interface generation & template
SergejT34 Feb 8, 2019
46d8536
Improved EntityList generation & template
SergejT34 Feb 8, 2019
670949d
Fixed GeneratorHelper.convertToUpperCase
SergejT34 Feb 8, 2019
6018c53
Added SortHelper to sort required fields list of lists
SergejT34 Feb 11, 2019
6a6443e
Added documentation for SortHelper
SergejT34 Feb 11, 2019
01a280d
Changed interfaces visibility to public
SergejT34 Feb 12, 2019
af94ada
Changed list_nodes queries
SergejT34 Feb 12, 2019
5b073e1
Handle only active phases
SergejT34 Feb 12, 2019
980f569
Added list resolution by their labels
SergejT34 Feb 13, 2019
85d89bf
Changed list enum generation to handle duplicated list entries
SergejT34 Feb 13, 2019
87c8e53
Take care of enums containing only '_' in name
SergejT34 Mar 4, 2019
8b9afb3
Extend FieldMetadata with selectable field
SergejT34 Mar 12, 2019
b724e10
Added null checks to EntityModel getters
SergejT34 Mar 12, 2019
48452dc
Füge weiteren Konstruktor hinzu
lukaslisowski Sep 2, 2019
064c5ea
Update Lists.vm
lukaslisowski Sep 2, 2019
847e956
Update Lists.vm
lukaslisowski Sep 2, 2019
66d37c0
Remove main method
robertschreib Sep 3, 2019
72e6bf0
Add @deprecated to deprecated list values
robertschreib Sep 4, 2019
b406b37
Add ci script
robertschreib Sep 6, 2019
5a4f38f
Correct CI script naming
robertschreib Sep 6, 2019
e10becd
Add license headers ci cache and reformat code
robertschreib Sep 6, 2019
fa34361
Remove cache because of license header problems
robertschreib Sep 6, 2019
fef7b18
Settings xml setzen
robertschreib Sep 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright 2017 EntIT Software LLC, a Micro Focus company, L.P.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

stages:
- publish

publish-sdk:
image: maven:3-jdk-8-slim
stage: publish
only:
- tags
script:
- mvn versions:set -DnewVersion=${CI_COMMIT_TAG}
- mvn clean install -DskipTests
- mvn deploy --settings .m2/settings.xml -DskipTests -Dmaven.install.skip=true


25 changes: 25 additions & 0 deletions .m2/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--

Copyright 2017 EntIT Software LLC, a Micro Focus company, L.P.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<id>snapshot-repository</id>
<username>${env.MAVEN_REPO_USER}</username>
<password>${env.MAVEN_REPO_PASS}</password>
</server>
</servers>
</settings>
329 changes: 329 additions & 0 deletions eclipse-formatter.xml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions importorder.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Organize Import Order
5=liquibase
4=lombok
3=com
2=org
1=javax
0=java
26 changes: 24 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

<commons-configuration.version>2.0</commons-configuration.version>
<commons-beanutils.version>1.9.2</commons-beanutils.version>
<commons-lang.version.version>3.8.1</commons-lang.version.version>

<maven-release.version>2.5.3</maven-release.version>
<maven-surefire.version>2.19.1</maven-surefire.version>
Expand Down Expand Up @@ -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

<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>1.17.0</version>
<configuration>
<java>
<trimTrailingWhitespace/>
<removeUnusedImports/>
<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

<file>${session.executionRootDirectory}/eclipse-formatter.xml</file>
<version>4.7.1</version>
</eclipse>
<importOrder>
<file>${session.executionRootDirectory}/importorder.properties</file>
</importOrder>
</java>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
Expand Down Expand Up @@ -351,12 +373,12 @@
<distributionManagement>
<repository>
<id>release-repository</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
<url>${env.MAVEN_RELEASE_REPOSITORY}</url>
</repository>
<snapshotRepository>
<id>snapshot-repository</id>
<name>Maven2 Snapshot Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<url>${env.MAVEN_SNAPSHOT_REPOSITORY}</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,43 @@
*/
package com.hpe.adm.nga.sdk.generate;

import java.io.File;
import java.io.IOException;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import java.io.File;
import java.io.IOException;

@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true)
public class GenerateModelsPlugin extends AbstractMojo {

@Parameter(defaultValue = "${project.build.directory}/generated-sources")
private File generatedSourcesDirectory;
@Parameter(required = true)
private String clientId;
@Parameter(required = true)
private String clientSecret;
@Parameter(required = true)
private String server;
@Parameter(required = true)
private long sharedSpace;
@Parameter(required = true)
private long workSpace;
@Parameter(defaultValue = "${project.build.directory}/generated-sources")
private File generatedSourcesDirectory;
@Parameter(required = true)
private String clientId;
@Parameter(required = true)
private String clientSecret;
@Parameter(required = true)
private String server;
@Parameter(required = true)
private long sharedSpace;
@Parameter(required = true)
private long workSpace;
@Parameter(defaultValue = "false")
private boolean doNotValidateCertificate;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("Starting to generate entities");
try {
new GenerateModels(generatedSourcesDirectory).generate(clientId, clientSecret, server, sharedSpace, workSpace);
} catch (IOException e) {
throw new MojoExecutionException("Problem generating entities", e);
}
getLog().info("Finished generating entities");
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("Starting to generate entities");
try {
new GenerateModels(generatedSourcesDirectory).generate(clientId, clientSecret, server, sharedSpace,
workSpace, doNotValidateCertificate);
} catch (IOException e) {
throw new MojoExecutionException("Problem generating entities", e);
}
getLog().info("Finished generating entities");
}
}
Loading