From 0e48d398186174c521d16be59fb9f21024c93931 Mon Sep 17 00:00:00 2001 From: Bartosz Polaczyk Date: Wed, 9 Feb 2022 17:52:31 +0100 Subject: [PATCH] [Integrate] Move prebuild script right before compilation --- .../Commands/Prepare/Integrate/XcodeProjIntegrate.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/XCRemoteCache/Commands/Prepare/Integrate/XcodeProjIntegrate.swift b/Sources/XCRemoteCache/Commands/Prepare/Integrate/XcodeProjIntegrate.swift index 7e7c27b3..95360ac5 100644 --- a/Sources/XCRemoteCache/Commands/Prepare/Integrate/XcodeProjIntegrate.swift +++ b/Sources/XCRemoteCache/Commands/Prepare/Integrate/XcodeProjIntegrate.swift @@ -227,11 +227,11 @@ struct XcodeProjIntegrate: Integrate { let previousRCPhases = target.buildPhases.filter(isRCPhase) target.buildPhases.removeAll(where: previousRCPhases.contains) - if target.buildPhases.map(\.buildPhase).contains(.sources) { + if let sourceIndex = target.buildPhases.map(\.buildPhase).firstIndex(of: .sources) { // add (pre|post)build phases only when a target has some compilation steps // otherwise they make no sense (nothing to store in an artifact) pbxproj.add(object: prebuildPhase) - target.buildPhases.insert(prebuildPhase, at: 0) + target.buildPhases.insert(prebuildPhase, at: sourceIndex) pbxproj.add(object: postbuildPhase) target.buildPhases.append(postbuildPhase) }