First attempt targeted only `target_installation_results.resource_bundle_targets` — too narrow. With privacyManifestAggregationEnabled the Pods project has additional bundle targets (aggregated privacy manifests) that also need code-signing disabled. Brute-force fix: set CODE_SIGNING_ALLOWED/REQUIRED = NO and clear EXPANDED_CODE_SIGN_IDENTITY on every target in installer.pods_project — pod targets don't need signing, only the main app does. Added a Pod::UI.puts so we can see the fix run in the EAS build log. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
70 lines
3.0 KiB
JavaScript
70 lines
3.0 KiB
JavaScript
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
/**
|
|
* Fix für: "Starting from Xcode 14, resource bundles are signed by default,
|
|
* which requires setting the development team for each resource bundle target."
|
|
*
|
|
* Grund: wir bauen mit `useFrameworks: "static"` (expo-build-properties) — dabei
|
|
* erzeugt CocoaPods für jeden Pod mit Ressourcen ein Resource-Bundle-Target, und
|
|
* Xcode 14+ will die signieren (mit einem Development-Team). EAS-Build hat keins
|
|
* für diese Targets → Build bricht ab.
|
|
*
|
|
* Lösung: im Podfile-`post_install`-Hook für alle Resource-Bundle-Targets
|
|
* `CODE_SIGNING_ALLOWED = NO` setzen — die brauchen keine Signatur.
|
|
*
|
|
* Der Podfile hat schon EINEN `post_install do |installer|`-Block (mit
|
|
* `react_native_post_install`) — ein zweiter würde den ersten ersetzen, also
|
|
* injizieren wir IN den bestehenden Block (gleich nach dem `do |installer|`).
|
|
* Läuft als withDangerousMod('ios') während `expo prebuild`, bevor `pod install`.
|
|
* Idempotent via Marker-Kommentar.
|
|
*/
|
|
const { withDangerousMod } = require('@expo/config-plugins');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const MARKER = '# REBREAK_RESOURCE_BUNDLE_SIGNING_FIX';
|
|
|
|
const FIX = `
|
|
${MARKER}
|
|
# Xcode 14+ signiert Resource-Bundles per default -> braucht ein Dev-Team.
|
|
# Mit static frameworks (+ privacyManifestAggregationEnabled) erzeugen Pods
|
|
# mehrere Bundle-Targets (Resource-Bundles, aggregierte Privacy-Manifests).
|
|
# Brute-Force: Code-Signing auf JEDEM Target im Pods-Projekt abschalten —
|
|
# Pod-Targets brauchen keine Signatur, nur die Main-App.
|
|
installer.pods_project.targets.each do |t|
|
|
t.build_configurations.each do |config|
|
|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
|
config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
|
|
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ''
|
|
end
|
|
end
|
|
Pod::UI.puts " -> Disabled code signing on \#{installer.pods_project.targets.count} pod targets".green
|
|
${MARKER}
|
|
`;
|
|
|
|
module.exports = function withResourceBundleSigningFix(config) {
|
|
return withDangerousMod(config, [
|
|
'ios',
|
|
async (cfg) => {
|
|
const podfilePath = path.join(cfg.modRequest.platformProjectRoot, 'Podfile');
|
|
if (!fs.existsSync(podfilePath)) {
|
|
console.warn('[with-resource-bundle-signing-fix] Podfile not found at', podfilePath);
|
|
return cfg;
|
|
}
|
|
let podfile = fs.readFileSync(podfilePath, 'utf-8');
|
|
if (podfile.includes(MARKER)) {
|
|
return cfg; // schon gepatcht
|
|
}
|
|
// Direkt nach dem (einzigen) `post_install do |installer|` einfügen.
|
|
const anchorRe = /(post_install do \|installer\|[^\n]*\n)/;
|
|
if (!anchorRe.test(podfile)) {
|
|
console.warn('[with-resource-bundle-signing-fix] no `post_install do |installer|` block found — skipping');
|
|
return cfg;
|
|
}
|
|
podfile = podfile.replace(anchorRe, `$1${FIX}`);
|
|
fs.writeFileSync(podfilePath, podfile);
|
|
console.log('[with-resource-bundle-signing-fix] patched Podfile post_install');
|
|
return cfg;
|
|
},
|
|
]);
|
|
};
|