fix(tests): set RNPUnitTests SDKROOT to macOS - #203
Merged
Merged
Conversation
The RNPUnitTests target was created with SDKROOT=iphoneos and SUPPORTED_PLATFORMS=macosx — an iOS-style config on a macOS-only target. Setting SDKROOT=macosx aligns them and clears the IPHONEOS_DEPLOYMENT_TARGET that no longer applies. This unblocks \`xcodebuild -scheme RNP build\` when the test target is in the build graph. It does NOT fix the deeper issue preventing \`@testable import RNP\` from resolving: the RNP executable target emits its swiftmodule labeled 'RNP' but the SPM package 'Rnp' (lowercase) also emits 'Rnp.swiftmodule'. On APFS (case-insensitive by default) the two files collide in the build products directory, so the Swift compiler sees them as the same module and produces 'cannot load module ... as ...'. Real fixes need a deeper change (rename the executable target, move integration tests into the UI test target that doesn't import the app module, or build on a case-sensitive volume). For now this PR just removes the bogus iOS settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets
SDKROOT = macosxon theRNPUnitTeststarget. The target was created withSDKROOT = iphoneos+SUPPORTED_PLATFORMS = macosx— an iOS-style config on a macOS-only target. Aligns them soxcodebuild -scheme RNP builddoesn't get confused by the test target being in the build graph.What this does NOT fix
The deeper issue preventing
@testable import RNPfrom resolving is a module-name case collision:Rnp(lowercase) emitsRnp.swiftmoduleRNP.swiftmoduleandRnp.swiftmoduleare the same file in the build products directorycannot load module 'RNP' as 'Rnp'I tried three additional fixes that all failed:
SWIFT_INCLUDE_PATHS = $(CONFIGURATION_TEMP_DIR)/RNP.build/Objects-normal/$(ARCHS)— points at where the executable's swiftmodule actually lives. Triggers the case-collision error.DEFINES_MODULE = YESon the RNP executable — installsRNP.swiftmoduleto$(BUILT_PRODUCTS_DIR), which collides with the existingRnp.swiftmodule(from the SPM package) and breaks the main app build.SWIFT_EMIT_MODULE_INTERFACE = YES+SWIFT_INSTALL_MODULE = YESon RNP — doesn't actually emit anything to$(BUILT_PRODUCTS_DIR).Real fixes (deferred — none are autonomous)
RNPto e.g.RNPApp. This changes the module name toRNPApp, avoiding the case collision withRnp. Bundle ID (com.rnpgp.RNPForMail) stays unchanged — that's a separate concept. Cost: 1-line change + the test target's@testable import RNPbecomes@testable import RNPApp.Rnpto e.g.RnpBindingsupstream inswift-rnp. Cost: upstream PR + Package.swift change + everyimport Rnpbecomesimport RnpBindings.Ribose containerUITests) which doesn't@testable importthe app module — it uses accessibility APIs. Cost: rewrite the tests in UI-test style.Option 1 is the cleanest locally — single project change, no upstream coordination. Option 2 is more correct (the package name
Rnpis the unusual one; SPM conventions favor camelCase likeRnpKitor similar) but requires an upstream PR.Verification
xcodebuild -scheme RNP build) — BUILD SUCCEEDEDxcodebuild -scheme RNP build-for-testing) — still fails withcannot load module 'RNP' as 'Rnp'(the case-collision issue, unaddressed here)Why ship this anyway
The
SDKROOT = macosxfix is correct on its own merits (the previous setting was outright wrong). It removes one source of confusion from the test-target setup so the next person debugging the case-collision issue doesn't also have to figure out why the test target thinks it's iOS.Follow-ups
RNPApp).RNPUnitTeststoci.ymlso every PR runs them.