From 7d2a0c38ee6ad4de0d6c2f713d46f669a26ffebd Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Fri, 14 Aug 2026 11:29:57 -0700 Subject: [PATCH] Keep the Project Attributes When Fastlane Writes the Project --- fastlane/Fastfile | 2 ++ fastlane/xcodeproj_patch.rb | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 fastlane/xcodeproj_patch.rb diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5e1e2e0f..b52ff6a4 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -6,6 +6,8 @@ # SPDX-License-Identifier: MIT # +require_relative "xcodeproj_patch" + default_platform(:ios) APP_CONFIG = { diff --git a/fastlane/xcodeproj_patch.rb b/fastlane/xcodeproj_patch.rb new file mode 100644 index 00000000..1a806324 --- /dev/null +++ b/fastlane/xcodeproj_patch.rb @@ -0,0 +1,30 @@ +# +# This source file is part of the My Heart Counts iOS open-source project +# +# SPDX-FileCopyrightText: 2026 Stanford University and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +require "xcodeproj" + +# Xcodeproj drops attributes it does not know when it writes a project back, and it does not know +# the traits Xcode records for a package reference or the destination it records for a copy files +# build phase. Fastlane opens and saves the project to set the bundle identifier and the build +# number, so a deployment silently removed the package traits and the destination of the phases +# that embed the watch app and the extensions. Declaring both keeps the round trip lossless. +# +# This can be removed once Xcodeproj knows the attributes itself. +module Xcodeproj + class Project + module Object + class XCRemoteSwiftPackageReference < AbstractObject + attribute :traits, Array + end + + class PBXCopyFilesBuildPhase < AbstractBuildPhase + attribute :dstSubfolder, String + end + end + end +end