From 7fea336c22cba4edd2f0102948dd1f4a2fcb9ede Mon Sep 17 00:00:00 2001 From: "Ahmad K. Bawaneh" Date: Sat, 11 May 2024 00:14:45 +0300 Subject: [PATCH] add domino-brix --- README.md | 82 ++++---- .../org/dominokit/cli/VersionProfile.java | 8 +- .../cli/commands/GenerateAppCommand.java | 7 +- .../cli/commands/GenerateModuleCommand.java | 15 +- .../cli/generator/module/Module.java | 5 + .../module/ModuleCreatorFactory.java | 4 +- .../generator/module/gwt/BrixMultiModule.java | 121 ++++++++++++ .../module/gwt/GWTModuleFactory.java | 12 +- .../project/gwt/GWTProjectFactory.java | 1 + .../generator/project/gwt/GwtBrixProject.java | 91 +++++++++ .../v2/app/gwt/brix/README.md | 13 ++ .../v2/app/gwt/brix/backend/README.md | 54 ++++++ .../gwt/brix/backend/docker/Dockerfile.jvm | 54 ++++++ .../brix/backend/docker/Dockerfile.legacy-jar | 51 +++++ .../gwt/brix/backend/docker/Dockerfile.native | 27 +++ .../docker/Dockerfile.native-distroless | 23 +++ .../v2/app/gwt/brix/backend/pom.xml | 159 ++++++++++++++++ .../resource/META-INF/resources/app.css | 1 + .../resource/META-INF/resources/favicon.ico | Bin 0 -> 15406 bytes .../resource/META-INF/resources/favicon.png | Bin 0 -> 548 bytes .../resource/META-INF/resources/index.html | 48 +++++ .../backend/resource/application.properties | 7 + .../brix/backend/source/ConfigResource.java | 25 +++ .../brix/backend/source/IndexPageFilter.java | 42 +++++ .../v2/app/gwt/brix/frontend/pom.xml | 108 +++++++++++ .../v2/app/gwt/brix/frontend/source/App.java | 57 ++++++ .../gwt/brix/frontend/source/module.gwt.xml | 15 ++ .../brix/frontend/source/package-info.java | 4 + .../app/gwt/brix/frontend/source/webjar.xml | 18 ++ .../v2/app/gwt/brix/pom.ftl | 176 ++++++++++++++++++ .../brix/runConfigurations/Development.xml | 7 + .../gwt/brix/runConfigurations/Frontend.xml | 30 +++ .../app/gwt/brix/runConfigurations/Server.xml | 39 ++++ .../v2/app/gwt/brix/shared/pom.xml | 43 +++++ .../gwt/brix/shared/source/ConfigService.java | 20 ++ .../gwt/multi/brix/frontend-dependency.ftl | 11 ++ .../module/gwt/multi/brix/frontend-ui/pom.ftl | 99 ++++++++++ .../brix/frontend-ui/source/Component.java | 16 ++ .../brix/frontend-ui/source/ViewImpl.java | 27 +++ .../brix/frontend-ui/source/module.gwt.xml | 9 + .../brix/frontend-ui/source/package-info.java | 4 + .../v2/module/gwt/multi/brix/frontend/pom.ftl | 86 +++++++++ .../multi/brix/frontend/source/Presenter.java | 24 +++ .../brix/frontend/source/StartupTask.java | 23 +++ .../gwt/multi/brix/frontend/source/View.java | 10 + .../multi/brix/frontend/source/module.gwt.xml | 8 + .../brix/frontend/source/package-info.java | 4 + .../v2/module/gwt/multi/brix/pom.ftl | 20 ++ .../v2/module/gwt/multi/brix/shared/pom.ftl | 58 ++++++ .../gwt/multi/brix/shared/source/Event.java | 7 + .../module/gwt/multi/brix/ui-dependency.ftl | 11 ++ src/test/java/Test.java | 16 +- 52 files changed, 1750 insertions(+), 50 deletions(-) create mode 100644 src/main/java/org/dominokit/cli/generator/module/gwt/BrixMultiModule.java create mode 100644 src/main/java/org/dominokit/cli/generator/project/gwt/GwtBrixProject.java create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/README.md create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/README.md create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.jvm create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.legacy-jar create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native-distroless create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/pom.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/app.css create mode 100755 src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/favicon.ico create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/favicon.png create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/index.html create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/application.properties create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/ConfigResource.java create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/IndexPageFilter.java create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/frontend/pom.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/App.java create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/module.gwt.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/package-info.java create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/webjar.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/pom.ftl create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Development.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Frontend.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Server.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/shared/pom.xml create mode 100644 src/main/resources/projects-templates/v2/app/gwt/brix/shared/source/ConfigService.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-dependency.ftl create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/pom.ftl create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/Component.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/ViewImpl.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/module.gwt.xml create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/package-info.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/pom.ftl create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/Presenter.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/StartupTask.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/View.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/module.gwt.xml create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/package-info.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/pom.ftl create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/pom.ftl create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/source/Event.java create mode 100644 src/main/resources/projects-templates/v2/module/gwt/multi/brix/ui-dependency.ftl diff --git a/README.md b/README.md index 9f7464e..8d876d4 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,14 @@ to generate a module without sub-modules use the `-s` option #### Detailed instructions ``` -Usage: dominokit [COMMAND] -Executes dominokit commands +Usage: domino [-hV] [COMMAND] +Executes domino commands +Use this command to generate basic template project or an MVP project. + + -h, --help Show this help message and exit. + -V, --version Print version information and exit. Commands: - help Displays help information about the specified command + help Display help information about the specified command. generate, gen Generates a domino template project/module ``` @@ -48,7 +52,7 @@ Commands: Usage: domino generate [COMMAND] Generates a domino template project/module Commands: - help Displays help information about the specified command + help Display help information about the specified command. app Use with generate command to generate a domino-mvp template project module Use with generate command to generate a domino-mvp module template @@ -56,25 +60,31 @@ Commands: ``` Usage: domino generate app [-api] [-c=] [-d=] - [-g=] -n= [-t=] [COMMAND] + [-g=] -n= [-t=] [-v=] + [COMMAND] Use with generate command to generate a domino-mvp template project - -api, --generate-api If true will generate an api module for REST - endpoints implementation, current implementation - is Quarkus with jax-rs. - -c, --compiler= The Java to JavaScript compiler to be used - possible values [gwt, j2cl] default is [gwt] - -d, --dir= absolute path to the directory where the project - should be generated. - -g, --groupId= The project group ID, this will be used also for - root package name - -n, --name= The project name, also will be use as the artifact - ID + -api, --generate-api If true will generate an api module for REST endpoints implementation, + current implementation is Quarkus with jax-rs. - not supported by Brix app -. + + -c, --compiler= The Java to JavaScript compiler to be used possible values [gwt, j2cl] default is [gwt]. + + -d, --dir= absolute path to the directory where the project should be generated. + + -g, --groupId= The project group ID, this will be used also for root package name. + + -n, --name= The project name, also will be use as the artifact ID. + -t, --type= The type of the project : - -[basic] : will generate a simple project with - (client, shared, server) - -[mvp] : will generate a domino-mvp project + -[basic] : will generate a simple project with (client, shared, server) + -[mvp] : will generate a domino-mvp project template. + -[brix] : will generate a domino-brix project template. + + -v, --version= DominoKit tools version + -[v1] : Will generate a project using DominoKi tools version 1.x.x. - not supported by brix - + -[v2] : Will generate a project using DominoKi tools version 2.x.x. + -[dev] : Will generate a project using DominoKit tools HEAD-SNAPSHOT versions. Commands: - help Displays help information about the specified command + help Display help information about the specified command. ``` @@ -83,23 +93,23 @@ Usage: domino generate module [-bst] [-c=] [-d=] -n= [-p=] [-sp=] [COMMAND] Use with generate command to generate a domino-mvp module template - -b, --backend if true will generate a domino-mvp backend module, - default implementation is vertx. - -c, --compiler= The Java to JavaScript compiler to be used possible - values [gwt, j2cl] default is [gwt] - -d, --dir= absolute path to the module where the project - should be generated. - -n, --name= The module name, also will be use as the artifact ID + -b, --backend if true will generate a domino-mvp backend module, default implementation is vertx. + + -c, --compiler= The Java to JavaScript compiler to be used possible values [gwt, j2cl] default is [gwt]. + + -d, --dir= absolute path to the module where the project should be generated. + + -n, --name= The module name, also will be use as the artifact ID. + -p, --prefix= The module prefix to be used in the generated - classes name, if not present module name will be - used instead - -s, --single If true it will merge client an shared as one - module, a backend module will not be generated - -sp, --subpackage= - the module sub package, this will be appended to - the application rootPackage - -t, --tests if true will generate tests for a multi submodules - module. + classes name, if not present module name will be used instead. + + -s, --single If true it will merge client an shared as one module, a backend module will not be generated. + + -sp, --subpackage= + the module sub package, this will be appended to the application rootPackage. + + -t, --tests if true will generate tests for a multi submodules module. Commands: help Displays help information about the specified command diff --git a/src/main/java/org/dominokit/cli/VersionProfile.java b/src/main/java/org/dominokit/cli/VersionProfile.java index bfa4c02..3025ad8 100644 --- a/src/main/java/org/dominokit/cli/VersionProfile.java +++ b/src/main/java/org/dominokit/cli/VersionProfile.java @@ -47,6 +47,8 @@ private static VersionProfile get(String version) { ToolVersion.of("domino_mvp_version", "1.0.0"), ToolVersion.of("domino_rest_version", "1.0.1"), ToolVersion.of("domino_jackson_version", "1.0.4"), + ToolVersion.of("domino_auto_version", "1.0.2"), + ToolVersion.of("domino_brix_version", "HEAD-SNAPSHOT"), ToolVersion.of("quarkus_version", "2.16.7.Final"), ToolVersion.of("vertx_version", "3.9.4"), ToolVersion.of("gwt_version", "2.10.0"), @@ -54,11 +56,13 @@ private static VersionProfile get(String version) { ); case "v2": return new VersionProfile(version, version, - ToolVersion.of("domino_ui_version", "2.0.0"), + ToolVersion.of("domino_ui_version", "2.0.1"), ToolVersion.of("domino_history_version", "1.0.3"), ToolVersion.of("domino_mvp_version", "2.0.0-RC2"), ToolVersion.of("domino_rest_version", "2.0.0-RC1"), ToolVersion.of("domino_jackson_version", "1.0.4"), + ToolVersion.of("domino_auto_version", "1.0.2"), + ToolVersion.of("domino_brix_version", "HEAD-SNAPSHOT"), ToolVersion.of("quarkus_version", "3.6.5"), ToolVersion.of("vertx_version", "3.9.4"), ToolVersion.of("gwt_version", "2.11.0"), @@ -71,6 +75,8 @@ private static VersionProfile get(String version) { ToolVersion.of("domino_mvp_version", "HEAD-SNAPSHOT"), ToolVersion.of("domino_rest_version", "HEAD-SNAPSHOT"), ToolVersion.of("domino_jackson_version", "HEAD-SNAPSHOT"), + ToolVersion.of("domino_auto_version", "1.0.2"), + ToolVersion.of("domino_brix_version", "HEAD-SNAPSHOT"), ToolVersion.of("quarkus_version", "3.6.5"), ToolVersion.of("vertx_version", "3.9.4"), ToolVersion.of("gwt_version", "2.11.0"), diff --git a/src/main/java/org/dominokit/cli/commands/GenerateAppCommand.java b/src/main/java/org/dominokit/cli/commands/GenerateAppCommand.java index b50cbd2..1948dfb 100644 --- a/src/main/java/org/dominokit/cli/commands/GenerateAppCommand.java +++ b/src/main/java/org/dominokit/cli/commands/GenerateAppCommand.java @@ -51,8 +51,9 @@ public class GenerateAppCommand implements Runnable { names = {"-t", "--type"}, description = "The type of the project :" + "\n\t\t -[basic] : will generate a simple project with (client, shared, server)" + - "\n\t\t -[mvp] : will generate a domino-mvp project", - defaultValue = "mvp" + "\n\t\t -[mvp] : will generate a domino-mvp project template"+ + "\n\t\t -[brix] : will generate a domino-brix project template", + defaultValue = "brix" ) private String type; @@ -70,7 +71,7 @@ public class GenerateAppCommand implements Runnable { names = {"-api", "--generate-api"}, fallbackValue = "true", defaultValue = "true", - description = "If true will generate an api module for REST endpoints implementation, current implementation is Quarkus with jax-rs." + description = "If true will generate an api module for REST endpoints implementation, current implementation is Quarkus with jax-rs. - not supported by Brix app -" ) private boolean generateApi; diff --git a/src/main/java/org/dominokit/cli/commands/GenerateModuleCommand.java b/src/main/java/org/dominokit/cli/commands/GenerateModuleCommand.java index 24107e7..e8e3fda 100644 --- a/src/main/java/org/dominokit/cli/commands/GenerateModuleCommand.java +++ b/src/main/java/org/dominokit/cli/commands/GenerateModuleCommand.java @@ -1,5 +1,6 @@ package org.dominokit.cli.commands; +import org.dominokit.cli.PomUtil; import org.dominokit.cli.VersionProfile; import org.dominokit.cli.generator.module.Module; import org.dominokit.cli.generator.module.ModuleCreatorFactory; @@ -50,7 +51,6 @@ public class GenerateModuleCommand implements Runnable { ) private boolean generateTests = false; - @Option( names = {"-c", "--compiler"}, fallbackValue = "gwt", @@ -58,6 +58,15 @@ public class GenerateModuleCommand implements Runnable { description = "The Java to JavaScript compiler to be used possible values [gwt, j2cl] default is [gwt]" ) private String compiler; + @Option( + names = {"-f", "--framework"}, + fallbackValue = "mvp", + defaultValue = "mvp", + description = "The target framework " + + "\n\t\t -[mvp] : [Default] Will generate domino-mvp module." + + "\n\t\t -[brix] : Will generate domino-brix module" + ) + private String framework; @Option( names = {"-sp", "--subpackage"}, @@ -81,7 +90,7 @@ public class GenerateModuleCommand implements Runnable { names = {"-b", "--backend"}, fallbackValue = "false", defaultValue = "false", - description = "if true will generate a domino-mvp backend module, default implementation is vertx." + description = "if true will generate a domino-mvp backend module, default implementation is vertx. - not supported by brix -" ) private boolean backend = false; @@ -109,7 +118,7 @@ public void run() { } module.setSubPackage(subPackage); - ModuleCreatorFactory.get(compiler, single).create(module.init()); + ModuleCreatorFactory.get(framework, compiler, single).create(module.init()); System.out.println("The following module have been created"); System.out.println(module); } catch (Exception e) { diff --git a/src/main/java/org/dominokit/cli/generator/module/Module.java b/src/main/java/org/dominokit/cli/generator/module/Module.java index 88a93eb..3f79a31 100644 --- a/src/main/java/org/dominokit/cli/generator/module/Module.java +++ b/src/main/java/org/dominokit/cli/generator/module/Module.java @@ -37,6 +37,9 @@ public String getName() { public String getModuleName(){ return NameUtil.capitalizedName(name); } + public String getModulePackage(){ + return name.toLowerCase(); + } public Project getProject() { return project; @@ -166,6 +169,7 @@ public Map context() { context.put("generateTests", generateTests); context.put("compiler", compiler); context.put("generateBackend", generateBackend); + context.put("modulePackage", getModulePackage()); return context; } @@ -184,6 +188,7 @@ public String toString() { "\n\t generateTests=" + generateTests + "\n\t compiler='" + compiler + '\'' + "\n\t generateBackend=" + generateBackend + + "\n\t modulePackage=" + getModulePackage() + '}'; } } diff --git a/src/main/java/org/dominokit/cli/generator/module/ModuleCreatorFactory.java b/src/main/java/org/dominokit/cli/generator/module/ModuleCreatorFactory.java index 31afd88..57633ee 100644 --- a/src/main/java/org/dominokit/cli/generator/module/ModuleCreatorFactory.java +++ b/src/main/java/org/dominokit/cli/generator/module/ModuleCreatorFactory.java @@ -6,10 +6,10 @@ public class ModuleCreatorFactory { - public static ModuleCreator get(String compiler, boolean single){ + public static ModuleCreator get(String projectType, String compiler, boolean single){ switch (compiler.toLowerCase()){ - case "gwt": return GWTModuleFactory.get(single); + case "gwt": return GWTModuleFactory.get(projectType, single); case "j2cl": return J2CLModuleFactory.get(single); default:throw new InvalidCompilerTypeException("Invalid compiler type : ["+compiler+"]"); } diff --git a/src/main/java/org/dominokit/cli/generator/module/gwt/BrixMultiModule.java b/src/main/java/org/dominokit/cli/generator/module/gwt/BrixMultiModule.java new file mode 100644 index 0000000..a3914a0 --- /dev/null +++ b/src/main/java/org/dominokit/cli/generator/module/gwt/BrixMultiModule.java @@ -0,0 +1,121 @@ +package org.dominokit.cli.generator.module.gwt; + +import freemarker.template.TemplateException; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; +import org.apache.commons.io.FileUtils; +import org.dominokit.cli.PomUtil; +import org.dominokit.cli.commands.PathUtils; +import org.dominokit.cli.generator.Folder; +import org.dominokit.cli.generator.Package; +import org.dominokit.cli.generator.TemplateProvider; +import org.dominokit.cli.generator.TemplatedFile; +import org.dominokit.cli.generator.exception.FailedToCreateResourceException; +import org.dominokit.cli.generator.module.Module; +import org.dominokit.cli.generator.module.ModuleCreator; + +public class BrixMultiModule implements ModuleCreator { + public void create(Module module) throws IOException { + create(module, "/module/gwt/multi/brix"); + } + + public void create(Module module, String templatesBasePath) throws IOException { + + module + .add(new Folder(module.getArtifactId()+"-frontend") + .add(new Folder("src/main") + .add(new Folder("java") + .add(new Package(module.getProject().getRootPackage()) + .add(new Package(module.getModulePackage()) + .add(new Package("presenters."+module.getSubPackage()) + .add(new TemplatedFile(module.getPrefix()+"Presenter.java", templatesBasePath + "/frontend/source/Presenter.java")) + ) + .add(new Package("tasks."+module.getSubPackage()) + .add(new TemplatedFile(module.getPrefix()+"StartupTask.java", templatesBasePath + "/frontend/source/StartupTask.java")) + ) + .add(new Package("views."+module.getSubPackage()) + .add(new TemplatedFile(module.getPrefix()+"View.java", templatesBasePath + "/frontend/source/View.java")) + ) + .add(new TemplatedFile("package-info.java", templatesBasePath + "/frontend/source/package-info.java")) + ) + ) + ) + .add(new TemplatedFile("module.gwt.xml", templatesBasePath + "/frontend/source/module.gwt.xml")) + ) + .add(new TemplatedFile("pom.xml", templatesBasePath + "/frontend/pom.ftl")) + ) + .add(new Folder(module.getArtifactId()+"-ui") + .add(new Folder("src/main") + .add(new Folder("java") + .add(new Package(module.getProject().getRootPackage()) + .add(new Package(module.getModulePackage()) + .add(new Package("ui.views") + .add(new Package(module.getSubPackage()) + .add(new TemplatedFile(module.getPrefix()+"ViewImpl.java", templatesBasePath + "/frontend-ui/source/ViewImpl.java")) + ) + ) + .add(new TemplatedFile(module.getModuleName()+"Component.java", templatesBasePath + "/frontend-ui/source/Component.java")) + .add(new TemplatedFile("package-info.java", templatesBasePath + "/frontend-ui/source/package-info.java")) + ) + ) + ) + .add(new TemplatedFile("module.gwt.xml", templatesBasePath + "/frontend-ui/source/module.gwt.xml")) + ) + .add(new TemplatedFile("pom.xml", templatesBasePath + "/frontend-ui/pom.ftl")) + ) + .add(new Folder(module.getArtifactId()+"-shared") + .add(new Folder("src/main/java") + .add(new Package(module.getProject().getRootPackage()) + .add(new Package(module.getModulePackage()) + .add(new Package("shared." + module.getSubPackage()) + .add(new TemplatedFile(module.getPrefix()+"Event.java", templatesBasePath + "/shared/source/Event.java")) + ) + ) + ) + ) + .add(new TemplatedFile("pom.xml", templatesBasePath + "/shared/pom.ftl")) + ) + .add(new TemplatedFile("pom.xml", templatesBasePath + "/pom.ftl")) + .write(Paths.get(PathUtils.getUserDir()).toString(), module.context()); + + addDependency(module); + addModule(module); + } + + private void addDependency(Module module) { + try { + String frontEndPomString = PomUtil.asString(module.getFrontendPom()); + + String frontendDependency=""; + String frontendUiDependency=""; + if (!frontEndPomString.contains("" + module.getArtifactId() + "-frontend")) { + frontendDependency = TemplateProvider.render("/module/gwt/multi/brix/frontend-dependency.ftl", module.context()); + } + if (!frontEndPomString.contains("" + module.getArtifactId() + "-ui")) { + frontendUiDependency = TemplateProvider.render("/module/gwt/multi/brix/ui-dependency.ftl", module.context()); + } + + frontEndPomString = frontEndPomString.replace("", frontendDependency+frontendUiDependency+"\t"); + FileUtils.write(module.getFrontendPom().getPomFile(), frontEndPomString, StandardCharsets.UTF_8); + + } catch (IOException | TemplateException e) { + throw new FailedToCreateResourceException("Failed to update pom dependency", e); + } + } + + private void addModule(Module module) throws IOException { + String projectPomString = PomUtil.asString(module.getProjectPom()); + + if (!projectPomString.contains("" + module.getArtifactId() + "")) { + + if (projectPomString.contains("")) { + projectPomString = projectPomString.replace("", "\t" + module.getArtifactId() + "\n\t"); + } else { + projectPomString = projectPomString.replace("", "\n\t\n\t\t" + module.getArtifactId() + "\n\t\n"); + } + FileUtils.write(module.getProjectPom().getPomFile(), projectPomString, StandardCharsets.UTF_8); + } + + } +} diff --git a/src/main/java/org/dominokit/cli/generator/module/gwt/GWTModuleFactory.java b/src/main/java/org/dominokit/cli/generator/module/gwt/GWTModuleFactory.java index 0f050b2..0b9bb11 100644 --- a/src/main/java/org/dominokit/cli/generator/module/gwt/GWTModuleFactory.java +++ b/src/main/java/org/dominokit/cli/generator/module/gwt/GWTModuleFactory.java @@ -4,10 +4,14 @@ public class GWTModuleFactory { - public static ModuleCreator get(boolean single) { - if(single){ - return new GwtSingleModule(); + public static ModuleCreator get(String type, boolean single) { + if("mvp".equals(type)) { + if (single) { + return new GwtSingleModule(); + } + return new GwtMultiModule(); + }else { + return new BrixMultiModule(); } - return new GwtMultiModule(); } } diff --git a/src/main/java/org/dominokit/cli/generator/project/gwt/GWTProjectFactory.java b/src/main/java/org/dominokit/cli/generator/project/gwt/GWTProjectFactory.java index adbdceb..0c7b14d 100644 --- a/src/main/java/org/dominokit/cli/generator/project/gwt/GWTProjectFactory.java +++ b/src/main/java/org/dominokit/cli/generator/project/gwt/GWTProjectFactory.java @@ -9,6 +9,7 @@ public static ProjectCreator get(String projectType) { switch (projectType.toLowerCase()){ case "basic" : return new GwtBasicProject(); case "mvp" : return new GwtMVPProject(); + case "brix" : return new GwtBrixProject(); default:throw new InvalidProjectTypeException("Invalid project type : ["+projectType+"]"); } } diff --git a/src/main/java/org/dominokit/cli/generator/project/gwt/GwtBrixProject.java b/src/main/java/org/dominokit/cli/generator/project/gwt/GwtBrixProject.java new file mode 100644 index 0000000..65da8de --- /dev/null +++ b/src/main/java/org/dominokit/cli/generator/project/gwt/GwtBrixProject.java @@ -0,0 +1,91 @@ +package org.dominokit.cli.generator.project.gwt; + +import java.nio.file.Paths; +import org.dominokit.cli.commands.PathUtils; +import org.dominokit.cli.generator.Folder; +import org.dominokit.cli.generator.Package; +import org.dominokit.cli.generator.ResourceFile; +import org.dominokit.cli.generator.TemplatedFile; +import org.dominokit.cli.generator.module.ApiModuleFactory; +import org.dominokit.cli.generator.project.Project; +import org.dominokit.cli.generator.project.ProjectCreator; + +public class GwtBrixProject implements ProjectCreator { + + public void create(Project project) { + project + .add(new Folder(".idea") + .add(new Folder("runConfigurations") + .add(new TemplatedFile("Frontend.xml", + "/app/gwt/brix/runConfigurations/Frontend.xml")) + .add(new TemplatedFile("Server.xml", "/app/gwt/brix/runConfigurations/Server.xml")) + .add(new TemplatedFile("Development.xml", + "/app/gwt/brix/runConfigurations/Development.xml")) + ) + ) + .add(new Folder(project.getName() + "-backend") + .add(new Folder("src/main") + .add(new Folder("docker") + .add(new TemplatedFile("Dockerfile.jvm", "/app/gwt/brix/backend/docker/Dockerfile.jvm")) + .add(new TemplatedFile("Dockerfile.legacy-jar", "/app/gwt/brix/backend/docker/Dockerfile.legacy-jar")) + .add(new TemplatedFile("Dockerfile.native", "/app/gwt/brix/backend/docker/Dockerfile.native")) + .add(new TemplatedFile("Dockerfile.native-distroless", "/app/gwt/brix/backend/docker/Dockerfile.native-distroless")) + ) + .add(new Folder("java") + .add(new Package(project.getRootPackage()) + .add(new TemplatedFile("ConfigResource.java", "/app/gwt/brix/backend/source/ConfigResource.java")) + .add(new TemplatedFile("IndexPageFilter.java", "/app/gwt/brix/backend/source/IndexPageFilter.java")) + ) + ) + .add(new Folder("resources") + .add(new TemplatedFile("application.properties", + "/app/gwt/brix/backend/resource/application.properties")) + .add(new Folder("META-INF") + .add(new Folder("resources") + .add(new ResourceFile("app.css", + "/app/gwt/brix/backend/resource/META-INF/resources/app.css")) + .add(new ResourceFile("favicon.ico", + "/app/gwt/brix/backend/resource/META-INF/resources/favicon.ico")) + .add(new ResourceFile("favicon.png", + "/app/gwt/brix/backend/resource/META-INF/resources/favicon.png")) + .add(new TemplatedFile("index.html", + "/app/gwt/brix/backend/resource/META-INF/resources/index.html")) + ) + ) + ) + ) + .add(new TemplatedFile("pom.xml", "/app/gwt/brix/backend/pom.xml")) + .add(new TemplatedFile("README.md", "/app/gwt/brix/backend/README.md")) + ) + .add(new Folder(project.getName() + "-frontend") + .add(new Folder("src/main") + .add(new Folder("assembly") + .add(new TemplatedFile("webjar.xml", "/app/gwt/brix/frontend/source/webjar.xml")) + ) + .add(new Folder("java") + .add(new Package(project.getRootPackage()) + .add(new TemplatedFile("App.java", + "/app/gwt/brix/frontend/source/App.java")) + .add(new TemplatedFile("package-info.java", + "/app/gwt/brix/frontend/source/package-info.java")) + ) + ) + .add(new TemplatedFile("module.gwt.xml", + "/app/gwt/brix/frontend/source/module.gwt.xml")) + ) + .add(new TemplatedFile("pom.xml", "/app/gwt/brix/frontend/pom.xml")) + ) + .add(new Folder(project.getName() + "-shared") + .add(new Folder("src/main/java") + .add(new Package(project.getRootPackage()) + .add(new TemplatedFile("ConfigService.java", + "/app/gwt/brix/shared/source/ConfigService.java")) + ) + ) + .add(new TemplatedFile("pom.xml", "/app/gwt/brix/shared/pom.xml")) + ) + .add(new TemplatedFile("pom.xml", "/app/gwt/brix/pom.ftl")) + .add(new TemplatedFile("README.md", "/app/gwt/brix/README.md")) + .write(Paths.get(PathUtils.getUserDir()).toString(), project.context()); + } +} diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/README.md b/src/main/resources/projects-templates/v2/app/gwt/brix/README.md new file mode 100644 index 0000000..e874d40 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/README.md @@ -0,0 +1,13 @@ +# ${name} + +### How to run + +- Build the project `mvn clean verify` + +- Super Development mode : + +In one terminal run `mvn compile quarkus:dev` or + +In another terminal run `mvn gwt:codeserver -pl *-client -am` + +- For production, follow the instructions in the backend module readme file. diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/README.md b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/README.md new file mode 100644 index 0000000..cb4e324 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/README.md @@ -0,0 +1,54 @@ +# ${name}-backend project + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: +```shell script +mvn compile quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:9090/q/dev/. + +## Packaging and running the application + +The application can be packaged using: +```shell script +mvn package +``` +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +If you want to build an _über-jar_, execute the following command: +```shell script +mvn package -Dquarkus.package.type=uber-jar +``` + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +## Creating a native executable + +You can create a native executable using: +```shell script +mvn package -Pnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: +```shell script +mvn package -Pnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/${name}-backend-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html. + +## Provided examples + +### RESTEasy JAX-RS example + +REST is easy peasy with this Hello World RESTEasy resource. + +[Related guide section...](https://quarkus.io/guides/brixtest-api#the-jax-rs-resources) diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.jvm b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.jvm new file mode 100644 index 0000000..bfea3f1 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.jvm @@ -0,0 +1,54 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# mvn package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/brixtest-api-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/brixtest-api-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/brixtest-api-jvm +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 + +ARG JAVA_PACKAGE=java-11-openjdk-headless +ARG RUN_JAVA_VERSION=1.3.8 +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' +# Install java and the run-java script +# Also set up permissions for user `1001` +RUN microdnf install curl ca-certificates \ + && microdnf update \ + && microdnf clean all \ + && mkdir /deployments \ + && chown 1001 /deployments \ + && chmod "g+rwX" /deployments \ + && chown 1001:root /deployments \ + && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh//run-java-sh--sh.sh -o /deployments/run-java.sh \ + && chown 1001 /deployments/run-java.sh \ + && chmod 540 /deployments/run-java.sh \ + && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security + +# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=1001 target/quarkus-app/*.jar /deployments/ +COPY --chown=1001 target/quarkus-app/app/ /deployments/app/ +COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT [ "/deployments/run-java.sh" ] diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.legacy-jar b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000..b9e3b7e --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.legacy-jar @@ -0,0 +1,51 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# mvn package -Dquarkus.package.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/brixtest-api-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/brixtest-api-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/brixtest-api-legacy-jar +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 + +ARG JAVA_PACKAGE=java-11-openjdk-headless +ARG RUN_JAVA_VERSION=1.3.8 +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' +# Install java and the run-java script +# Also set up permissions for user `1001` +RUN microdnf install curl ca-certificates \ + && microdnf update \ + && microdnf clean all \ + && mkdir /deployments \ + && chown 1001 /deployments \ + && chmod "g+rwX" /deployments \ + && chown 1001:root /deployments \ + && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh//run-java-sh--sh.sh -o /deployments/run-java.sh \ + && chown 1001 /deployments/run-java.sh \ + && chmod 540 /deployments/run-java.sh \ + && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security + +# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/app.jar + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT [ "/deployments/run-java.sh" ] diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native new file mode 100644 index 0000000..e4943aa --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native @@ -0,0 +1,27 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode +# +# Before building the container image run: +# +# mvn package -Pnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/brixtest-api . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/brixtest-api +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native-distroless b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native-distroless new file mode 100644 index 0000000..e92fc16 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/docker/Dockerfile.native-distroless @@ -0,0 +1,23 @@ +#### +# This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode +# +# Before building the container image run: +# +# mvn package -Pnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/brixtest-api . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/brixtest-api +# +### +FROM quay.io/quarkus/quarkus-distroless-image:1.0 +COPY target/*-runner /application + +EXPOSE 8080 +USER nonroot + +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/pom.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/pom.xml new file mode 100644 index 0000000..a82aacc --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/pom.xml @@ -0,0 +1,159 @@ + + + 4.0.0 + + ${groupId} + ${name} + ${version} + + ${name}-backend + + + 3.8.1 + true + 11 + 11 + UTF-8 + UTF-8 + 2.16.7.Final + quarkus-universe-bom + io.quarkus + 3.6.5 + 3.0.0-M5 + + + + + ${r"${quarkus.platform.group-id}"} + ${r"${quarkus.platform.artifact-id}"} + ${r"${quarkus.platform.version}"} + pom + import + + + + + + ${groupId} + ${name}-frontend + ${r"${project.version}"} + webjar + + + org.dominokit + domino-ui-webjar + ${r"${domino.ui.version}"} + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-resteasy-reactive + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + io.quarkus + quarkus-resteasy-reactive-jackson + + + ${groupId} + ${name}-shared + ${r"${project.version}"} + + + io.quarkus + quarkus-webjars-locator + + + + + + io.quarkus + quarkus-maven-plugin + 3.6.5 + true + + + + build + generate-code + generate-code-tests + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${r"${compiler-plugin.version}"} + + ${r"${maven.compiler.parameters}"} + + + + org.apache.maven.plugins + maven-surefire-plugin + ${r"${surefire-plugin.version}"} + + + org.jboss.logmanager.LogManager + ${r"${maven.home}"} + + + + + + + + native + + + native + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${r"${surefire-plugin.version}"} + + + + integration-test + verify + + + + + ${r"${project.build.directory}"}/${r"${project.build.finalName}"}-runner + + org.jboss.logmanager.LogManager + + ${r"${maven.home}"} + + + + + + + + + native + + + + diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/app.css b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/app.css new file mode 100644 index 0000000..ae9cc47 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/app.css @@ -0,0 +1 @@ +/*------------- Application specific styles ------------------*/ \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/favicon.ico b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/favicon.ico new file mode 100755 index 0000000000000000000000000000000000000000..b5657c7b52996bb1038d6bd685d13c863d753406 GIT binary patch literal 15406 zcmeHN4Qv$072cR8v{j`-@Y&|}_iTfWf%BO&_$RSBlJb|t34{hUP3%%qwGGgUAhk(o zQjw%Y0%EnHO0c5{(o`}kv4n%10IgyN8`&l;polh90@31Bw8DjoPzTjq?)AOd8#A}J zcei)9PSWaD8qeH#=DqK|`DXU*%t+Er(j;lh6bW-f`u-OrX@Mk3hGG6LpDIbau`UpZ z{(q(<4R|D}9NS|xep_Gv#ip+ZWIA4SvujtN*&wLcaXmK0Fu($dn&va0Wub-gZ` zFh$e;Y1bF)y4S7W07h}im1Huo-M1iCurgFlfjm>f45WclGB3%7FXU zdL!#LF#HMoit=7Ql7E2u?tlLt*gaUnWZb*fJCaDR*q6#L9hugG{ll*g7|_=5fo)wL z2-cTIWL16C+E)CH@|W`8Tn6=>Q?0^xzWY7UeZ@&-;22+26lEos@$*B|nyc!3;YZi4 zXPoc{0`O3Cb3{?}@ix3I7 z-*_;LTu9iLWFY=laq{eQOVPiZ&mruFQN&Q2(uSqA8bj4|L^byn2xL^rkf2dZHAp4ZqrEgL_e{eR*5 zo$BW8D~M@OIFJfe1F2vwr&N|N$EK(Q{BAk`S8@!Pjme{oa&}_81I}-G{;Ey zuD<*;6iXlmAPjLn7v?MSFfH9ozhQ(Zw?3k7(r?AkurLI}!^1FZ_MD9Dw(1jq+v&Dq zpjeLL5{xZq{-tfVs81~0>25#jW%gS!u(5Da_m(YE9>$yRb3Hu2Hg*XPoVq^_L&IH4 zmx$esGV*K@>K)~}DepYF7+$gXpyl!D7)xr`F}{1i4ZWfaI}9Qo(oMc!P+JGtVkjyy z3{f{PC&IvWFJ8I~!r?IEe>NDJ?8R2z*ODE1B*H7zc5mtJ7D=FoAVsffSS^p@~v2pc8UW&I36Qr1C&sMMcFe(RlK6^RC4`qfU%{{)5SO-_8%{QQ*6A29Zc^6#IxE^JB7MqQ(JZ<{m+po$noUhGVC1!mmHD8h*I( zF*@f18V5z!e>4#`V9ef^2!AG=Az8GK)&166Fg7*@)eCBvPbP{>IL`(W;Ln&dqn0(8J9zw=%%ygInv81;1m?%wMR{8p+m~+Zz|c2=1Be@9JXb>V&oH%{N)y zZ4C{~h8?Y~aOu(|+}r*sx9MX%gWenr2D5q>3iusyX5T((Qd@t1)6RE17eh@-MDyt| zqpS>$^!35E?K{{R2<-=N+rFLEu`?N*)89njpEz*>Xn)8Y6a3a!lu)8|*l9iCPlq#v zo$uqfc6%bUk54ubXW0IAbnn6Xn=lJ|ZKvG8PB!9uX~^ljsjYu1VIL9qU&#g<2hMW` z`6=AznCH~LsoLTD_xV&Y0q2YrJGbMP@0d2wI1ql?!~DgIFT&8VV=%LP7Uw(W?r=u5 z3CA(z`IN{Rj@g=vTq;A%yZ7vY4^E$kdC|KTXqRi85%H%g+i}KdkGyOjmXWEVy#+<=$8?0QK2+lacpNup6PK4n2a4Y=gc!RACH@KvICY)*i zgLE_An>xvTYRw1FZGlK648K3W-4;K!f4sdgTpdy#apJ3qXtT4Ypb~MM#uTyQ|Mh!* z=s)`e>=~S4i+}4I1yH|4A>Lp0s_GKNhqnqp-G|N}qi0TJgDpThx z)Gan+x4HPfjg588Scv1N@A$yHAVkkRU0aug_#e+)**G}j(lZ^N4>biTg*V(S`_d zJ<)kM=THT|AEfCY;r-lA*eQ6?r1KQT z2&v|MYgg785wlqKcsyUhefcTYL~$v`6Sv}BlxdXk+$+DRsK`TQNpiI3N4O^xyJ$zQ Uoby1=133@mJdpFi=fwm61?r0d*Z=?k literal 0 HcmV?d00001 diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/favicon.png b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/META-INF/resources/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..a3881fd6693ae1864d51d10acacc78c1f3d32168 GIT binary patch literal 548 zcmV+<0^9wGP)JMKDeJ%HMBf4J(Jqo z`?7u3WDC8JL4a!)#R3shk|c@sdL4uaTNbmskc%Uj4kr&gor4=M9*jMC_a=TTCa$lq z;l{)SG)?2%TZN_axjPR)QIt7K>85KtSa`Wi1R+I^8sgQb?-9QpLq4D9%(fpS>lJUzw!2I27~yF-oa^ zX$p}@WV}=={YG{rAdUJnAUpxi;ZJY!#gP!nWwX>`&TKEl<3LqHJ3h-^)N3{KALL3V z@b*(YQmhex!!%7yN|Tft)h?tjM$TdQEOy6*MCYRce!w!Cb~EAH)^#1StTc*Wzs;2l z<8$8*R8>ACK#+5M??R%{0JEBzWb$4jm&-P6hutlgjopDMgjM+`fGM}w2Wg$9Az-Cf md}#{j^v-zve+M`8HU0&1OY{+Qnm!Ex0000 + + + + + + + + + + + + + + + + + + + + ${name} + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/application.properties b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/application.properties new file mode 100644 index 0000000..44ad0fb --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/resource/application.properties @@ -0,0 +1,7 @@ +quarkus.http.port=8080 +quarkus.http.cors=true +quarkus.http.cors.methods=* +quarkus.http.cors.origins=* +brix.dev.web.root=../target/gwt/launcherDir +brix.application.root=${name} +brix.api.url=http://localhost:${quarkus.http.port}/api/ \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/ConfigResource.java b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/ConfigResource.java new file mode 100644 index 0000000..94561e9 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/ConfigResource.java @@ -0,0 +1,25 @@ +package ${rootPackage}; + +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import java.util.HashMap; +import java.util.Map; +import org.eclipse.microprofile.config.ConfigProvider; + +@Path("/api/config") +public class ConfigResource { + + public static final String BRIX_APPLICATION_ROOT = "brix.application.root"; + + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public Map getConfig(){ + Map config = new HashMap<>(); + config.put(BRIX_APPLICATION_ROOT, ConfigProvider.getConfig().getValue(BRIX_APPLICATION_ROOT, String.class)); + return config; + } +} diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/IndexPageFilter.java b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/IndexPageFilter.java new file mode 100644 index 0000000..c1be95d --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/backend/source/IndexPageFilter.java @@ -0,0 +1,42 @@ +package ${rootPackage}; + +import io.quarkus.runtime.StartupEvent; +import io.quarkus.runtime.configuration.ConfigUtils; +import io.vertx.ext.web.Router; +import io.vertx.ext.web.handler.FileSystemAccess; +import io.vertx.ext.web.handler.StaticHandler; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.event.Observes; +import jakarta.inject.Inject; +import java.nio.file.Paths; +import org.eclipse.microprofile.config.inject.ConfigProperty; + +@ApplicationScoped +public class IndexPageFilter { + @Inject + Router router; + + @ConfigProperty(name = "brix.dev.web.root") + String brixDevWebRoot; + @ConfigProperty(name = "brix.application.root") + String brixAppRoot; + + void init(@Observes StartupEvent ev) { + + router.route("/"+brixAppRoot+"/*") + .handler(routingContext -> routingContext.reroute("/")); + + StaticHandler webRootStaticHandler = + StaticHandler.create(FileSystemAccess.ROOT, systemWebRoot()); + + if (ConfigUtils.getProfiles().contains("dev")) { + router + .route("/*") + .handler(webRootStaticHandler); + } + } + + private String systemWebRoot() { + return Paths.get(brixDevWebRoot).toAbsolutePath().toString(); + } +} diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/pom.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/pom.xml new file mode 100644 index 0000000..91d7956 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/pom.xml @@ -0,0 +1,108 @@ + + + 4.0.0 + + + ${groupId} + ${name} + ${version} + + + ${name}-frontend + gwt-app + + + ${r"${project.build.outputDirectory}"}/META-INF/resources/webjars/domino-ui + + + + + ${groupId} + ${name}-shared + ${r"${project.version}"} + + + ${groupId} + ${name}-shared + ${r"${project.version}"} + sources + + + org.gwtproject + gwt-user + + + org.gwtproject + gwt-dev + + + + org.dominokit + domino-brix-client + + + com.google.dagger + dagger-compiler + provided + + + com.google.auto.service + auto-service + provided + + + org.dominokit + domino-brix-processor + provided + + + org.dominokit + domino-auto-processor + provided + + + + org.dominokit + domino-ui + + + org.dominokit + domino-ui + sources + + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + make-assembly + package + + single + + + + src/main/assembly/webjar.xml + + + + + + + net.ltgt.gwt.maven + gwt-maven-plugin + + ${rootPackage}.App + app + + + + + diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/App.java b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/App.java new file mode 100644 index 0000000..5803f28 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/App.java @@ -0,0 +1,57 @@ +package ${rootPackage}; + +import com.google.gwt.core.client.EntryPoint; +import org.dominokit.brix.Brix; +import org.dominokit.brix.api.BrixComponentInitializer; +import org.dominokit.brix.api.BrixComponentInitializer_ServiceLoader; +import org.dominokit.domino.ui.style.DominoCss; +import org.dominokit.domino.ui.utils.ElementsFactory; +import org.dominokit.domino.ui.themes.DominoThemeAccent; +import org.dominokit.domino.ui.themes.DominoThemeDefault; +import org.dominokit.domino.ui.themes.DominoThemeLight; +import org.dominokit.domino.ui.themes.DominoThemeManager; +import org.dominokit.rest.DominoRestConfig; + +/** + * Entry point classes define onModuleLoad(). + */ +public class App implements EntryPoint, ElementsFactory, DominoCss { + /** + * This is the entry point method. + */ + public void onModuleLoad() { + + BrixComponentInitializer_ServiceLoader.load() + .forEach(BrixComponentInitializer::init); + + DominoRestConfig.initDefaults() + .setDefaultServiceRoot("http://localhost:8080/api/"); + + DominoThemeManager.INSTANCE.apply(DominoThemeDefault.INSTANCE); + DominoThemeManager.INSTANCE.apply(DominoThemeLight.INSTANCE); + DominoThemeManager.INSTANCE.apply(DominoThemeAccent.TEAL); + + ConfigServiceFactory.INSTANCE.configs() + .onSuccess(response -> { + Brix.get().init(response); + Brix.get().start(() -> { + Brix.get().config().get("brix.application.root") + .ifPresent(appRoot -> { + Brix.get().router().setRootPath(appRoot); + }); + + Brix.get().config().get("brix.api.url") + .ifPresent(apiUrl -> { + DominoRestConfig.initDefaults() + .setDefaultServiceRoot(apiUrl); + }); + + Brix.get().router().fireCurrentStateHistory(); + }); + }) + .onFailed(failedResponse -> { + }) + .send(); + + } +} diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/module.gwt.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/module.gwt.xml new file mode 100644 index 0000000..b446c6c --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/module.gwt.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/package-info.java b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/package-info.java new file mode 100644 index 0000000..68dd55a --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/package-info.java @@ -0,0 +1,4 @@ +@DominoAuto(include = {"org.dominokit.brix"}) +package ${rootPackage}; + +import org.dominokit.auto.DominoAuto; \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/webjar.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/webjar.xml new file mode 100644 index 0000000..cc762bf --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/frontend/source/webjar.xml @@ -0,0 +1,18 @@ + + webjar + / + + jar + + + + ${r"${project.build.directory}"}/${r"${artifactId}"}-${r"${project.version}"} + META-INF/resources + + **/* + + + + diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/pom.ftl b/src/main/resources/projects-templates/v2/app/gwt/brix/pom.ftl new file mode 100644 index 0000000..0104d43 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/pom.ftl @@ -0,0 +1,176 @@ + + + 4.0.0 + + <#if hasParent> + + + ${groupId} + ${parentArtifactId} + ${version} + + ${artifactId} + + <#else> + + ${groupId} + ${artifactId} + ${version} + + + pom + + + 11 + 11 + UTF-8 + UTF-8 + + 4.7.7.Final + + ${gwt_version} + ${domino_rest_version} + ${domino_ui_version} + ${domino_jackson_version} + ${domino_auto_version} + ${domino_brix_version} + + + + + + org.gwtproject + gwt + ${r"${gwt.version}"} + pom + import + + + javax.servlet + javax.servlet-api + 3.1.0 + + + org.dominokit + domino-brix-client + ${r"${domino.brix.version}"} + + + org.dominokit + domino-brix-shared + ${r"${domino.brix.version}"} + + + com.google.dagger + dagger-compiler + 2.49 + provided + + + com.google.auto.service + auto-service + 1.1.1 + provided + + + org.dominokit + domino-brix-processor + ${r"${domino.brix.version}"} + provided + + + + org.dominokit + domino-ui + ${r"${domino.ui.version}"} + + + org.dominokit + domino-ui + ${r"${domino.ui.version}"} + sources + + + org.dominokit + domino-auto-processor + ${r"${domino.auto.version}"} + provided + + + + + + + + net.ltgt.gwt.maven + gwt-maven-plugin + false + + ${r"${project.build.directory}"}/gwt/launcherDir + + + + + + + org.apache.maven.plugins + maven-install-plugin + 2.5.2 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + ${r"${maven.compiler.source}"} + ${r"${maven.compiler.target}"} + + -AdominoAutoInclude=org.dominokit.brix + + + + + org.eclipse.jetty + jetty-maven-plugin + 9.4.44.v20210927 + + + net.ltgt.gwt.maven + gwt-maven-plugin + 1.1.0 + true + + ${r"${maven.compiler.source}"} + true + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-sources + package + + jar-no-fork + + + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + + + + + + ${name}-backend + ${name}-frontend + ${name}-shared + + diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Development.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Development.xml new file mode 100644 index 0000000..5ef5159 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Development.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Frontend.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Frontend.xml new file mode 100644 index 0000000..70cfa29 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Frontend.xml @@ -0,0 +1,30 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Server.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Server.xml new file mode 100644 index 0000000..49f0616 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/runConfigurations/Server.xml @@ -0,0 +1,39 @@ + + + + + + + + + true + + + + + \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/shared/pom.xml b/src/main/resources/projects-templates/v2/app/gwt/brix/shared/pom.xml new file mode 100644 index 0000000..fc8c612 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/shared/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + + ${groupId} + ${name} + ${version} + + + ${name}-shared + + + + org.dominokit + domino-brix-shared + + + org.dominokit + domino-rest-client + ${r"${domino.rest.version}"} + + + org.dominokit + domino-rest-processor + ${r"${domino.rest.version}"} + + + + + + + src/main/java + + + + + org.apache.maven.plugins + maven-source-plugin + + + + diff --git a/src/main/resources/projects-templates/v2/app/gwt/brix/shared/source/ConfigService.java b/src/main/resources/projects-templates/v2/app/gwt/brix/shared/source/ConfigService.java new file mode 100644 index 0000000..43e14a2 --- /dev/null +++ b/src/main/resources/projects-templates/v2/app/gwt/brix/shared/source/ConfigService.java @@ -0,0 +1,20 @@ +package ${rootPackage}; + +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.MediaType; +import java.util.Map; +import org.dominokit.rest.shared.request.service.annotations.RequestFactory; + +@RequestFactory +@Path("config") +public interface ConfigService { + + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + Map configs(); + +} diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-dependency.ftl b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-dependency.ftl new file mode 100644 index 0000000..a87cd28 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-dependency.ftl @@ -0,0 +1,11 @@ + + ${groupId} + ${artifactId}-frontend + ${r"${project.version}"} + + + ${groupId} + ${artifactId}-frontend + ${r"${project.version}"} + sources + diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/pom.ftl b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/pom.ftl new file mode 100644 index 0000000..88beb0f --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/pom.ftl @@ -0,0 +1,99 @@ + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${artifactId}-ui + ${artifactId}-ui + gwt-lib + + + + + com.google.gwt + gwt-user + + + com.google.gwt + gwt-dev + + + org.dominokit + domino-brix-client + + + org.dominokit + domino-brix-shared + + + + org.dominokit + domino-brix-processor + provided + + + org.dominokit + domino-ui + + + org.dominokit + domino-ui + sources + + + + com.google.dagger + dagger-compiler + 2.49 + provided + + + + ${groupId} + ${artifactId}-shared + ${r"${project.version}"} + + + + ${groupId} + ${artifactId}-shared + ${r"${project.version}"} + sources + + + ${groupId} + ${artifactId}-frontend + ${r"${project.version}"} + + + ${groupId} + ${artifactId}-frontend + ${r"${project.version}"} + sources + + + + + + + + net.ltgt.gwt.maven + gwt-maven-plugin + + ${rootPackage}.${subpackage}.${moduleName}UI + ${moduleName} + + + + org.apache.maven.plugins + maven-source-plugin + + + + + diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/Component.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/Component.java new file mode 100644 index 0000000..233fbc0 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/Component.java @@ -0,0 +1,16 @@ +package ${rootPackage}.${modulePackage}; + +import dagger.Component; +import javax.inject.Singleton; +import org.dominokit.brix.Brix; +import org.dominokit.brix.ModuleComponent; + +@Singleton +@Component(modules = {Brix${moduleName}BindingModule_.class, Brix${moduleName}Module_.class, Brix${moduleName}UIBindingModule_.class}) +public interface ${moduleName}Component extends ModuleComponent { + static ModuleComponent getInstance() { + return Dagger${moduleName}Component.builder() + .brix${moduleName}Module_(Brix${moduleName}Module__Factory.newInstance(Brix.get().getCoreComponent())) + .build(); + } +} diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/ViewImpl.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/ViewImpl.java new file mode 100644 index 0000000..667d811 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/ViewImpl.java @@ -0,0 +1,27 @@ +package ${rootPackage}.${modulePackage}.ui.views.${subpackage}; + +import static org.dominokit.domino.ui.utils.ElementsFactory.elements; + +import elemental2.dom.HTMLDivElement; +import javax.inject.Inject; +import org.dominokit.brix.annotations.UiView; +import org.dominokit.brix.impl.BrixView; +import org.dominokit.domino.ui.elements.DivElement; +import ${rootPackage}.${modulePackage}.views.${subpackage}.${prefix}View; + +@UiView +public class ${prefix}ViewImpl extends BrixView implements ${prefix}View { + + private DivElement root; + + @Inject + public ${prefix}ViewImpl() { + this.root = elements.div(); + init(this); + } + + @Override + public HTMLDivElement element() { + return root.element(); + } +} diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/module.gwt.xml b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/module.gwt.xml new file mode 100644 index 0000000..a6574fc --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/module.gwt.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/package-info.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/package-info.java new file mode 100644 index 0000000..57bd142 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend-ui/source/package-info.java @@ -0,0 +1,4 @@ +@BrixModule(value = "${moduleName}UI", component = ${moduleName}Component.class) +package ${rootPackage}.${modulePackage}; + +import org.dominokit.brix.annotations.BrixModule; \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/pom.ftl b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/pom.ftl new file mode 100644 index 0000000..090a768 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/pom.ftl @@ -0,0 +1,86 @@ + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${artifactId}-frontend + ${artifactId}-frontend + gwt-lib + + + + org.dominokit + domino-brix-shared + + + com.google.gwt + gwt-user + + + com.google.gwt + gwt-dev + + + org.dominokit + domino-brix-client + + + org.dominokit + domino-brix-processor + ${r"${domino.brix.version}"} + provided + + + org.dominokit + domino-rest-client + ${r"${domino.rest.version}"} + + + org.dominokit + domino-rest-processor + ${r"${domino.rest.version}"} + + + ${groupId} + ${artifactId}-shared + ${r"${project.version}"} + + + ${groupId} + ${artifactId}-shared + ${r"${project.version}"} + sources + + + + com.google.dagger + dagger-compiler + 2.49 + provided + + + + + + + + net.ltgt.gwt.maven + gwt-maven-plugin + + ${rootPackage}.${subpackage}.${moduleName} + ${moduleName} + + + + org.apache.maven.plugins + maven-source-plugin + + + + + diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/Presenter.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/Presenter.java new file mode 100644 index 0000000..b850ada --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/Presenter.java @@ -0,0 +1,24 @@ +package ${rootPackage}.${modulePackage}.presenters.${subpackage}; + +import org.dominokit.brix.annotations.BrixPresenter; +import org.dominokit.brix.annotations.BrixRoute; +import org.dominokit.brix.annotations.BrixSlot; +import org.dominokit.brix.annotations.OnActivated; +import org.dominokit.brix.api.BrixSlots; +import org.dominokit.brix.api.Presenter; +import ${rootPackage}.${modulePackage}.views.${subpackage}.${prefix}View; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@BrixPresenter +@BrixRoute("${token}") +@BrixSlot(BrixSlots.BRIX_BODY_SLOT) +public abstract class ${prefix}Presenter extends Presenter<${prefix}View> implements ${prefix}View.${prefix}UiHandlers { + + private static final Logger LOGGER = LoggerFactory.getLogger(${prefix}Presenter.class); + + @OnActivated + public void on${prefix}Activated(){ + LOGGER.info("${prefix} presenter activated."); + } +} diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/StartupTask.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/StartupTask.java new file mode 100644 index 0000000..b736166 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/StartupTask.java @@ -0,0 +1,23 @@ +package ${rootPackage}.${modulePackage}.tasks.${subpackage}; + +import org.dominokit.brix.annotations.Task; +import org.dominokit.brix.api.StartupTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Task +public class ${prefix}StartupTask extends StartupTask { + + private static final Logger LOGGER = LoggerFactory.getLogger(${prefix}StartupTask.class); + + @Override + public void run() { + LOGGER.info("Running ${moduleName} task."); + complete(); + } + + @Override + public int order() { + return 0; + } +} diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/View.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/View.java new file mode 100644 index 0000000..27911d1 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/View.java @@ -0,0 +1,10 @@ +package ${rootPackage}.${modulePackage}.views.${subpackage}; + +import org.dominokit.brix.api.UiHandlers; +import org.dominokit.brix.api.Viewable; + +public interface ${prefix}View extends Viewable { + + interface ${prefix}UiHandlers extends UiHandlers { + } +} diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/module.gwt.xml b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/module.gwt.xml new file mode 100644 index 0000000..f1e58ab --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/module.gwt.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/package-info.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/package-info.java new file mode 100644 index 0000000..652ba11 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/frontend/source/package-info.java @@ -0,0 +1,4 @@ +@BrixModule("${moduleName}") +package ${rootPackage}.${modulePackage}; + +import org.dominokit.brix.annotations.BrixModule; \ No newline at end of file diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/pom.ftl b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/pom.ftl new file mode 100644 index 0000000..41ec054 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/pom.ftl @@ -0,0 +1,20 @@ + + + 4.0.0 + + + ${groupId} + ${rootArtifactId} + ${version} + + + ${artifactId} + pom + + + ${artifactId}-frontend + ${artifactId}-shared + ${artifactId}-ui + + + diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/pom.ftl b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/pom.ftl new file mode 100644 index 0000000..464e8cb --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/pom.ftl @@ -0,0 +1,58 @@ + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${artifactId}-shared + ${artifactId}-shared + jar + + + + org.dominokit + domino-brix-shared + + + org.dominokit + domino-rest-client + ${r"${domino.rest.version}"} + + + org.dominokit + domino-rest-processor + ${r"${domino.rest.version}"} + + + + ${groupId} + ${rootArtifactId}-shared + ${r"${project.version}"} + + + ${groupId} + ${rootArtifactId}-shared + ${r"${project.version}"} + sources + + + + + + + + src/main/java + + + + + org.apache.maven.plugins + maven-source-plugin + + + + diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/source/Event.java b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/source/Event.java new file mode 100644 index 0000000..1f66f37 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/shared/source/Event.java @@ -0,0 +1,7 @@ +package ${rootPackage}.${modulePackage}.shared.${subpackage}; + +import org.dominokit.brix.events.BrixEvent; + +public class ${prefix}Event extends BrixEvent { + +} diff --git a/src/main/resources/projects-templates/v2/module/gwt/multi/brix/ui-dependency.ftl b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/ui-dependency.ftl new file mode 100644 index 0000000..8aeffa9 --- /dev/null +++ b/src/main/resources/projects-templates/v2/module/gwt/multi/brix/ui-dependency.ftl @@ -0,0 +1,11 @@ + + ${groupId} + ${artifactId}-ui + ${r"${project.version}"} + + + ${groupId} + ${artifactId}-ui + ${r"${project.version}"} + sources + diff --git a/src/test/java/Test.java b/src/test/java/Test.java index b12356a..449719a 100644 --- a/src/test/java/Test.java +++ b/src/test/java/Test.java @@ -22,7 +22,6 @@ public static void main(String[] args) { e.printStackTrace(); } - CommandLine commandLine = new CommandLine(new DominoCommand()); String[] appArgs = new String[]{"gen", "app", "-t", "basic", "-n", "basic-gwt", "-g", "org.dominokit.samples", "-d", "./out/creator"}; commandLine.execute(appArgs); @@ -31,6 +30,10 @@ public static void main(String[] args) { appArgs = new String[]{"gen", "app", "-t", "basic", "-n", "basic-j2cl", "-g", "org.dominokit.samples", "-c", "j2cl", "-d", "./out/creator" }; commandLine.execute(appArgs); + commandLine = new CommandLine(new DominoCommand()); + appArgs = new String[]{"gen", "app", "-t", "brix", "-n", "dominodo", "-g", "org.dominokit.samples", "-c", "gwt", "-d", "./out/creator" }; + commandLine.execute(appArgs); + commandLine = new CommandLine(new DominoCommand()); appArgs = new String[]{"gen", "app", "-n", "mvp-gwt", "-g", "org.dominokit.samples", "-d", "./out/creator" }; commandLine.execute(appArgs); @@ -52,5 +55,16 @@ public static void main(String[] args) { moduleArgs = new String[]{"gen", "module", "-n", "contacts", "-sp", "contacts","-p", "groups", "-t", "-d", "./out/creator/mvp-gwt"}; commandLine.execute(moduleArgs); + + PathUtils.setWorkingDir("./out/creator/dominodo"); + moduleArgs = new String[]{"gen", "module", "-n", "shell", "-sp", "layout","-p", "Layout", "-f", "brix", "-d", "./out/creator/dominodo"}; + commandLine.execute(moduleArgs); + moduleArgs = new String[]{"gen", "module", "-n", "shell", "-sp", "layout","-p", "Menu", "-f", "brix", "-d", "./out/creator/dominodo"}; + commandLine.execute(moduleArgs); + + moduleArgs = new String[]{"gen", "module", "-n", "backlog", "-sp", "issues","-p", "Issues", "-f", "brix", "-d", "./out/creator/dominodo"}; + commandLine.execute(moduleArgs); + moduleArgs = new String[]{"gen", "module", "-n", "backlog", "-sp", "milestones","-p", "Milestones", "-f", "brix", "-d", "./out/creator/dominodo"}; + commandLine.execute(moduleArgs); } }