Skip to content
This repository has been archived by the owner on Sep 20, 2020. It is now read-only.

Commit

Permalink
Add support for preference to strip debug symbols from pods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Alden committed Jul 1, 2019
1 parent 9e2b72a commit 465288b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,31 @@ Plugin developers, here's a sample plugin.xml.
<dependency id="cordova-plugin-cocoapod-supportx"/>

<platform name="ios">
<!-- optionally set minimum ios version and enable use_frameworks! -->
<pods-config ios-min-version="9.0" use-frameworks="true">
<!-- optionally set minimum ios version, enable use_frameworks and strip debug symbols -->
<pods-config ios-min-version="9.0" use-frameworks="true" strip-debug="true">
<!-- optionally add private spec sources -->
<source url="[email protected]:foo/foo-specs.git"/>
<source url="[email protected]:bar/bar-specs.git"/>
</pods-config>

<!-- use the latest version of a pod -->
<pod name="LatestPod" />

<!-- use a specific version of a pod -->
<pod name="VersionedPod" version="1.0.0" />

<!-- use a custom repo -->
<pod name="GitPod1" git="https://github.com/blakgeek/something" tag="v1.0.1" />
<pod name="GitPod2" git="https://github.com/blakgeek/something" branch="wood" />
<pod name="GitPod3" git="https://github.com/blakgeek/something" commit="1b33368" />

<!-- target specific configurations, this can be combined with all other options -->
<pod name="Foobar" configuration="debug" />
<pod name="Foobar" configurations="release,debug" />

<!-- add a pod dependency using a custom podspec -->
<pod name="JSONKit" podspec="https://example.com/JSONKit.podspec" />

<!-- add pod dependency using the spec parameter like a Cordova framework -->
<pod name="JustLikeCordova" spec="~> 2.0.0"/>
<pod name="JustLikeCordova" spec=":configurations => ['Debug', 'Beta']"/>
Expand All @@ -92,24 +98,35 @@ This is useful if you need to resolve conflicts between plugins or if a plugin d
<platform name="ios">
<!-- set platform :ios, defaults to 7.0 -->
<preference name="pods_ios_min_version" value="8.0"/>

<!-- add use_frameworks! to Podfile, this also disabled bridging headers -->
<preference name="pods_use_frameworks" value="true"/>

<!-- strips debug symbols from pods - see https://stackoverflow.com/a/48518656/777265 -->
<preference name="pods_strip_debug" value="true"/>

<!-- use the latest version of a pod -->
<pod name="LatestPod" />

<!-- use a specific version of a pod -->
<pod name="VersionedPod" version="1.0.0" />

<!-- use a custom repo -->
<pod name="GitPod1" git="https://github.com/blakgeek/something" tag="v1.0.1" />
<pod name="GitPod2" git="https://github.com/blakgeek/something" branch="wood" />
<pod name="GitPod3" git="https://github.com/blakgeek/something" commit="1b33368" />

<!-- target specific configurations, this can be combined with all other options -->
<pod name="Foobar" configuration="debug" />
<pod name="Foobar" configurations="release,debug" />

<!-- add a pod dependency using a custom podspec -->
<pod name="JSONKit" podspec="https://example.com/JSONKit.podspec" />

<!-- add a pod dependency using the spec parameter like a Cordova framework -->
<pod name="JustLikeCordova" spec="~> 2.0.0"/>
<pod name="JustLikeCordova" spec=":configurations => ['Debug', 'Beta']"/>

<!-- if pod uses a bundle that isn't compatible with Cocoapods 1.x -->
<pod name="BadBundle" fix-bundle-path="Bad/Path.bundle"/>
</platform>
Expand Down
16 changes: 16 additions & 0 deletions scripts/podify.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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}`);
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 465288b

Please sign in to comment.