Compare commits

..

5 Commits

Author SHA1 Message Date
Bartosz Polaczyk 6a1335ea97 Merge pull request #218 from polac24/support-
[Cocoapods] Ensure the source build phase exist before enabling xcrc
2023-08-01 10:50:27 +02:00
Bartosz Polaczyk be87c3779e Bump version 2023-07-29 23:11:58 -07:00
Bartosz Polaczyk 2c23632732 fix module 2023-07-29 22:55:23 -07:00
Bartosz Polaczyk b048393eb0 Define module of the source phase 2023-07-29 22:51:52 -07:00
Bartosz Polaczyk 8955cb2750 Bail out if source build phase phase doesnt exist 2023-07-29 22:46:54 -07:00
2 changed files with 8 additions and 1 deletions
@@ -409,6 +409,11 @@ module CocoapodsXCRemoteCacheModifier
File.write(LLDB_INIT_PATH, lldbinit_lines.join("\n"), mode: "w")
end
# Contrary to AbstractTarget.source_build_phase, it only finds a build phase, without creating one if it doesn't exist
def self.find_source_build_phase(target)
target.build_phases.find { |bp| bp.class == Xcodeproj::Project::Object::PBXSourcesBuildPhase }
end
Pod::HooksManager.register('cocoapods-xcremotecache', :pre_install) do |installer_context|
# The main responsibility of that hook is forcing Pods regeneration when XCRemoteCache is enabled for the first time
# In the post_install hook, this plugin adds extra build settings and steps to all Pods targets, but only when XCRemoteCache
@@ -520,6 +525,8 @@ module CocoapodsXCRemoteCacheModifier
# Attach XCRemoteCache to Pods targets
# Enable only for native targets which can have compilation steps
installer_context.pods_project.native_targets.each do |target|
# Ensure the PBXSourcesBuildPhase exists as the flow would unnecessary create an empty source build phase otherwise
next if find_source_build_phase(target).nil?
next if target.source_build_phase.files_references.empty?
next if target.name.start_with?("Pods-")
next if target.name.end_with?("Tests")
@@ -13,5 +13,5 @@
# limitations under the License.
module CocoapodsXcremotecache
VERSION = "0.0.17"
VERSION = "0.0.18"
end