Skip to content

Commit 05f545f

Browse files
Migrate VM projects to Maven (#4269)
* Migrate VM projects to Maven - Created POM files for `vm` directory projects (`ByteCodeTranslator`, `JavaAPI`, `tests`). - Configured Maven build to use source/target 1.5 and ASM 5.0.3 to maintain legacy semantics. - Added `maven-antrun-plugin` to copy build artifacts to `dist/` directory for compatibility. - Updated GitHub Actions workflow `pr.yml` to build VM projects using Maven instead of Ant. - Ensured test source files remain unchanged. * Migrate VM projects to Maven (JDK 1.5 Target) - Created Maven POM files for `vm` (parent), `ByteCodeTranslator`, `JavaAPI`, and `tests`. - Configured parent POM to use `maven-compiler-plugin` with source/target 1.5 and ASM 5.0.3, strictly preserving legacy semantics. - Updated `vm/tests/pom.xml` to use source/target 1.8 for test execution (JUnit 5 support) while testing JDK 1.5 artifacts. - Added `maven-antrun-plugin` to `ByteCodeTranslator` and `JavaAPI` to copy generated JARs to the legacy `dist/` directory for backward compatibility with external scripts. - Updated `.github/workflows/pr.yml` to replace Ant build commands with Maven commands for VM projects and updated artifact paths to `target/`. - Updated `.github/workflows/parparvm-tests.yml` to run Maven from the `vm` directory (reactor root) to correctly resolve module dependencies. - Reverted test source modifications to ensure no Java source files are changed. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent d870126 commit 05f545f

File tree

7 files changed

+214
-42
lines changed

7 files changed

+214
-42
lines changed

.github/workflows/parparvm-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
sudo apt-get install -y clang
3636
3737
- name: Run ParparVM JVM tests
38-
working-directory: vm/tests
38+
working-directory: vm
3939
run: mvn -B test
4040

4141
- name: Publish ByteCodeTranslator quality previews

.github/workflows/pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,16 @@ jobs:
239239
run: ant -noinput -buildfile Ports/iOSPort/build.xml jar
240240

241241
- name: Build iOS VM API
242-
run: ant -noinput -buildfile vm/JavaAPI/build.xml jar
242+
run: mvn -f vm/JavaAPI/pom.xml package
243243

244244
- name: Upload a Build Artifact
245245
uses: actions/upload-artifact@v4
246246
with:
247247
name: JavaAPI.jar
248-
path: vm/JavaAPI/dist/JavaAPI.jar
248+
path: vm/JavaAPI/target/JavaAPI-1.0-SNAPSHOT.jar
249249

250250
- name: Build iOS VM
251-
run: ant -noinput -buildfile vm/ByteCodeTranslator/build.xml jar
251+
run: mvn -f vm/ByteCodeTranslator/pom.xml package
252252

253253
- name: Build CLDC 11 VM
254254
run: ant -noinput -buildfile Ports/CLDC11/build.xml jar
@@ -257,7 +257,7 @@ jobs:
257257
uses: actions/upload-artifact@v4
258258
with:
259259
name: ByteCodeTranslator.jar
260-
path: vm/ByteCodeTranslator/dist/ByteCodeTranslator.jar
260+
path: vm/ByteCodeTranslator/target/ByteCodeTranslator-1.0-SNAPSHOT.jar
261261

262262
- name: Upload a Build Artifact
263263
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ pom.xml.tag
8181
!.brokk/style.md
8282
!.brokk/review.md
8383
!.brokk/project.properties
84+
dependency-reduced-pom.xml

vm/ByteCodeTranslator/pom.xml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>com.codename1.parparvm</groupId>
8+
<artifactId>parparvm-parent</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>ByteCodeTranslator</artifactId>
13+
<packaging>jar</packaging>
14+
<name>ByteCodeTranslator</name>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.ow2.asm</groupId>
19+
<artifactId>asm</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.ow2.asm</groupId>
23+
<artifactId>asm-commons</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.ow2.asm</groupId>
27+
<artifactId>asm-tree</artifactId>
28+
</dependency>
29+
</dependencies>
30+
31+
<build>
32+
<sourceDirectory>src</sourceDirectory>
33+
<resources>
34+
<resource>
35+
<directory>src</directory>
36+
<excludes>
37+
<exclude>**/*.java</exclude>
38+
</excludes>
39+
</resource>
40+
</resources>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.apache.maven.plugins</groupId>
44+
<artifactId>maven-shade-plugin</artifactId>
45+
<version>3.5.0</version>
46+
<executions>
47+
<execution>
48+
<phase>package</phase>
49+
<goals>
50+
<goal>shade</goal>
51+
</goals>
52+
<configuration>
53+
<transformers>
54+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
55+
<mainClass>com.codename1.tools.translator.ByteCodeTranslator</mainClass>
56+
</transformer>
57+
</transformers>
58+
</configuration>
59+
</execution>
60+
</executions>
61+
</plugin>
62+
<plugin>
63+
<artifactId>maven-antrun-plugin</artifactId>
64+
<version>3.1.0</version>
65+
<executions>
66+
<execution>
67+
<phase>package</phase>
68+
<configuration>
69+
<target>
70+
<mkdir dir="${project.basedir}/dist"/>
71+
<copy file="${project.build.directory}/${project.build.finalName}.jar"
72+
tofile="${project.basedir}/dist/${project.artifactId}.jar"/>
73+
</target>
74+
</configuration>
75+
<goals>
76+
<goal>run</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
</plugins>
82+
</build>
83+
</project>

vm/JavaAPI/pom.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>com.codename1.parparvm</groupId>
8+
<artifactId>parparvm-parent</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>JavaAPI</artifactId>
13+
<packaging>jar</packaging>
14+
<name>JavaAPI</name>
15+
16+
<build>
17+
<sourceDirectory>src</sourceDirectory>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.apache.maven.plugins</groupId>
21+
<artifactId>maven-compiler-plugin</artifactId>
22+
<version>3.11.0</version>
23+
<configuration>
24+
<source>1.5</source>
25+
<target>1.5</target>
26+
<!-- Allow compiling java.* packages -->
27+
<compilerArgs>
28+
<arg>-Xlint:-options</arg>
29+
</compilerArgs>
30+
</configuration>
31+
</plugin>
32+
<plugin>
33+
<artifactId>maven-antrun-plugin</artifactId>
34+
<version>3.1.0</version>
35+
<executions>
36+
<execution>
37+
<phase>package</phase>
38+
<configuration>
39+
<target>
40+
<mkdir dir="${project.basedir}/dist"/>
41+
<copy file="${project.build.directory}/${project.build.finalName}.jar"
42+
tofile="${project.basedir}/dist/${project.artifactId}.jar"/>
43+
</target>
44+
</configuration>
45+
<goals>
46+
<goal>run</goal>
47+
</goals>
48+
</execution>
49+
</executions>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
</project>

vm/pom.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.codename1.parparvm</groupId>
7+
<artifactId>parparvm-parent</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<packaging>pom</packaging>
10+
<name>ParparVM Parent</name>
11+
12+
<modules>
13+
<module>ByteCodeTranslator</module>
14+
<module>JavaAPI</module>
15+
<module>tests</module>
16+
</modules>
17+
18+
<properties>
19+
<maven.compiler.source>1.5</maven.compiler.source>
20+
<maven.compiler.target>1.5</maven.compiler.target>
21+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22+
<asm.version>5.0.3</asm.version>
23+
<junit.jupiter.version>5.10.2</junit.jupiter.version>
24+
</properties>
25+
26+
<dependencyManagement>
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.ow2.asm</groupId>
30+
<artifactId>asm</artifactId>
31+
<version>${asm.version}</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.ow2.asm</groupId>
35+
<artifactId>asm-commons</artifactId>
36+
<version>${asm.version}</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.ow2.asm</groupId>
40+
<artifactId>asm-tree</artifactId>
41+
<version>${asm.version}</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.junit.jupiter</groupId>
45+
<artifactId>junit-jupiter</artifactId>
46+
<version>${junit.jupiter.version}</version>
47+
</dependency>
48+
</dependencies>
49+
</dependencyManagement>
50+
</project>

vm/tests/pom.xml

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,49 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.codename1.parparvm</groupId>
6+
<parent>
7+
<groupId>com.codename1.parparvm</groupId>
8+
<artifactId>parparvm-parent</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
712
<artifactId>parparvm-tests</artifactId>
8-
<version>1.0-SNAPSHOT</version>
913
<name>ParparVM Java Tests</name>
1014

11-
<properties>
12-
<maven.compiler.source>1.8</maven.compiler.source>
13-
<maven.compiler.target>1.8</maven.compiler.target>
14-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<junit.jupiter.version>5.10.2</junit.jupiter.version>
16-
<asm.version>5.0.3</asm.version>
17-
</properties>
18-
1915
<dependencies>
16+
<dependency>
17+
<groupId>com.codename1.parparvm</groupId>
18+
<artifactId>ByteCodeTranslator</artifactId>
19+
<version>1.0-SNAPSHOT</version>
20+
</dependency>
2021
<dependency>
2122
<groupId>org.ow2.asm</groupId>
2223
<artifactId>asm</artifactId>
23-
<version>${asm.version}</version>
2424
</dependency>
2525
<dependency>
2626
<groupId>org.ow2.asm</groupId>
2727
<artifactId>asm-commons</artifactId>
28-
<version>${asm.version}</version>
2928
</dependency>
3029
<dependency>
3130
<groupId>org.junit.jupiter</groupId>
3231
<artifactId>junit-jupiter</artifactId>
33-
<version>${junit.jupiter.version}</version>
3432
<scope>test</scope>
3533
</dependency>
3634
</dependencies>
3735

3836
<build>
39-
<testResources>
40-
<testResource>
41-
<directory>../ByteCodeTranslator/src</directory>
42-
</testResource>
43-
</testResources>
4437
<plugins>
38+
<plugin>
39+
<groupId>org.apache.maven.plugins</groupId>
40+
<artifactId>maven-compiler-plugin</artifactId>
41+
<version>3.11.0</version>
42+
<configuration>
43+
<!-- Tests run on newer JDK (8+) so source/target 1.8 is appropriate here -->
44+
<!-- But the code they test targets 1.5. The test runner itself needs to run on the JVM. -->
45+
<source>1.8</source>
46+
<target>1.8</target>
47+
</configuration>
48+
</plugin>
4549
<plugin>
4650
<groupId>org.apache.maven.plugins</groupId>
4751
<artifactId>maven-surefire-plugin</artifactId>
@@ -50,25 +54,6 @@
5054
<useModulePath>false</useModulePath>
5155
</configuration>
5256
</plugin>
53-
<plugin>
54-
<groupId>org.codehaus.mojo</groupId>
55-
<artifactId>build-helper-maven-plugin</artifactId>
56-
<version>3.5.0</version>
57-
<executions>
58-
<execution>
59-
<id>add-bytecodetranslator-sources</id>
60-
<phase>generate-sources</phase>
61-
<goals>
62-
<goal>add-source</goal>
63-
</goals>
64-
<configuration>
65-
<sources>
66-
<source>../ByteCodeTranslator/src</source>
67-
</sources>
68-
</configuration>
69-
</execution>
70-
</executions>
71-
</plugin>
7257
<plugin>
7358
<groupId>org.jacoco</groupId>
7459
<artifactId>jacoco-maven-plugin</artifactId>

0 commit comments

Comments
 (0)