Skip to content

fix(Podfile): update __parseForDeclarations RE to locate deploymentTarget - #1754

Open
erisu wants to merge 1 commit into
apache:masterfrom
erisu:fix/pod-parse-for-declarations
Open

erisu wants to merge 1 commit into
apache:masterfrom
erisu:fix/pod-parse-for-declarations

Conversation

@erisu

@erisu erisu commented Nov 16, 2026

Copy link
Copy Markdown
Member

Motivation and Context

Fixes #1751

Description

The internal method __parseForDeclarations had a regular expression of /platform :ios,\s+'[^']+'/ which was trying to match a line similar to:

platform :ios, '13.0'.

The version number has been replaced with a variable deploymentTarget so the line will always be:

platform :ios, deploymentTarget

This PR updated the regular expression to become /platform :ios, deploymentTarget/.

Testing

  • npm t
  • Created Cordova project and added a plugin with Pods.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@erisu erisu changed the title fix(pod): update regex, look for deploymentTarget in parse for declarations fix(Podfile): update __parseForDeclarations RE to locate deploymentTarget Nov 16, 2026
@erisu
erisu requested a review from dpogue November 16, 2026 11:02
@codecov-commenter

codecov-commenter commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.90%. Comparing base (c9a290e) to head (0c35f95).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1754      +/-   ##
==========================================
+ Coverage   82.75%   82.90%   +0.15%     
==========================================
  Files          17       17              
  Lines        5242     5242              
==========================================
+ Hits         4338     4346       +8     
+ Misses        904      896       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dpogue dpogue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine as-is, since it only strictly needs to support the latest project format, but I slightly prefer the flexibility of the regex offered in the issue that can handle both new and old projects.

@itbeyond

itbeyond commented Nov 19, 2026 •

Copy link
Copy Markdown

I installed this fix but also needed use_module_headers! to to resolve Firebase issues with this in the Podfile.js

Podfile.prototype.getTemplate = function () {
    return '# DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
        `${this.sourceToken}\n` +
        `deploymentTarget = '${this.minDeploymentTarget}'\n` +
        'if deploymentTarget < \'15.0\' && `xcodebuild -version`.lines.first.split(\' \')[1].to_i >= 27\n' +
        '\tdeploymentTarget = \'15.0\'\n' +
        'end\n' +
        'platform :ios, deploymentTarget\n' +
        'use_modular_headers!\n' +
        `${this.declarationToken}\n` +
        'target \'App\' do\n' +
        '\tproject \'App.xcodeproj\'\n' +
        `${this.podToken}\n` +
        'end\n\n' +
        'post_install do |installer|\n' +
        '  installer.pods_project.targets.each do |target|\n' +
        '    target.build_configurations.each do |config|\n' +
        '      if config.build_settings[\'IPHONEOS_DEPLOYMENT_TARGET\'].to_f < 15.0\n' +
        '        config.build_settings[\'IPHONEOS_DEPLOYMENT_TARGET\'] = \'15.0\'\n' +
        '      end\n' +
        '    end\n' +
        '  end\n' +
        'end\n';
};

One part to add use_module_headers and the post install to update the deployment targets to ensure xcode can compile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use_frameworks! (and other Podfile declarations) dropped in 8.2.0 because the declaration parser no longer matches the new platform :ios line

4 participants