Skip to content

Commit aa758a2

Browse files
Add Heavy Load Benchmark using Maven Central Artifacts
- Updated `HeavyLoadBenchmarkTest` to use `codenameone-core` and `codenameone-ios` artifacts downloaded via `maven-dependency-plugin`. - Updated `vm/tests/pom.xml` to include dependencies and copy them to `target/benchmark-dependencies`. - Removed complex build steps from CI workflow. - Test compiles HelloCodenameOne source against downloaded artifacts.
1 parent 6e89a77 commit aa758a2

3 files changed

Lines changed: 60 additions & 10 deletions

File tree

.github/workflows/parparvm-tests.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ jobs:
7676
java-version: '8'
7777
cache: 'maven'
7878

79-
- name: Build CodenameOne and HelloCodenameOne
80-
run: |
81-
mvn -B -f maven/pom.xml install -DskipTests -P !download-cn1-binaries,!install-cn1 -Dcn1.binaries=/tmp/dummy
82-
mvn -B -f scripts/hellocodenameone/pom.xml package -DskipTests
83-
env:
84-
JDK_8_HOME: ${{ env.JDK_8_HOME }}
85-
8679
- name: Run ParparVM JVM tests
8780
working-directory: vm
8881
run: mvn -B clean package -pl JavaAPI -am -DskipTests && mvn -B test -pl tests -am -DexcludedGroups=benchmark

vm/tests/pom.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,47 @@
3131
<artifactId>junit-jupiter</artifactId>
3232
<scope>test</scope>
3333
</dependency>
34+
<dependency>
35+
<groupId>com.codenameone</groupId>
36+
<artifactId>codenameone-core</artifactId>
37+
<version>7.0.150</version>
38+
<scope>test</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.codenameone</groupId>
42+
<artifactId>codenameone-ios</artifactId>
43+
<version>7.0.150</version>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>com.codenameone</groupId>
48+
<artifactId>codenameone-ios</artifactId>
49+
<version>7.0.150</version>
50+
<classifier>bundle</classifier>
51+
<scope>test</scope>
52+
</dependency>
3453
</dependencies>
3554

3655
<build>
3756
<plugins>
57+
<plugin>
58+
<artifactId>maven-dependency-plugin</artifactId>
59+
<version>3.6.1</version>
60+
<executions>
61+
<execution>
62+
<id>copy-dependencies</id>
63+
<phase>generate-test-resources</phase>
64+
<goals>
65+
<goal>copy-dependencies</goal>
66+
</goals>
67+
<configuration>
68+
<outputDirectory>${project.build.directory}/benchmark-dependencies</outputDirectory>
69+
<includeGroupIds>com.codenameone</includeGroupIds>
70+
<includeScope>test</includeScope>
71+
</configuration>
72+
</execution>
73+
</executions>
74+
</plugin>
3875
<plugin>
3976
<groupId>org.apache.maven.plugins</groupId>
4077
<artifactId>maven-compiler-plugin</artifactId>

vm/tests/src/test/java/com/codename1/tools/translator/HeavyLoadBenchmarkTest.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ public void benchmarkJavaAPITranslation() throws Exception {
3838
javaApiJar = Paths.get("vm", "JavaAPI", "dist", "JavaAPI.jar").normalize().toAbsolutePath();
3939
}
4040
// Locate CodenameOne Core jar
41-
Path coreJar = findJar("maven", "core", "target", "codenameone-core-8.0-SNAPSHOT.jar");
41+
Path coreJar = findDependencyJar("codenameone-core");
4242

4343
// Locate IOSPort jar
44-
Path iosPortJar = findJar("maven", "ios", "target", "codenameone-ios-8.0-SNAPSHOT-jar-with-dependencies.jar");
44+
Path iosPortJar = findDependencyJar("codenameone-ios-7.0.150.jar"); // Look for specific jar first
45+
if (iosPortJar == null) iosPortJar = findDependencyJar("codenameone-ios"); // Fallback
4546

4647
// Locate IOS Bundle (for nativeios.jar)
47-
Path iosBundleJar = findJar("maven", "ios", "target", "codenameone-ios-8.0-SNAPSHOT-bundle.jar");
48+
Path iosBundleJar = findDependencyJar("codenameone-ios-7.0.150-bundle.jar");
49+
if (iosBundleJar == null) iosBundleJar = findDependencyJar("bundle");
4850

4951
// Locate HelloCodenameOne sources
5052
Path helloSrc = findPath("scripts", "hellocodenameone", "common", "src", "main", "java");
@@ -53,6 +55,9 @@ public void benchmarkJavaAPITranslation() throws Exception {
5355
Assertions.assertTrue(Files.exists(javaApiJar), "JavaAPI.jar not found at " + javaApiJar);
5456

5557
boolean hasCore = coreJar != null;
58+
if (!hasCore) {
59+
System.out.println("WARNING: CodenameOne Core jar not found in dependencies.");
60+
}
5661

5762
List<Path> jarsToScan = new ArrayList<>();
5863
jarsToScan.add(javaApiJar);
@@ -294,6 +299,21 @@ private Path findPath(String... parts) {
294299
return null;
295300
}
296301

302+
private Path findDependencyJar(String namePart) {
303+
Path depsDir = Paths.get("target", "benchmark-dependencies");
304+
if (!Files.exists(depsDir)) return null;
305+
try {
306+
return Files.list(depsDir)
307+
.filter(p -> p.getFileName().toString().contains(namePart))
308+
.findFirst()
309+
.map(Path::normalize)
310+
.map(Path::toAbsolutePath)
311+
.orElse(null);
312+
} catch (IOException e) {
313+
return null;
314+
}
315+
}
316+
297317
private List<String> scanDirectory(Path dir) throws IOException {
298318
List<String> classes = new ArrayList<>();
299319
Files.walk(dir).forEach(p -> {

0 commit comments

Comments
 (0)