Skip to content

Point generated projects at the Codename One R2 repository - #5524

Open
shai-almog wants to merge 1 commit into
masterfrom
feature/r2-repo-in-generated-projects
Open

Point generated projects at the Codename One R2 repository#5524
shai-almog wants to merge 1 commit into
masterfrom
feature/r2-repo-in-generated-projects

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Phase two of the Maven Central migration described in Why Codename One Is Moving Beyond Maven Central. Phase one (#5497) shrank the release payload and started dual publishing; this makes newly generated projects point at https://repo.codenameone.com/maven2.

Why this is needed before the cutover

A project generated today resolves fine without the repository, because Central still serves every published version. It then silently stops seeing new releases after August 28. The failure is invisible at generation time, which is what makes it worth gating rather than merely doing.

Both lists are declared in each root POM. Maven resolves ordinary dependencies through <repositories> and build plugins through <pluginRepositories>, so a project holding only the first downloads codenameone-core and still fails to find a newer codenameone-maven-plugin -- which reads to a user as a corrupt install rather than a missing repository.

Snapshots stay disabled: the repository serves releases only, and enabling them would send every local 8.0-SNAPSHOT lookup over the network.

The three scaffolds

These are the only ways a user gets a new project, and all three are covered:

Path File
cn1app-archetype (archetype:generate, cn1:generate-app-project) archetype-resources/pom.xml -- filled in the empty <repositories>/<pluginRepositories> blocks
cn1lib-archetype (library projects) archetype-resources/pom.xml -- had no repository block at all
Initializr (start.codenameone.com) root pom.xml inside scripts/initializr/.../common.zip

Gates

  • maven/integration-tests/validate_generated_repositories.py (new) checks all three scaffolds declare the repository, in both lists, with releases enabled. Wired into the existing scaffolding-parity workflow next to the coordinate and settings checks, with the two archetype POMs added to its path filters.
  • GeneratorModelMatrixTest asserts it on the generated root POM for both the Java 8 and Java 17 paths.

Verification

  • Generated a real project from each archetype (8.0-SNAPSHOT, installed locally) and confirmed the block lands correctly after Velocity filtering.
  • help:evaluate on the generated project shows the effective lists resolving in the intended order: codenameone then central for dependencies, codenameone-plugins then central for plugins.
  • Resolved com.codenameone:codenameone-maven-plugin:7.0.264 into a clean local repo from R2 alone, confirming the endpoint serves the artifacts the generated POM points at.
  • Ran the initializr CN1 test suite: the new assertion passes. GeneratorModelIntegrationBuildTest fails with a 120s timeout, but it fails identically on unmodified master -- pre-existing, unrelated.
  • Copyright-header and ASCII gates pass over the branch range; the three scaffolding-parity checks pass.

Deliberately not included

Resolving the archetype itself still goes through Central. After Central publication stops, mvn archetype:generate -DarchetypeGroupId=com.codenameone ... will need -DarchetypeRepository=https://repo.codenameone.com/maven2 or the R2 archetype-catalog.xml, and the documented commands in the developer guide will need updating. That is a phase-three concern and is not in this change.

🤖 Generated with Claude Code

Phase two of the Maven Central migration. Codename One releases are moving to
the repository at https://repo.codenameone.com/maven2, and from August 28 new
versions stop being published to Central. A project generated before that date
resolves fine today and then silently stops seeing new releases, so the three
scaffolding paths now declare the repository up front.

Both lists are declared in each root pom. Maven resolves ordinary dependencies
through the repositories list and build plugins through the pluginRepositories
list, so a project holding only the first downloads codenameone-core and still
fails to find a newer codenameone-maven-plugin -- which reads as a corrupt
install rather than a missing repository.

Snapshots stay disabled on the new repository: it serves releases only, and
enabling them would send every local 8.0-SNAPSHOT lookup over the network.

The three scaffolds are covered:

  - cn1app-archetype  -- mvn archetype:generate / cn1:generate-app-project
  - cn1lib-archetype  -- library projects, which had no repository block at all
  - common.zip        -- the Initializr root pom (start.codenameone.com)

Losing any one of them is invisible at generation time, because Central still
serves every already-published version, so validate_generated_repositories.py
gates all three in the existing scaffolding-parity workflow, and the initializr
matrix test asserts it on the generated root pom.

Not included: resolving the archetype ITSELF still goes through Central, so
`archetype:generate` will need -DarchetypeRepository (or the R2
archetype-catalog) once Central publication stops. That belongs with the
phase-three cutover.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 5, 2026 08:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR advances Codename One’s Maven Central → Cloudflare R2 migration by ensuring newly generated projects explicitly resolve both dependencies and build plugins from https://repo.codenameone.com/maven2, and by adding CI gates to prevent regressions across all supported scaffolding paths (both archetypes and the Initializr common.zip).

Changes:

  • Adds Codename One <repositories> and <pluginRepositories> blocks to both cn1app and cn1lib archetype root POM templates.
  • Introduces a new integration test (validate_generated_repositories.py) and wires it into the existing scaffolding-parity GitHub Actions workflow.
  • Adds Initializr test assertions to ensure generated root POMs include the Codename One repository for both Java 8 and Java 17 generation paths.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/initializr/common/src/test/java/com/codename1/initializr/model/GeneratorModelMatrixTest.java Adds assertions that generated Initializr root POMs include the Codename One repository.
maven/integration-tests/validate_generated_repositories.py New gate that validates all scaffolds declare the Codename One repository in both dependency and plugin resolution lists.
maven/cn1lib-archetype/src/main/resources/archetype-resources/pom.xml Adds repository and pluginRepository blocks pointing at repo.codenameone.com.
maven/cn1app-archetype/src/main/resources/archetype-resources/pom.xml Fills previously empty repository/pluginRepository blocks with the Codename One repo configuration.
.github/workflows/scaffolding-parity.yml Runs the new repository-validation gate and expands path filters to include the archetype POM templates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +86 to +102
for list_name, entry_name in REQUIRED_LISTS:
container = project.find("m:" + list_name, NS)
if container is None:
fail(label + " has no <" + list_name + ">; generated projects stop seeing "
+ "Codename One releases once publication to Maven Central ends")

matches = [entry for entry in container.findall("m:" + entry_name, NS)
if child_text(entry, "url") == REPOSITORY_URL]
if not matches:
fail(label + " does not declare " + REPOSITORY_URL + " in <" + list_name + ">")

for entry in matches:
releases = entry.find("m:releases", NS)
if releases is not None and child_text(releases, "enabled") == "false":
fail(label + " declares " + REPOSITORY_URL + " in <" + list_name
+ "> with releases disabled, so no release can resolve from it")

Comment on lines +225 to 237
private void assertCodenameOneRepository(String rootPom, String label) {
int repositories = rootPom.indexOf("<repositories>");
int pluginRepositories = rootPom.indexOf("<pluginRepositories>");
assertTrue(repositories >= 0, label + " root pom should declare <repositories>");
assertTrue(pluginRepositories > repositories,
label + " root pom should declare <pluginRepositories> after <repositories>");
assertContains(rootPom.substring(repositories, pluginRepositories),
"https://repo.codenameone.com/maven2",
label + " root pom should resolve dependencies from the Codename One repository");
assertContains(rootPom.substring(pluginRepositories),
"https://repo.codenameone.com/maven2",
label + " root pom should resolve plugins from the Codename One repository");
}
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@shai-almog

shai-almog commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 151 screenshots: 151 matched.

Native Android coverage

  • 📊 Line coverage: 8.03% (7795/97060 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 8.03% (41397/515259), branch 2.85% (1386/48675), complexity 3.18% (1659/52236), method 4.90% (1353/27630), class 9.97% (367/3680)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6367 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1187 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/736 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/625 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.Frame – 0.00% (0/570 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 8.03% (7795/97060 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 8.03% (41397/515259), branch 2.85% (1386/48675), complexity 3.18% (1659/52236), method 4.90% (1353/27630), class 9.97% (367/3680)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6367 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1187 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/736 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/625 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.Frame – 0.00% (0/570 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend scalar fallback (no native SIMD)
SIMD int-add (64K x300) java 240ms / native 163ms = 1.4x speedup
SIMD float-mul (64K x300) java 182ms / native 175ms = 1.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 73.000 ms
Base64 CN1 decode 82.000 ms
Base64 native encode 320.000 ms
Base64 encode ratio (CN1/native) 0.228x (77.2% faster)
Base64 native decode 285.000 ms
Base64 decode ratio (CN1/native) 0.288x (71.2% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog

shai-almog commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 181 screenshots: 181 matched.
✅ JavaScript-port screenshot tests passed.

@shai-almog

shai-almog commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 148 screenshots: 148 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 298 seconds

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 67ms / native 3ms = 22.3x speedup
SIMD float-mul (64K x300) java 54ms / native 6ms = 9.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 199.000 ms
Base64 CN1 decode 129.000 ms
Base64 native encode 595.000 ms
Base64 encode ratio (CN1/native) 0.334x (66.6% faster)
Base64 native decode 296.000 ms
Base64 decode ratio (CN1/native) 0.436x (56.4% faster)
Base64 SIMD encode 57.000 ms
Base64 encode ratio (SIMD/CN1) 0.286x (71.4% faster)
Base64 SIMD decode 44.000 ms
Base64 decode ratio (SIMD/CN1) 0.341x (65.9% faster)
Base64 encode ratio (SIMD/native) 0.096x (90.4% faster)
Base64 decode ratio (SIMD/native) 0.149x (85.1% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 8.000 ms
Image createMask (SIMD on) 2.000 ms
Image createMask ratio (SIMD on/off) 0.250x (75.0% faster)
Image applyMask (SIMD off) 60.000 ms
Image applyMask (SIMD on) 60.000 ms
Image applyMask ratio (SIMD on/off) 1.000x (0.0% slower)
Image modifyAlpha (SIMD off) 43.000 ms
Image modifyAlpha (SIMD on) 55.000 ms
Image modifyAlpha ratio (SIMD on/off) 1.279x (27.9% slower)
Image modifyAlpha removeColor (SIMD off) 57.000 ms
Image modifyAlpha removeColor (SIMD on) 51.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.895x (10.5% faster)

@shai-almog

shai-almog commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 144 screenshots: 144 matched.
✅ Native Apple TV (tvOS, Metal) screenshot tests passed.

@shai-almog

shai-almog commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 217 screenshots: 217 matched.
✅ Native Apple Watch (watchOS, Core Graphics) screenshot tests passed.

@shai-almog

shai-almog commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 149 screenshots: 149 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 682 seconds

Build and Run Timing

Metric Duration
Simulator Boot 76000 ms
Simulator Boot (Run) 1000 ms
App Install 17000 ms
App Launch 51000 ms
Test Execution 450000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 231ms / native 3ms = 77.0x speedup
SIMD float-mul (64K x300) java 105ms / native 3ms = 35.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 269.000 ms
Base64 CN1 decode 152.000 ms
Base64 native encode 1858.000 ms
Base64 encode ratio (CN1/native) 0.145x (85.5% faster)
Base64 native decode 816.000 ms
Base64 decode ratio (CN1/native) 0.186x (81.4% faster)
Base64 SIMD encode 67.000 ms
Base64 encode ratio (SIMD/CN1) 0.249x (75.1% faster)
Base64 SIMD decode 104.000 ms
Base64 decode ratio (SIMD/CN1) 0.684x (31.6% faster)
Base64 encode ratio (SIMD/native) 0.036x (96.4% faster)
Base64 decode ratio (SIMD/native) 0.127x (87.3% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 13.000 ms
Image createMask (SIMD on) 5.000 ms
Image createMask ratio (SIMD on/off) 0.385x (61.5% faster)
Image applyMask (SIMD off) 99.000 ms
Image applyMask (SIMD on) 198.000 ms
Image applyMask ratio (SIMD on/off) 2.000x (100.0% slower)
Image modifyAlpha (SIMD off) 343.000 ms
Image modifyAlpha (SIMD on) 152.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.443x (55.7% faster)
Image modifyAlpha removeColor (SIMD off) 403.000 ms
Image modifyAlpha removeColor (SIMD on) 302.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.749x (25.1% faster)

@shai-almog

shai-almog commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 143 screenshots: 143 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 391 seconds

Build and Run Timing

Metric Duration
Simulator Boot 81000 ms
Simulator Boot (Run) 1000 ms
App Install 26000 ms
App Launch 4000 ms
Test Execution 550000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 78ms / native 6ms = 13.0x speedup
SIMD float-mul (64K x300) java 63ms / native 3ms = 21.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 282.000 ms
Base64 CN1 decode 321.000 ms
Base64 native encode 1083.000 ms
Base64 encode ratio (CN1/native) 0.260x (74.0% faster)
Base64 native decode 597.000 ms
Base64 decode ratio (CN1/native) 0.538x (46.2% faster)
Base64 SIMD encode 78.000 ms
Base64 encode ratio (SIMD/CN1) 0.277x (72.3% faster)
Base64 SIMD decode 111.000 ms
Base64 decode ratio (SIMD/CN1) 0.346x (65.4% faster)
Base64 encode ratio (SIMD/native) 0.072x (92.8% faster)
Base64 decode ratio (SIMD/native) 0.186x (81.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 12.000 ms
Image createMask (SIMD on) 2.000 ms
Image createMask ratio (SIMD on/off) 0.167x (83.3% faster)
Image applyMask (SIMD off) 65.000 ms
Image applyMask (SIMD on) 116.000 ms
Image applyMask ratio (SIMD on/off) 1.785x (78.5% slower)
Image modifyAlpha (SIMD off) 115.000 ms
Image modifyAlpha (SIMD on) 60.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.522x (47.8% faster)
Image modifyAlpha removeColor (SIMD off) 98.000 ms
Image modifyAlpha removeColor (SIMD on) 162.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.653x (65.3% slower)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants