NativeScript / NativeScript/nativescript-cli
Can the Podfile generation better handle logical blocks
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 1.1k
- フォーク
- 204
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 8
説明
Is your feature request related to a problem? Please describe.
I wish I could apply variable logic when defining iOS deployment target in the application Podfile.
To set the IPHONEOS_DEPLOYMENT_TARGET we must define the platform version in two separate files to ensure both the target application and all dependencies meet our minimum desired version.
- App_Resources/iOS/build.xcconfig
IPHONEOS_DEPLOYMENT_TARGET=16 - App_Resources/iOS/Podfile
platform :ios, '16.0'
As suggested in the troubleshooting documentation, to ensure that all dependencies are also configured to this target it is suggested that we do the following... which works fine.
platform :ios, '13.0'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
This makes 3 places where I need to update the target version for iOS.
Inspired by this answer, if I try to apply any kind of logic in the application Podfile, it is either stripped by the CocoaPodsPlatformManager or ignored altogether.
Doing this:
app_ios_deployment_target = Gem::Version.new('16.0')
platform :ios, app_ios_deployment_target.version
Results in this:
platform :ios,
It looks like the Regex is trying to match a platform within quotes('") only.
^\\s*?#\\s*?(platform\\b\\s*?\\:\\s*?ios\\b(?:,\\s*?['"](.+)['"])?)
Ruby will also complain the variable app_ios_deployment_target does not exist, which is true because only the line matched by the Regex above is hoisted above any post_install hooks and all other code blocks are lost.
Describe the solution you'd like
It would be great if CocoaPodsPlatformManager.selectPlatformDataFromProjectPodfile could be expanded to match other expressions.
It would also be great if all other lines that are not the platform definition and are outside of hooks are hoisted first, so that variables could be used.
This could mean that we can have one source of truth when defining the iOS target. Which could be in App_Resources/iOS/build.xcconfig and the read from the Podfile, or better yet an environment variable.
Describe alternatives you've considered
No response
Anything else?
No response
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- I agree to follow this project's Code of Conduct
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
lib/services/cocoapods-platform-manager.ts から始め、特に selectPlatformDataFromProjectPodfile とそのプラットフォーム照合式を確認します。Podfile の行がどのように引き上げられるか、また引用符で囲まれていない Ruby 式と hooks の外側にあるコードがどのように扱われるかを追跡します。要求された変数ベースの deployment target と前提条件の行が削除されずに引き続き使用できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ruby, typescript
- 領域
- cli, mobile
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100