Skip to content

Fix samm-cli executable jar build and integration tests #739

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

Merged
merged 2 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/dependency-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Submit Dependency Snapshot
uses: advanced-security/maven-dependency-submission-action@v3
9 changes: 6 additions & 3 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,24 @@ jobs:
java --version
export MAVEN_OPTS="-Xmx4096m"
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
# Actual build of core SDK
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
# Build samm-cli executable jar and run integration tests
unset JAVA_TOOL_OPTIONS
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
shell: bash

- name: Build native image
if: matrix.os != 'macos-13'
run: |
export MAVEN_OPTS="-Xmx4096m"
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
# Build native binary and run integration tests
mvn -B -pl tools/samm-cli verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
shell: bash

- name: Build native image (Mac)
if: matrix.os == 'macos-13'
run: |
export MAVEN_OPTS="-Xmx4096m"
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
bundle="samm-bundle-DEV-SNAPSHOT-$(date +%s)"
mkdir ${bundle}
curl -Lo jre.tar.gz https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jre_x64_mac_hotspot_21.0.6_7.tar.gz
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ jobs:

# Actual build of core SDK
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean deploy -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -DaltDeploymentRepository=local::default::file://nexus-staging -Psign
# Build of CLI
# Build samm-cli executable jar and run integration tests
unset JAVA_TOOL_OPTIONS
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
# Build native binary and run integration tests
mvn -B -pl tools/samm-cli verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60

# Create .tar.gz of samm-cli
pushd tools/samm-cli/target
Expand Down Expand Up @@ -178,7 +180,7 @@ jobs:
mvn versions:commit
# Actual build of core SDK
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
# Build of CLI
# Build samm-cli executable jar and run integration tests
unset JAVA_TOOL_OPTIONS
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
shell: bash
Expand Down Expand Up @@ -266,9 +268,11 @@ jobs:

# Actual build of core SDK
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
# Build of CLI
# Build samm-cli executable jar and run integration tests
unset JAVA_TOOL_OPTIONS
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
# Build native binary and run integration tests
mvn -B -pl tools/samm-cli verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
shell: bash

- name: Upload Windows binary
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ Building the SDK requires a Java 21-compatible [GraalVM JDK](https://www.graalvm

To build the SDK core components, run the following command:
```bash
mvn -pl '!org.eclipse.esmf:samm-cli' clean install
mvn -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative
```

To also build SDK core components and the CLI tool, run the above command, followed by:
```bash
cd tools/samm-cli
mvn -B clean verify
mvn -B verify -Pnative
mvn -pl org.eclipse.esmf:samm-cli clean verify
mvn -pl org.eclipse.esmf:samm-cli verify -Pnative
```

We are always looking forward to your contributions. For more details on how to contribute just take
Expand Down
117 changes: 115 additions & 2 deletions tools/samm-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<main-class>org.eclipse.esmf.SammCli</main-class>
<binary-name>samm</binary-name>
<skip.maven.surefire>false</skip.maven.surefire>
<skip.maven.failsafe>true</skip.maven.failsafe>
<skip.maven.failsafe>false</skip.maven.failsafe>
<skip.maven.surefire.report.plugin>false</skip.maven.surefire.report.plugin>
<skip.maven.shade>false</skip.maven.shade>
</properties>
Expand Down Expand Up @@ -203,6 +203,106 @@
</configuration>
</plugin>

<!-- Build fat jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>default-shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<createSourcesJar>false</createSourcesJar>
<skip>${skip.maven.shade}</skip>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${main-class}</Main-Class>
</manifestEntries>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<artifactSet>
<excludes>
<!-- Duplicate annotations that are already contained in javax.annotation-api -->
<exclude>javax.annotation:jsr250-api</exclude>
</excludes>
</artifactSet>
<filters>
<!-- Required to prevent overlapping resources -->
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>module-info.class</exclude>
<exclude>META-INF/*</exclude>
<exclude>META-INF/sisu/javax.inject.Named</exclude>
<exclude>META-INF/plexus/components.xml</exclude>
<exclude>META-INF.versions*/**</exclude>
<exclude>META-INF/versions*/**</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>plugin.xml</exclude>
<exclude>about.html</exclude>
</excludes>
</filter>
<!-- Required to override the excludes above -->
<filter>
<artifact>${project.groupId}:${project.artifactId}</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**</include>
<include>META-INF/**</include>
<include>git.properties</include>
</includes>
<excludes>
<!-- Explicitly exclude build-time-only code from jar -->
<exclude>org/eclipse/esmf/buildtime/**</exclude>
</excludes>
</filter>
<!-- Clashes with the files from xml-apis-ext -->
<filter>
<artifact>xml-apis:xml-apis</artifact>
<excludes>
<exclude>license/**</exclude>
</excludes>
</filter>
<!-- Clashes with the same file from batik-rasterizer -->
<filter>
<artifact>org.apache.xmlgraphics:batik-svgrasterizer</artifact>
<excludes>
<exclude>org/apache/batik/apps/rasterizer/resources/rasterizer.policy</exclude>
</excludes>
</filter>
<!-- These configs add lots of spurious GraalVM configuration -->
<filter>
<artifact>org.jboss.forge.roaster:roaster-jdt</artifact>
<excludes>
<exclude>META-INF/native-image/**</exclude>
</excludes>
</filter>
<!-- Required to have Model Instantiators available -->
<filter>
<artifact>org.eclipse.esmf:esmf-aspect-meta-model-java</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<!-- Prevent overlapping classes from javax modules -->
<filter>
<artifact>jakarta.activation:jakarta.activation-api</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
Expand Down Expand Up @@ -385,11 +485,24 @@
<packaging-type>native</packaging-type>
<skip.maven.surefire>true</skip.maven.surefire>
<skip.maven.failsafe>false</skip.maven.failsafe>
<skip.maven.shade>true</skip.maven.shade>
<maven.source.skip>false</maven.source.skip>
</properties>

<build>
<plugins>
<!-- When building native, skip build the jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
Expand All @@ -400,7 +513,7 @@
<goals>
<goal>compile</goal>
</goals>
<phase>package</phase>
<phase>prepare-package</phase>
</execution>
</executions>
<configuration>
Expand Down
Loading