Skip to content

Commit bebf226

Browse files
authored
Merge branch 'main' into bugfix/663-samm-validate-not-working-with-samm-cli-on-macos
2 parents 78b130f + 6a5fa29 commit bebf226

File tree

50 files changed

+3993
-1319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3993
-1319
lines changed

.github/workflows/pull-request-check.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,21 @@ jobs:
6767
java --version
6868
export MAVEN_OPTS="-Xmx4096m"
6969
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
70-
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
71-
cd tools/samm-cli
72-
unset JAVA_TOOL_OPTIONS
73-
mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
70+
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
7471
shell: bash
7572

7673
- name: Build native image
7774
if: matrix.os != 'macos-13'
7875
run: |
7976
export MAVEN_OPTS="-Xmx4096m"
80-
cd tools/samm-cli
81-
mvn -B package -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
77+
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
8278
shell: bash
8379

8480
- name: Build native image (Mac)
8581
if: matrix.os == 'macos-13'
8682
run: |
83+
export MAVEN_OPTS="-Xmx4096m"
84+
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
8785
bundle="samm-bundle-DEV-SNAPSHOT-$(date +%s)"
8886
mkdir ${bundle}
8987
curl -Lo jre.tar.gz https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.3%2B9/OpenJDK21U-jre_x64_mac_hotspot_21.0.3_9.tar.gz

.github/workflows/release-workflow.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Setup JDK
6767
uses: graalvm/setup-graalvm@2f25c0caae5b220866f732832d5e3e29ff493338 # v1.2.1
6868
with:
69-
java-version: '17.0.8'
69+
java-version: '17.0.10'
7070
distribution: 'graalvm'
7171
components: 'native-image,js'
7272
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -99,13 +99,10 @@ jobs:
9999
release_version=${{ github.event.inputs.release_version }}
100100
101101
# Actual build of core SDK
102-
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean deploy -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -DaltDeploymentRepository=local::default::file://nexus-staging -Psign
102+
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean deploy -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -DaltDeploymentRepository=local::default::file://nexus-staging -Psign
103103
# Build of CLI
104-
pushd tools/samm-cli
105104
unset JAVA_TOOL_OPTIONS
106-
mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
107-
mvn -B verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
108-
popd
105+
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
109106
110107
# Create .tar.gz of samm-cli
111108
pushd tools/samm-cli/target
@@ -152,7 +149,7 @@ jobs:
152149
- name: Setup JDK
153150
uses: graalvm/setup-graalvm@2f25c0caae5b220866f732832d5e3e29ff493338 # v1.2.1
154151
with:
155-
java-version: '17.0.8'
152+
java-version: '17.0.10'
156153
distribution: 'graalvm'
157154
components: 'native-image,js'
158155
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -174,11 +171,10 @@ jobs:
174171
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
175172
mvn versions:commit
176173
# Actual build of core SDK
177-
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
174+
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
178175
# Build of CLI
179-
cd tools/samm-cli
180176
unset JAVA_TOOL_OPTIONS
181-
mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
177+
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
182178
shell: bash
183179

184180
- name: Build native executable
@@ -226,7 +222,7 @@ jobs:
226222
- name: Setup JDK
227223
uses: graalvm/setup-graalvm@2f25c0caae5b220866f732832d5e3e29ff493338 # v1.2.1
228224
with:
229-
java-version: '17.0.8'
225+
java-version: '17.0.10'
230226
distribution: 'graalvm'
231227
components: 'native-image,js'
232228
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -261,12 +257,10 @@ jobs:
261257
mvn versions:commit
262258
263259
# Actual build of core SDK
264-
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
260+
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
265261
# Build of CLI
266-
cd tools/samm-cli
267262
unset JAVA_TOOL_OPTIONS
268-
mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
269-
mvn -B verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
263+
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
270264
shell: bash
271265

272266
- name: Upload Windows binary

core/esmf-aspect-meta-model-java/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
<name>ESMF Aspect Meta Model Java</name>
2929
<packaging>jar</packaging>
3030

31-
<properties>
32-
<generated-sources>${project.basedir}/src-gen</generated-sources>
33-
<build-time-sources>${project.basedir}/src-buildtime</build-time-sources>
34-
</properties>
35-
3631
<dependencies>
3732
<dependency>
3833
<groupId>org.eclipse.esmf</groupId>

