Skip to content

Fix Swift files placed in Xcode Resources phase instead of Compile Sources#4722

Merged
shai-almog merged 3 commits intocodex/add-swift-support-for-codename-one-interfacesfrom
copilot/add-swift-and-kotlin-support
Apr 8, 2026
Merged

Fix Swift files placed in Xcode Resources phase instead of Compile Sources#4722
shai-almog merged 3 commits intocodex/add-swift-support-for-codename-one-interfacesfrom
copilot/add-swift-and-kotlin-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

  • Understand the current state: SWIFT_VERSION, DEFINES_MODULE, SWIFT_OBJC_BRIDGING_HEADER are unconditionally set in pbxproj template
  • Revert SWIFT_VERSION, DEFINES_MODULE, SWIFT_OBJC_BRIDGING_HEADER from the pbxproj template
  • Add hasSwiftFiles() helper in IPhoneBuilder.java to recursively scan dist dir for .swift files
  • Conditionally inject SWIFT_VERSION and related settings via replaceInFile when Swift files are present
  • Conditionally create the bridging header only when Swift files are present
  • Build and test (all plugin tests pass)
  • Run validation

…es phase

The ByteCodeTranslator was placing .swift files in the Copy Bundle
Resources phase instead of the Compile Sources phase of the generated
Xcode project. This prevented the Swift bridge class from being compiled,
so the ObjC shim could not find it at runtime.

Changes:
- ByteCodeTranslator: recognize .swift as source files (compile phase,
  correct file type sourcecode.swift, proper path resolution)
- IPhoneBuilder: restore #import of Impl.h header in generated native
  peer code for compile-time method signatures

Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/d03d4ad3-d347-40b7-8d32-7a83904d638e

Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 8, 2026

Compared 33 screenshots: 33 matched.

Native Android coverage

  • 📊 Line coverage: 7.62% (3891/51092 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 6.00% (19265/321088), branch 2.83% (881/31181), complexity 3.55% (1058/29826), method 6.26% (871/13904), class 10.40% (192/1846)
    • 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/712 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: 7.62% (3891/51092 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 6.00% (19265/321088), branch 2.83% (881/31181), complexity 3.55% (1058/29826), method 6.26% (871/13904), class 10.40% (192/1846)
    • 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/712 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)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • Tests: 376 total, 0 failed, 2 skipped

Benchmark Results

  • Execution Time: 10133 ms

  • Hotspots (Top 20 sampled methods):

    • 21.87% java.lang.String.indexOf (393 samples)
    • 19.31% com.codename1.tools.translator.Parser.isMethodUsed (347 samples)
    • 14.58% com.codename1.tools.translator.Parser.addToConstantPool (262 samples)
    • 9.91% java.util.ArrayList.indexOf (178 samples)
    • 4.45% java.lang.Object.hashCode (80 samples)
    • 2.78% java.lang.System.identityHashCode (50 samples)
    • 1.78% com.codename1.tools.translator.ByteCodeClass.fillVirtualMethodTable (32 samples)
    • 1.45% com.codename1.tools.translator.BytecodeMethod.optimize (26 samples)
    • 1.39% com.codename1.tools.translator.BytecodeMethod.equals (25 samples)
    • 1.17% java.lang.StringBuilder.append (21 samples)
    • 1.00% com.codename1.tools.translator.ByteCodeClass.calcUsedByNative (18 samples)
    • 1.00% java.lang.StringCoding.encode (18 samples)
    • 0.95% com.codename1.tools.translator.Parser.cullMethods (17 samples)
    • 0.95% com.codename1.tools.translator.Parser.getClassByName (17 samples)
    • 0.89% com.codename1.tools.translator.ByteCodeClass.markDependent (16 samples)
    • 0.78% com.codename1.tools.translator.Parser.generateClassAndMethodIndexHeader (14 samples)
    • 0.67% com.codename1.tools.translator.BytecodeMethod.isMethodUsedByNative (12 samples)
    • 0.61% java.io.FileOutputStream.open0 (11 samples)
    • 0.61% com.codename1.tools.translator.ByteCodeClass.findClass (11 samples)
    • 0.61% java.util.ArrayList$Itr.next (11 samples)
  • ⚠️ Coverage report not generated.

Static Analysis

  • ✅ SpotBugs: no findings (report was not generated by the build).
  • ⚠️ PMD report not generated.
  • ⚠️ Checkstyle report not generated.

Generated automatically by the PR CI workflow.

…nditionally

The SWIFT_VERSION, DEFINES_MODULE, and SWIFT_OBJC_BRIDGING_HEADER build
settings were only configured inside the if(runPods) block, so they were
never applied when CocoaPods was not used. This caused Xcode to fail with
"SWIFT_VERSION '' is unsupported" when Swift files were present without
CocoaPods.

Fix: add these settings directly to the pbxproj template so they are
always present, and create the bridging header file unconditionally.

Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/4ba434ac-7e49-4c9e-8041-82a78d146d75

Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
…ject

Reverts the unconditional SWIFT_VERSION, DEFINES_MODULE, and
SWIFT_OBJC_BRIDGING_HEADER from the pbxproj template. Instead, these
settings are now injected at build time in IPhoneBuilder only when
hasSwiftFiles() detects .swift files in the dist directory. This avoids
adding Swift-specific settings to pure Objective-C projects.

Agent-Logs-Url: https://github.com/codenameone/CodenameOne/sessions/e0fe80ff-947f-4796-857c-bd4248280e1a

Co-authored-by: shai-almog <67850168+shai-almog@users.noreply.github.com>
@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 8, 2026

iOS screenshot updates

Compared 33 screenshots: 32 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (2556x1179 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
Simulator Boot 1000 ms
Simulator Boot (Run) 1000 ms
App Install 4000 ms
App Launch 5000 ms
Test Execution 180000 ms

@shai-almog shai-almog merged commit 5b318b3 into codex/add-swift-support-for-codename-one-interfaces Apr 8, 2026
12 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.

2 participants