Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
Signed-off-by: tvallin <[email protected]>
  • Loading branch information
tvallin committed Nov 15, 2023
1 parent 9ab1bab commit e22def0
Show file tree
Hide file tree
Showing 33 changed files with 2,019 additions and 1,804 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,26 @@
<archetype-script xmlns="https://helidon.io/archetype/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://helidon.io/archetype/2.0 https://helidon.io/xsd/archetype-2.0.xsd">

<exec src="multi-module.xml"/>
<methods>
<method name="module-dir-noop-transformation">
<output if="!${multi-module}">
<!-- if not multi-module, define module-dir as a no-op -->
<transformation id="module-dir">
<replace regex="" replacement=""/>
</transformation>
</output>
</method>
<method name="module-dir-transformation">
<output if="${multi-module}">
<!-- prepend module-dir -->
<transformation id="module-dir">
<replace regex="^(.*)$" replacement="${module-dir}/$1"/>
</transformation>
</output>
</method>
</methods>
<call method="module-dir-noop-transformation"/>
<call method="module-dir-transformation"/>
<output>
<transformation id="mustache">
<replace regex="\.mustache$" replacement=""/>
Expand Down Expand Up @@ -51,6 +69,7 @@
</templates>
<model>
<value key="dot-helidon-schema-version">1.1.0</value>
<value key="module-dir">${module-dir}</value>
<list key="dependencies">
<map>
<value key="groupId">io.helidon.logging</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,12 @@
<step name="Customize Project" optional="true">
<inputs>
<enum id="build-system" name="Select a Build System" default="maven" optional="true">
<option value="maven" name="Apache Maven">
<output>
<templates engine="mustache" transformations="mustache,module-dir">
<directory>files</directory>
<includes>
<include>pom.xml.mustache</include>
</includes>
</templates>
</output>
</option>
<option value="maven" name="Apache Maven"/>
</enum>
<text id="groupId" name="Project groupId" optional="true" default="com.examples"/>
<text id="artifactId" name="Project artifactId" optional="true" default="myproject"/>
<text id="version" name="Project version" optional="true" default="1.0-SNAPSHOT"/>
<text id="package" name="Java package name" optional="true" default="com.example.myproject"/>
</inputs>
<output>
<model>
<value key="parent-groupId" if="!${multi-module}">io.helidon.applications</value>
<value key="parent-version" if="!${multi-module}">${helidon-version}</value>
<value key="remote-parent-pom" if="!${multi-module}">true</value>
<value key="artifactId" if="!${multi-module}">${artifactId}</value>
<value key="groupId">${groupId}</value>
<value key="project-version">${version}</value>
<value key="package">${package}</value>
</model>
</output>
</step>
</archetype-script>
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,27 @@
xsi:schemaLocation="https://helidon.io/archetype/2.0 https://helidon.io/xsd/archetype-2.0.xsd">

<methods>
<method name="module-dir-noop-transformation">
<output if="!${multi-module}">
<!-- if not multi-module, define module-dir as a no-op -->
<transformation id="module-dir">
<replace regex="" replacement=""/>
</transformation>
</output>
</method>
<method name="module-dir-transformation">
<output if="${multi-module}">
<!-- prepend module-dir -->
<transformation id="module-dir">
<replace regex="^(.*)$" replacement="${module-dir}/$1"/>
</transformation>
<method name="maven">
<output if="${build-system} == 'maven'">
<templates engine="mustache" transformations="mustache,module-dir">
<directory>files</directory>
<includes>
<include>pom.xml.mustache</include>
</includes>
</templates>
</output>
</method>
</methods>
<call method="module-dir-noop-transformation"/>
<call method="module-dir-transformation"/>
<call method="maven"/>
<output>
<model>
<value key="module-dir">${module-dir}</value>
<value key="parent-groupId" if="!${multi-module}">io.helidon.applications</value>
<value key="parent-version" if="!${multi-module}">${helidon-version}</value>
<value key="remote-parent-pom" if="!${multi-module}">true</value>
<value key="artifactId" if="!${multi-module}">${artifactId}</value>
<value key="groupId">${groupId}</value>
<value key="project-version">${version}</value>
<value key="package">${package}</value>
</model>
</output>
</archetype-script>
42 changes: 42 additions & 0 deletions archetypes/helidon/src/main/archetype/common/docker-inputs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022, 2023 Oracle and/or its affiliates.
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.
-->
<archetype-script xmlns="https://helidon.io/archetype/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://helidon.io/archetype/2.0 https://helidon.io/xsd/archetype-2.0.xsd">

<inputs>
<boolean id="docker"
name="Docker support"
description="Add a Dockerfile to your project"
default="false"
optional="true">
<inputs>
<boolean id="native-image"
name="GraalVM Native Image Support"
description="Add a native-image capable Dockerfile to your project"
default="false"
optional="true"/>
<boolean id="jlink-image" name="JLink Support"
description="Add a JLink capable Dockerfile to your project"
default="false"
optional="true"/>
</inputs>
</boolean>
</inputs>
</archetype-script>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022, 2023 Oracle and/or its affiliates.
Copyright (c) 2023 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -20,91 +20,49 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://helidon.io/archetype/2.0 https://helidon.io/xsd/archetype-2.0.xsd">

