【CocoaPods】一度pod installしたプラグインを、Podfileから消せば再install時に削除されるか否か
知りたいこと
Podfileで以前にpod {hoge}
を記述しpod install
したライブラリなどは、その際に書いたpod {hoge}
を削除して再pod install
すれば消えてくれるのか
結論
消せず、残る。
背景
Firebase for Flutter
を実施中、ビルドエラーの原因を勘違いしてマニュアル外であるPodfileの操作を誤って行ってしまったため。
検証
下記Podfile中のpod 'Firebase/Core'
を削除したい。
削除前
Podsの中
BoringSSL FirebaseAuthInterop FirebaseInstanceID Headers Protobuf leveldb-library Firebase FirebaseCore GTMSessionFetcher Local Podspecs Target Support Files nanopb FirebaseAnalytics FirebaseDatabase GoogleAppMeasurement Manifest.lock gRPC-C++ FirebaseAuth FirebaseFirestore GoogleUtilities Pods.xcodeproj gRPC-Core
FirebaseCore が消えるかどうか。
Podfileで以前追記したpod 'Firebase/Core'
を消す。
# Uncomment this line to define a global platform for your project # platform :ios, '9.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, } def parse_KV_file(file, separator='=') file_abs_path = File.expand_path(file) if !File.exists? file_abs_path return []; end pods_ary = [] skip_line_start_symbols = ["#", "/"] File.foreach(file_abs_path) { |line| next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } plugin = line.split(pattern=separator) if plugin.length == 2 podname = plugin[0].strip() path = plugin[1].strip() podpath = File.expand_path("#{path}", file_abs_path) pods_ary.push({:name => podname, :path => podpath}); else puts "Invalid plugin specification: #{line}" end } return pods_ary end target 'Runner' do # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. system('rm -rf .symlinks') system('mkdir -p .symlinks/plugins') # Flutter Pods generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') if generated_xcode_build_settings.empty? puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." end generated_xcode_build_settings.map { |p| if p[:name] == 'FLUTTER_FRAMEWORK_DIR' symlink = File.join('.symlinks', 'flutter') File.symlink(File.dirname(p[:path]), symlink) pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) end } # Plugin Pods plugin_pods = parse_KV_file('../.flutter-plugins') plugin_pods.map { |p| symlink = File.join('.symlinks', 'plugins', p[:name]) File.symlink(p[:path], symlink) pod p[:name], :path => File.join(symlink, 'ios') pod 'Firebase/Core' } end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' end end end
削除後、pod isntall
を実行。
実行結果
Analyzing dependencies Fetching podspec for `Flutter` from `.symlinks/flutter/ios` Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios` Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios` Downloading dependencies Using BoringSSL (10.0.6) Using Firebase (5.14.0) Using FirebaseAnalytics (5.4.0) Using FirebaseAuth (5.1.0) Using FirebaseAuthInterop (1.0.0) Using FirebaseCore (5.1.9) Using FirebaseDatabase (5.0.4) Using FirebaseFirestore (0.16.0) Using FirebaseInstanceID (3.3.0) Using Flutter (1.0.0) Using GTMSessionFetcher (1.2.1) Using GoogleAppMeasurement (5.4.0) Using GoogleUtilities (5.3.6) Using Protobuf (3.6.1) Using cloud_firestore (0.0.1) Using firebase_core (0.0.1) Using gRPC-C++ (0.0.5) Using gRPC-Core (1.14.0) Using leveldb-library (1.20) Using nanopb (0.3.901) Generating Pods project Integrating client project Pod installation complete! There are 3 dependencies from the Podfile and 20 total pods installed. [!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`. [!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
今回はfirebase_coreがインストールされていない。
pod 'Firebase/Core'
を追加したときの実行ログ。
firebase_coreがインストールされている。
Analyzing dependencies Fetching podspec for `Flutter` from `.symlinks/flutter/ios` Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios` Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios` Downloading dependencies Using BoringSSL (10.0.6) Using Firebase (5.14.0) Using FirebaseAnalytics (5.4.0) Using FirebaseAuth (5.1.0) Using FirebaseAuthInterop (1.0.0) Using FirebaseCore (5.1.9) Using FirebaseDatabase (5.0.4) Using FirebaseFirestore (0.16.0) Using FirebaseInstanceID (3.3.0) Using Flutter (1.0.0) Using GTMSessionFetcher (1.2.1) Using GoogleAppMeasurement (5.4.0) Using GoogleUtilities (5.3.6) Using Protobuf (3.6.1) Using cloud_firestore (0.0.1) Using firebase_core (0.0.1) Using gRPC-C++ (0.0.5) Using gRPC-Core (1.14.0) Using leveldb-library (1.20) Using nanopb (0.3.901) Generating Pods project Integrating client project Pod installation complete! There are 4 dependencies from the Podfile and 20 total pods installed. [!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`. [!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
削除・再インストール後
Podsの中
BoringSSL FirebaseAuthInterop FirebaseInstanceID Headers Protobuf leveldb-library Firebase FirebaseCore GTMSessionFetcher Local Podspecs Target Support Files nanopb FirebaseAnalytics FirebaseDatabase GoogleAppMeasurement Manifest.lock gRPC-C++ FirebaseAuth FirebaseFirestore GoogleUtilities Pods.xcodeproj gRPC-Core
変わりませんでした。
理由
未検証
感想
まぁそうでしょうね。
以上