apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 989 forks source link

Variables specified in pod options of podspec are not being replaced #1125

Closed filipemvpereira closed 1 year ago

filipemvpereira commented 3 years ago

Bug Report

Problem

Variables defined in plugin.xml which are being used podspec -> pods -> pod are not being replaced after installation. Running a command like:

cordova plugin add ../cordova-plugin-custom 
    --variable IOS_POD_URL="https://github.com/private_pod"  
    --variable IOS_POD_TAG="1.0.0"

What is expected to happen?

The variables passed should be replaced at the time of platform/plugin installation.

source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
use_frameworks!
target 'Test' do
    project 'Test.xcodeproj'
    pod 'PrivatePod', :tag => '1.0.0, :git => 'https://github.com/private_pod'
end

What does actually happen?

The variables are not getting replaced for some options of Cocoapods.

source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
use_frameworks!
target 'Test' do
    project 'Test.xcodeproj'
    pod 'PrivatePod', :tag => '$IOS_POD_TAG', :git => '$IOS_POD_URL'
end

Information

I found a similar issue, but the fix was made only for the "spec" option. "tag" and "git" pod options are not being replaced

Command or Code

In plugin.xml, inside platform name="ios"

<preference name="IOS_POD_URL" default="" />
<preference name="IOS_POD_TAG" default="1.0.0" />

<podspec>
      <config>
        <source url="https://cdn.cocoapods.org/"/>  
      </config>
      <pods use-frameworks="true">
        <pod name="PRIVATE_POD" git='$IOS_POD_URL' tag='$IOS_POD_TAG'/>
      </pods>
    </podspec>

Environment, Platform

Version information

Checklist