Skip to content

Skip CN1MetalShaders.metal when ios.metal build hint is off#4892

Merged
shai-almog merged 1 commit into
masterfrom
fix-metal-shader-build-without-metal-hint
May 8, 2026
Merged

Skip CN1MetalShaders.metal when ios.metal build hint is off#4892
shai-almog merged 1 commit into
masterfrom
fix-metal-shader-build-without-metal-hint

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • The .metal shader file has no #ifdef CN1_USE_METAL guard (Metal Shading Language doesn't wrap the same way the companion .m files do), so it was always copied into the generated Xcode project regardless of the ios.metal build hint.
  • Xcode 26 ships the Metal Toolchain as a separately-downloaded component, so build servers without it failed compilation with error: cannot execute tool 'metal' due to missing Metal Toolchain even when the build hint was off.
  • Fix mirrors the existing MainWindowMETAL.xib / CodenameOne_METALViewController.xib cleanup in the !useMetal branch. The same fix has already been applied (and pushed) to BuildDaemon.

Why CI didn't catch this

The non-Metal build-ios job runs on GitHub's macos-15 runner, which has the Metal Toolchain pre-cached. So the leaked .metal file silently compiled on CI. Production build servers ship a leaner Xcode 26 install without the toolchain, exposing the bug only there.

Test plan

  • build-ios workflow still passes (GL path, ios.metal unset)
  • build-ios-metal workflow still passes (Metal path, ios.metal=true)
  • Build server produces a working iOS build for a project without ios.metal=true

🤖 Generated with Claude Code

The .metal shader file has no #ifdef CN1_USE_METAL guard (Metal Shading
Language doesn't wrap the same way the companion .m files do), so it
was always copied into the generated Xcode project. Xcode 26 ships the
Metal Toolchain as a separately-downloaded component, so build servers
without it failed compilation even when the build hint was off.

Mirrors the existing MainWindowMETAL.xib / CodenameOne_METALViewController.xib
cleanup in the !useMetal branch. Same fix already applied to BuildDaemon.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

✅ 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.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 8, 2026

Compared 90 screenshots: 90 matched.

Native Android coverage

  • 📊 Line coverage: 10.18% (5555/54579 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 7.99% (27217/340606), branch 3.67% (1198/32646), complexity 4.68% (1464/31272), method 8.22% (1202/14614), class 13.59% (267/1964)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 10.18% (5555/54579 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 7.99% (27217/340606), branch 3.67% (1198/32646), complexity 4.68% (1464/31272), method 8.22% (1202/14614), class 13.59% (267/1964)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 703.000 ms
Base64 CN1 encode 294.000 ms
Base64 encode ratio (CN1/native) 0.418x (58.2% faster)
Base64 native decode 1020.000 ms
Base64 CN1 decode 293.000 ms
Base64 decode ratio (CN1/native) 0.287x (71.3% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 8, 2026

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 69000 ms
Simulator Boot (Run) 0 ms
App Install 12000 ms
App Launch 4000 ms
Test Execution 209000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 925.000 ms
Base64 CN1 encode 1356.000 ms
Base64 encode ratio (CN1/native) 1.466x (46.6% slower)
Base64 native decode 878.000 ms
Base64 CN1 decode 1052.000 ms
Base64 decode ratio (CN1/native) 1.198x (19.8% slower)
Base64 SIMD encode 410.000 ms
Base64 encode ratio (SIMD/native) 0.443x (55.7% faster)
Base64 encode ratio (SIMD/CN1) 0.302x (69.8% faster)
Base64 SIMD decode 395.000 ms
Base64 decode ratio (SIMD/native) 0.450x (55.0% faster)
Base64 decode ratio (SIMD/CN1) 0.375x (62.5% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 61.000 ms
Image createMask (SIMD on) 9.000 ms
Image createMask ratio (SIMD on/off) 0.148x (85.2% faster)
Image applyMask (SIMD off) 133.000 ms
Image applyMask (SIMD on) 53.000 ms
Image applyMask ratio (SIMD on/off) 0.398x (60.2% faster)
Image modifyAlpha (SIMD off) 130.000 ms
Image modifyAlpha (SIMD on) 53.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.408x (59.2% faster)
Image modifyAlpha removeColor (SIMD off) 191.000 ms
Image modifyAlpha removeColor (SIMD on) 200.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.047x (4.7% slower)
Image PNG encode (SIMD off) 1027.000 ms
Image PNG encode (SIMD on) 925.000 ms
Image PNG encode ratio (SIMD on/off) 0.901x (9.9% faster)
Image JPEG encode 561.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 8, 2026

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 105000 ms
Simulator Boot (Run) 1000 ms
App Install 16000 ms
App Launch 23000 ms
Test Execution 250000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1010.000 ms
Base64 CN1 encode 1182.000 ms
Base64 encode ratio (CN1/native) 1.170x (17.0% slower)
Base64 native decode 675.000 ms
Base64 CN1 decode 890.000 ms
Base64 decode ratio (CN1/native) 1.319x (31.9% slower)
Base64 SIMD encode 410.000 ms
Base64 encode ratio (SIMD/native) 0.406x (59.4% faster)
Base64 encode ratio (SIMD/CN1) 0.347x (65.3% faster)
Base64 SIMD decode 414.000 ms
Base64 decode ratio (SIMD/native) 0.613x (38.7% faster)
Base64 decode ratio (SIMD/CN1) 0.465x (53.5% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 59.000 ms
Image createMask (SIMD on) 11.000 ms
Image createMask ratio (SIMD on/off) 0.186x (81.4% faster)
Image applyMask (SIMD off) 134.000 ms
Image applyMask (SIMD on) 60.000 ms
Image applyMask ratio (SIMD on/off) 0.448x (55.2% faster)
Image modifyAlpha (SIMD off) 132.000 ms
Image modifyAlpha (SIMD on) 56.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.424x (57.6% faster)
Image modifyAlpha removeColor (SIMD off) 142.000 ms
Image modifyAlpha removeColor (SIMD on) 63.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.444x (55.6% faster)
Image PNG encode (SIMD off) 1007.000 ms
Image PNG encode (SIMD on) 842.000 ms
Image PNG encode ratio (SIMD on/off) 0.836x (16.4% faster)
Image JPEG encode 488.000 ms

@shai-almog shai-almog merged commit 12223d6 into master May 8, 2026
21 of 22 checks passed
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.

1 participant