From 465288bafcf42805be1ca1cc9cc4f2e58a57283a Mon Sep 17 00:00:00 2001 From: Dave Alden Date: Mon, 1 Jul 2019 17:04:58 +0100 Subject: [PATCH] Add support for preference to strip debug symbols from pods. See https://stackoverflow.com/a/48518656/777265 See https://github.com/dpa99c/cordova-plugin-firebase/issues/28 --- README.md | 21 +++++++++++++++++++-- scripts/podify.js | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) mode change 100755 => 100644 scripts/podify.js diff --git a/README.md b/README.md index 5ed0d57..b8353e2 100644 --- a/README.md +++ b/README.md @@ -52,25 +52,31 @@ Plugin developers, here's a sample plugin.xml. - - + + + + + + + + @@ -92,24 +98,35 @@ This is useful if you need to resolve conflicts between plugins or if a plugin d + + + + + + + + + + + diff --git a/scripts/podify.js b/scripts/podify.js old mode 100755 new mode 100644 index f539d28..3a7b33f --- a/scripts/podify.js +++ b/scripts/podify.js @@ -30,6 +30,7 @@ module.exports = function (context) { oldMinVersion || '7.0'; var overrideiOSMinVersion; var useFrameworks = configParser.getPreference('pods_use_frameworks', 'ios') || configParser.getPreference('pods_use_frameworks') || 'false'; + var stripDebugSymbols = configParser.getPreference('pods_strip_debug', 'ios') || configParser.getPreference('pods_strip_debug') || 'false'; var podConfigPath = path.join(rootPath, 'platforms', 'ios', '.pods.json'); var pod, podName; var podified = fs.existsSync(podConfigPath); @@ -136,8 +137,10 @@ module.exports = function (context) { const podsConfig = (platform['pods-config'] || [])[0]; if (podsConfig) { + debug(`found pods-config in ${id}`); overrideiOSMinVersion = podsConfig.$ ? podsConfig.$['ios-min-version'] : null; useFrameworks = podsConfig.$ && podsConfig.$['use-frameworks'] === 'true' ? 'true' : useFrameworks; + stripDebugSymbols = podsConfig.$ && podsConfig.$['strip-debug'] ? podsConfig.$['strip-debug'] : stripDebugSymbols; (podsConfig.source || []).forEach(function (podSource) { log(`${id} requires pod source: ${podSource.$.url}`); @@ -253,6 +256,19 @@ module.exports = function (context) { podfileContents.push(`\tpod '${podName}'${suffix}`); } podfileContents.push('end'); + + stripDebugSymbols = applyPluginVariables(stripDebugSymbols); + if(stripDebugSymbols === 'true'){ + log("Stripping debug symbols from pods"); + podfileContents.push("post_install do |installer|\n" + + " installer.pods_project.targets.each do |target|\n" + + " target.build_configurations.each do |config|\n" + + " config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'\n" + + " end\n" + + " end\n" + + "end") + } + fs.writeFileSync('platforms/ios/Podfile', podfileContents.join('\n')); var debugXcContents = fs.readFileSync('platforms/ios/cordova/build-debug.xcconfig', 'utf8');