core/esmf-native-support/pom.xml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
4+
~
5+
~ See the AUTHORS file(s) distributed with this work for additional
6+
~ information regarding authorship.
7+
~
8+
~ This Source Code Form is subject to the terms of the Mozilla Public
9+
~ License, v. 2.0. If a copy of the MPL was not distributed with this
10+
~ file, You can obtain one at https://mozilla.org/MPL/2.0/.
11+
~
12+
~ SPDX-License-Identifier: MPL-2.0
13+
-->
14+
15+
<project xmlns="http://maven.apache.org/POM/4.0.0"
16+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
18+
<modelVersion>4.0.0</modelVersion>
19+
20+
<parent>
21+
<groupId>org.eclipse.esmf</groupId>
22+
<artifactId>esmf-sdk-parent</artifactId>
23+
<version>DEV-SNAPSHOT</version>
24+
<relativePath>../../pom.xml</relativePath>
25+
</parent>
26+
27+
<artifactId>esmf-native-support</artifactId>
28+
<name>ESMF Native Support</name>
29+
30+
<properties>
31+
<skip.maven.shade>false</skip.maven.shade>
32+
</properties>
33+
34+
<dependencies>
35+
<dependency>
36+
<groupId>org.eclipse.esmf</groupId>
37+
<artifactId>esmf-aspect-model-starter</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>ch.qos.logback</groupId>
41+
<artifactId>logback-classic</artifactId>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.graalvm.nativeimage</groupId>
45+
<artifactId>svm</artifactId>
46+
<scope>provided</scope>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>org.junit.jupiter</groupId>
51+
<artifactId>junit-jupiter</artifactId>
52+
<scope>test</scope>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.assertj</groupId>
56+
<artifactId>assertj-core</artifactId>
57+
<scope>test</scope>
58+
</dependency>
59+
</dependencies>
60+
61+
<build>
62+
<plugins>
63+
<plugin>
64+
<artifactId>maven-resources-plugin</artifactId>
65+
<executions>
66+
<execution>
67+
<id>copy-resources</id>
68+
<!-- This needs to take place after the customize-resource-config exec-maven-plugin goal runs and before the package phase -->
69+
<phase>prepare-package</phase>
70+
<goals>
71+
<goal>copy-resources</goal>
72+
</goals>
73+
<configuration>
74+
<outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
75+
<resources>
76+
<resource>
77+
<directory>${generated-sources}/main/resources/META-INF</directory>
78+
<filtering>false</filtering>
79+
</resource>
80+
</resources>
81+
</configuration>
82+
</execution>
83+
</executions>
84+
</plugin>
85+
86+
<plugin>
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-compiler-plugin</artifactId>
89+
<configuration>
90+
<compilerArgs>
91+
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
92+
<arg>--add-exports</arg>
93+
<arg>java.desktop/sun.awt=ALL-UNNAMED</arg>
94+
<arg>--add-exports</arg>
95+
<arg>java.desktop/sun.font=ALL-UNNAMED</arg>
96+
<arg>--add-exports</arg>
97+
<arg>org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED</arg>
98+
</compilerArgs>
99+
<showWarnings>false</showWarnings>
100+
<showDeprecation>false</showDeprecation>
101+
</configuration>
102+
</plugin>
103+
104+
<plugin>
105+
<groupId>org.apache.maven.plugins</groupId>
106+
<artifactId>maven-javadoc-plugin</artifactId>
107+
<configuration>
108+
<excludePackageNames>org.eclipse.esmf.substitution,org.eclipse.esmf.buildtime</excludePackageNames>
109+
</configuration>
110+
</plugin>
111+
112+
<plugin>
113+
<groupId>org.apache.maven.plugins</groupId>
114+
<artifactId>maven-surefire-plugin</artifactId>
115+
<configuration>
116+
<forkCount>1</forkCount>
117+
<reuseForks>false</reuseForks>
118+
<argLine>--add-exports org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED</argLine>
119+
</configuration>
120+
</plugin>
121+
122+
<!-- Executes build-time-only code -->
123+
<plugin>
124+
<groupId>org.codehaus.mojo</groupId>
125+
<artifactId>exec-maven-plugin</artifactId>
126+
<executions>
127+
<!-- Generate admin-shell reflection config -->
128+
<execution>
129+
<id>generate-admin-shell-reflection-config</id>
130+
<phase>process-classes</phase>
131+
<goals>
132+
<goal>java</goal>
133+
</goals>
134+
<configuration>
135+
<!-- The main class of your build-time scanning code -->
136+
<mainClass>org.eclipse.esmf.buildtime.Aas4jClassSetup</mainClass>
137+
<!-- Pass the directory where to write the properties file -->
138+
<commandlineArgs>${project.build.outputDirectory}</commandlineArgs>
139+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
140+
</configuration>
141+
</execution>
142+
<!-- Execute adjustments of native configs that were generated during the tests -->
143+
<execution>
144+
<id>customize-resource-config</id>
145+
<phase>process-classes</phase>
146+
<goals>
147+
<goal>java</goal>
148+
</goals>
149+
<configuration>
150+
<!-- The main class of your build-time scanning code -->
151+
<mainClass>org.eclipse.esmf.buildtime.CustomizeGraalVmConfigs</mainClass>
152+
<!-- Pass the native image configs directory as a commandline param -->
153+
<commandlineArgs>${native-config-path}</commandlineArgs>
154+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
155+
</configuration>
156+
</execution>
157+
</executions>
158+
</plugin>
159+
160+
<plugin>
161+
<groupId>org.apache.maven.plugins</groupId>
162+
<artifactId>maven-jar-plugin</artifactId>
163+
<configuration>
164+
<!-- Exclude build-time-only code from jar -->
165+
<excludes>
166+
<exclude>org/eclipse/esmf/buildtime/**</exclude>
167+
</excludes>
168+
</configuration>
169+
</plugin>
170+
</plugins>
171+
</build>
172+
</project>

tools/samm-cli/src/main/java/org/eclipse/esmf/buildtime/Aas4jClassSetup.java renamed to core/esmf-native-support/src/main/java/org/eclipse/esmf/buildtime/Aas4jClassSetup.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
import static org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper.MODEL_PACKAGE_NAME;
2121
import static org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper.MODEL_TYPE_SUPERCLASSES;
2222
import static org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper.XML_MIXINS_PACKAGE_NAME;
23+
import static org.eclipse.esmf.nativefeatures.AssetAdministrationShellFeature.ADMINSHELL_PROPERTIES;
2324

24-
import java.io.File;
2525
import java.io.FileOutputStream;
2626
import java.io.IOException;
27+
import java.nio.file.Path;
2728
import java.util.ArrayList;
2829
import java.util.HashMap;
2930
import java.util.HashSet;
3031
import java.util.List;
3132
import java.util.Map;
3233
import java.util.Objects;
33-
import java.util.Properties;
3434
import java.util.Set;
3535
import java.util.stream.Collectors;
3636

@@ -70,14 +70,22 @@ public Aas4jClassSetup() {
7070
config.interfaces = scanAasInterfaces();
7171
config.enums = modelScan.getAllEnums().loadClasses( Enum.class );
7272
config.interfacesWithoutDefaultImplementation = getInterfacesWithoutDefaultImplementation( modelScan );
73+
config.classesInModelPackage = classesInPackage( MODEL_PACKAGE_NAME );
74+
config.classesInDefaultImplementationPackage = classesInPackage( DEFAULT_IMPLEMENTATION_PACKAGE_NAME );
75+
config.classesInJsonMixinsPackage = classesInPackage( JSON_MIXINS_PACKAGE_NAME );
76+
config.classesInXmlMixinsPackage = classesInPackage( XML_MIXINS_PACKAGE_NAME );
7377
}
7478

7579
public static void main( final String[] args ) throws IOException {
76-
final AdminShellConfig config = new Aas4jClassSetup().config;
77-
final Properties p = config.toProperties();
78-
final File out = new File( args[0] );
79-
final FileOutputStream outputStream = new FileOutputStream( out );
80-
p.store( outputStream, null );
80+
try ( final FileOutputStream outputStream = new FileOutputStream( Path.of( args[0] ).resolve( ADMINSHELL_PROPERTIES ).toFile() ) ) {
81+
new Aas4jClassSetup().config.toProperties().store( outputStream, null );
82+
}
83+
}
84+
85+
private Set<Class<?>> classesInPackage( final String packageName ) {
86+
try ( final ScanResult scanResult = new ClassGraph().enableAllInfo().acceptPackages( packageName ).scan() ) {
87+
return new HashSet<>( scanResult.getAllClasses().loadClasses() );
88+
}
8189
}
8290

8391
/**

0 commit comments

Comments
 (0)