<inputs>
<boolean id="docker"
name="Docker support"
description="Add a Dockerfile to your project"
default="false"
optional="true">
<inputs>
<boolean id="native-image"
name="GraalVM Native Image Support"
description="Add a native-image capable Dockerfile to your project"
default="false"
optional="true">
<output>
<templates engine="mustache" transformations="mustache,native-image">
<directory>files</directory>
<includes>
<include>src/*/resources/META-INF/**/*.mustache</include>
</includes>
</templates>
</output>
</boolean>
<boolean id="jlink-image" name="JLink Support"
description="Add a JLink capable Dockerfile to your project"
default="false"
optional="true"/>
</inputs>
<output>
<files>
<methods>
<method name="native-image">
<output if="${native-image}">
<templates engine="mustache" transformations="mustache,native-image">
<directory>files</directory>
<includes>
<include>.dockerignore</include>
<include>src/*/resources/META-INF/**/*.mustache</include>
</includes>
</files>
</templates>
<templates engine="mustache" transformations="mustache">
<directory>files</directory>
<includes>
<include>Dockerfile.mustache</include>
<include if="${native-image}">Dockerfile.native.mustache</include>
<include if="${jlink-image}">Dockerfile.jlink.mustache</include>
<include>Dockerfile.native.mustache</include>
</includes>
</templates>
<model>
<list key="poms" if="!${multi-module}">
<value>ADD pom.xml .</value>
</list>
<list key="src-dirs" if="!${multi-module}">
<value>ADD src src</value>
</list>
<list key="native-sections" if="${docker.native-image}">
<value file="files/README.native.md"/>
</list>
<list key="readme-sections">
<value order="50" template="mustache">
<![CDATA[
## Building the Docker Image
```
docker build -t {{artifactId}} .
```
## Running the Docker Image
{{#docker-run-readme-section}}
{{.}}
{{/docker-run-readme-section}}
{{^docker-run-readme-section}}
```
docker run --rm -p 8080:8080 {{artifactId}}:latest
```
{{/docker-run-readme-section}}
Exercise the application as described above.
]]>
</value>
<value template="mustache" if="${native-image}">
<![CDATA[
<value template="mustache"><![CDATA[
## Building a Native Image
{{#native-sections}}
{{.}}
{{/native-sections}}
]]>
</value>
<value order="40" template="mustache" if="${jlink-image}">
<![CDATA[
</list>
</model>
</output>
</method>
<method name="jlink-image">
<output if="${jlink-image}">
<templates engine="mustache" transformations="mustache">
<directory>files</directory>
<includes>
<include>Dockerfile.jlink.mustache</include>
</includes>
</templates>
<model>
<list key="readme-sections">
<value order="40" template="mustache"><![CDATA[
## Building a Custom Runtime Image
Build the custom runtime image using the jlink image profile:
Expand Down Expand Up @@ -138,15 +96,62 @@ mvn package -Pjlink-image -Djlink.image.addClassDataSharingArchive=false
```
For more information on available configuration options see the helidon-maven-plugin documentation.
]]>
]]>
</value>
</list>
<list key="docker-phase1-options" if="${~flavor} == 'mp'">
<value>-Declipselink.weave.skip</value>
<value>-DskipOpenApiGenerate</value>
</list>
</model>
</output>
</boolean>
</inputs>
</method>
</methods>
<call method="native-image"/>
<call method="jlink-image"/>
<output if="${docker}">
<files>
<directory>files</directory>
<includes>
<include>.dockerignore</include>
</includes>
</files>
<templates engine="mustache" transformations="mustache">
<directory>files</directory>
<includes>
<include>Dockerfile.mustache</include>
</includes>
</templates>
<model>
<list key="poms" if="!${multi-module}">
<value>ADD pom.xml .</value>
</list>
<list key="src-dirs" if="!${multi-module}">
<value>ADD src src</value>
</list>
<list key="readme-sections">
<value order="50" template="mustache"><![CDATA[
## Building the Docker Image
```
docker build -t {{artifactId}} .
```
## Running the Docker Image
{{#docker-run-readme-section}}
{{.}}
{{/docker-run-readme-section}}
{{^docker-run-readme-section}}
```
docker run --rm -p 8080:8080 {{artifactId}}:latest
```
{{/docker-run-readme-section}}
Exercise the application as described above.
]]>
</value>
</list>
<list key="docker-phase1-options" if="${flavor} == 'mp'">
<value>-Declipselink.weave.skip</value>
<value>-DskipOpenApiGenerate</value>
</list>
</model>
</output>
</archetype-script>
32 changes: 32 additions & 0 deletions archetypes/helidon/src/main/archetype/common/extra-inputs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022, 2023 Oracle and/or its affiliates.
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.
-->
<archetype-script xmlns="https://helidon.io/archetype/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://helidon.io/archetype/2.0 https://helidon.io/xsd/archetype-2.0.xsd">

<step name="Extra" optional="true">
<inputs>
<list id="extra" name="Select Additional Components" optional="true">
<option value="webclient" name="WebClient" description="Nima HTTP client" if="${flavor} == 'se'"/>
<option value="fault-tolerance" name="Fault Tolerance" description="System for building resilient applications"/>
<option value="cors" name="CORS" description="Cross-Origin Resource Sharing utilities"/>
</list>
</inputs>
</step>
</archetype-script>
Loading

0 comments on commit e22def0

Please sign in to comment.