Repository navigation
Closed
Labels
gradle-pluginfeatured-gradle-plugin workfeatured-gradle-plugin workiosiOS-specific workiOS-specific worktestingTests and coverageTests and coverage
Description
Goal
Add an automated test that proves the Swift compiler eliminates code guarded by #if !DISABLE_* from release binaries, mirroring featured-shrinker-tests for Android R8.
Context
The Gradle plugin generates FeatureFlags.generated.xcconfig with SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) DISABLE_<FLAG_KEY> for each local flag whose defaultValue = false:
- Generator:
build-logic/featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/XcconfigGenerator.kt - Sample usage:
iosApp/iosApp/ContentView.swift(#if !DISABLE_*guards) - Closed shipping work: feat(gradle-plugin): generate FeatureFlags.generated.xcconfig for iOS Swift DCE #18 (xcconfig generator), feat(ios): document and enforce #if entry point pattern for Swift DCE #24 (Swift
#ifpattern doc).
Today there is no automated verification that Swift DCE actually strips the guarded branches from the release binary — the equivalent of featured-shrinker-tests/src/test/kotlin/dev/androidbroadcast/featured/shrinker/R8BooleanFlagEliminationTest.kt is missing for iOS.
Approach
- Add a
featured-swift-dce-testsGradle module (skipped on non-macOS hosts). - Generate xcconfig via the existing plugin task.
- Compile a small Swift fixture (
swiftc -O -D DISABLE_X) — bypass full Xcode to keep the test fast. - Read symbols from the resulting object/binary (
nmorswift demangle) and assert that symbols from the disabled branch are absent. - Verify the opposite case (no
-D DISABLE_X) keeps the symbol present.
Definition of Done
- New test module wiring xcconfig generation
- Test compiles a Swift fixture with
-Oand asserts symbol stripping - CI job runs the test on the macOS runner (existing iOS build job already runs there)
- Wiki page
iOS — xcconfig DCEreferences the test -
CHANGELOG.md[Unreleased]entry
Related
- feat(gradle-plugin): generate FeatureFlags.generated.xcconfig for iOS Swift DCE #18, feat(ios): document and enforce #if entry point pattern for Swift DCE #24 (closed), test(gradle-plugin): integration tests for ProGuard rule generation and R8 DCE #28 (Android R8 integration), Automated R8 DCE verification for feature flags #153 (Android R8 coverage).
Metadata
Metadata
Assignees
Labels
gradle-pluginfeatured-gradle-plugin workfeatured-gradle-plugin workiosiOS-specific workiOS-specific worktestingTests and coverageTests and coverage
Activity
kirich1409 commentedon Nov 6, 2026
Backlog: Bugfix FEA-2.
kirich1409 commentedon Nov 6, 2026
Decided: proof is a small Swift fixture compiled with the generated DISABLE_ condition, not the sample iosApp. Task FEA-2.
kirich1409 commentedon Nov 6, 2026
Closed from the generated-condition proof in #313, merged as 14436c4.
:featured-swift-dce-testscompiles a symbol guarded by#if !DISABLE_*with the plugin-generatedDISABLE_*condition, not a hand-written one and notiosApp. The check fails if that condition is missing or does not match the flag. On this machine the compile ran and the guarded symbol was absent whendefault = false. CIBuild iOSpassed with-PrequireSwiftDce=true, so a skipped Swift compile was not treated as a pass.