Skip to content

Commit

Permalink
mavenize
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Jun 26, 2023
1 parent 4582f62 commit abc74d2
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: Deploy

on:
push:
branches: [ mavenize ]
branches: [ master, development ]

jobs:
verify:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
java-version: [ 11 ]
java-version: [ 17 ]
distribution: 'temurin'
steps:
- name: Check out Git repository
Expand Down
32 changes: 31 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dominokit</groupId>
<artifactId>domino-cli</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>HEAD-SNAPSHOT</version>
<properties>
<snapshot.version>HEAD-SNAPSHOT</snapshot.version>
<next.release.version>1.0.0-RC6</next.release.version>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -147,6 +149,34 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.dominokit</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<snapshotVersionProperty>snapshot.version</snapshotVersionProperty>
<releaseVersionProperty>next.release.version</releaseVersionProperty>
<!-- Set to true to immediately bump the development version when creating a release branch -->
<commitDevelopmentVersionAtStart>true</commitDevelopmentVersionAtStart>

<!-- Which digit to increase in major.minor.patch versioning, the values being 0.1.2 respectively.
By default the rightmost number is increased.
Pass in the number via parameter or profile to allow configuration,
since everything set in the file can't be overwritten via command line -->
<versionDigitToIncrement>${bump.digit}</versionDigitToIncrement>

<!-- Execute mvn verify before release -->
<preReleaseGoals>verify</preReleaseGoals>
<preHotfixGoals>verify</preHotfixGoals>

<!-- Configure branches -->
<gitFlowConfig>
<productionBranch>master</productionBranch>
<!-- default is develop, but we use development -->
<developmentBranch>development</developmentBranch>
</gitFlowConfig>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-runner${executable-suffix}</source>
<outputDirectory>./bin</outputDirectory>
<destName>${project.artifactId}${executable-suffix}</destName>
<destName>dominokit${executable-suffix}</destName>
</file>
</files>
</assembly>
16 changes: 15 additions & 1 deletion src/main/java/org/dominokit/cli/commands/DominoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@
@TopCommand
@Command(
name = "domino",
description = "Executes domino commands",
description = """
Executes domino commands
Use this command to generate basic template project or an MVP project.
The versions used in the project dependencies can be set dynamically using env variable as the following :
- DOMINO_CLI_DOMINO_UI_VERSION
- DOMINO_CLI_DOMINO_HISTORY_VERSION
- DOMINO_CLI_DOMINO_MVP_VERSION
- DOMINO_CLI_DOMINO_REST_VERSION
- DOMINO_CLI_DOMINO_JACKSON_VERSION
- DOMINO_CLI_QUARKUS_VERSION
- DOMINO_CLI_VERTX_VERSION
- DOMINO_CLI_GWT_VERSION
- DOMINO_CLI_J2CL_PLUGIN_VERSION
""",
subcommands = {
CommandLine.HelpCommand.class,
GenerateCommand.class
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/org/dominokit/cli/generator/TemplateProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.Writer;
import java.util.Arrays;
import java.util.Map;
import java.util.Optional;

import static java.util.Objects.isNull;

Expand All @@ -18,14 +19,23 @@ public class TemplateProvider {
private static Configuration cfg;

public static void render(String templatePath, Map<String, Object> context, Writer out) throws IOException, TemplateException {
Arrays.stream(Versions.values()).forEach(version -> context.put(version.name(), version.get()));
fillVersions(context);

Template template = getEngine().getTemplate(templatePath);
template.process(context, out);
}

private static void fillVersions(Map<String, Object> context) {
Arrays.stream(Versions.values())
.forEach(version -> {
context.put(version.name(), Optional.ofNullable(System.getProperty(version.getEnvVariable()))
.or(() -> Optional.ofNullable(System.getenv(version.getEnvVariable())))
.orElse(version.get()));
});
}

public static String render(String templatePath, Map<String, Object> context) throws IOException, TemplateException {
Arrays.stream(Versions.values()).forEach(version -> context.put(version.name(), version.get()));
fillVersions(context);
StringWriter out = new StringWriter();
Template template = getEngine().getTemplate(templatePath);
template.process(context, out);
Expand Down
26 changes: 16 additions & 10 deletions src/main/java/org/dominokit/cli/generator/Versions.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
package org.dominokit.cli.generator;

public enum Versions {
domino_ui_version("1.0.0-RC10"),
domino_history_version("1.0.0-RC4"),
domino_mvp_version("1.0.0-RC11"),
domino_rest_version("1.0.0-RC5"),
domino_jackson_version("1.0.0-RC3"),
quarkus_version("2.2.3.Final"),
vertx_version("3.9.0"),
gwt_version("2.9.0"),
j2cl_maven_plugin_version("0.18-SNAPSHOT");
domino_ui_version("DOMINO_CLI_DOMINO_UI_VERSION","1.0.0-RC19"),
domino_history_version("DOMINO_CLI_DOMINO_HISTORY_VERSION","1.0.0-RC5"),
domino_mvp_version("DOMINO_CLI_DOMINO_MVP_VERSION","1.0.0-RC11"),
domino_rest_version("DOMINO_CLI_DOMINO_REST_VERSION","1.0.0-RC7"),
domino_jackson_version("DOMINO_CLI_DOMINO_JACKSON_VERSION","1.0.0-RC4"),
quarkus_version("DOMINO_CLI_QUARKUS_VERSION","2.16.7.Final"),
vertx_version("DOMINO_CLI_VERTX_VERSION","3.9.0"),
gwt_version("DOMINO_CLI_GWT_VERSION","2.10.0"),
j2cl_maven_plugin_version("DOMINO_CLI_J2CL_PLUGIN_VERSION","0.21-SNAPSHOT");

private String envVariable;
private String version;

Versions(String version) {
Versions(String envVariable, String version) {
this.envVariable = envVariable;
this.version = version;
}

public String get() {
return version;
}

public String getEnvVariable() {
return envVariable;
}
}

0 comments on commit abc74d2

Please sign in to comment.