Skip to content

Commit 75563b1

Browse files
committed
Rework how the build settings are exported
1 parent 4c958df commit 75563b1

File tree

8 files changed

+31
-18
lines changed

8 files changed

+31
-18
lines changed

.github/workflows/main.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ jobs:
4444
sed -i '' "s/$TEAMID/ RJNC97Y8QD;/g" Swiftcord.xcodeproj/project.pbxproj
4545
4646
- name: "Archive"
47-
env:
48-
APPCENTER_APP_SECRET: ${{ secrets.APPCENTER_APP_SECRET }}
49-
run: xcodebuild -workspace Swiftcord.xcworkspace -scheme Swiftcord -configuration Release archive -archivePath Swiftcord.xcarchive COMPILER_INDEX_STORE_ENABLE=NO | xcpretty
47+
run: xcodebuild -workspace Swiftcord.xcworkspace -scheme Swiftcord -configuration Release archive -archivePath Swiftcord.xcarchive COMPILER_INDEX_STORE_ENABLE=NO APPCENTER_APP_SECRET="${{ secrets.APPCENTER_APP_SECRET }}" | xcpretty
5048

5149
- name: "Export & Sign Release Build"
5250
uses: devbotsxyz/xcode-export-archive@main

Scripts/export-build-settings-to-swift.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ set -o nounset
66
export PATH=${PATH}:/usr/local/bin
77
export LC_ALL="en_US.UTF-8"
88

9-
BUILD_SETTINGS_OUTPUT_PATH="${BUILD_SETTINGS_OUTPUT_PATH?error: Build settings output path is not available via the 'BUILD_SETTINGS_OUTPUT_PATH' environment variable}"
9+
BUILD_SETTINGS_SWIFT_SOURCE_PATH="${BUILD_SETTINGS_SWIFT_SOURCE_PATH?error: Build settings Swift output path is not available via the 'BUILD_SETTINGS_SWIFT_SOURCE_PATH' environment variable}"
10+
11+
echo "Writing build settings to ${BUILD_SETTINGS_SWIFT_SOURCE_PATH}"
1012

1113
# Write the file contents out - if you want to export more build settings, this is the place to do it.
12-
cat >"${BUILD_SETTINGS_OUTPUT_PATH}" <<EOS
14+
cat >"${BUILD_SETTINGS_SWIFT_SOURCE_PATH}" <<EOS
1315
// #### YOUR CHANGES WILL BE OVERWRITTEN! ####
1416
//
1517
// Please do not make changes to this file - it is updated during and ignored by source control as a result of the build process.

Swiftcord.xcodeproj/project.pbxproj

+20-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
36367146283C1B6500A5CBE6 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36367144283C19E500A5CBE6 /* AVKit.framework */; };
1111
3684BB59283C696E005045AE /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 3684BB58283C696E005045AE /* Sparkle */; };
1212
3684BB5B283C69C5005045AE /* Sparkle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3684BB5A283C69C5005045AE /* Sparkle.swift */; };
13-
900F6D97284A141D000B6D29 /* GeneratedBuildEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 900F6D96284A141D000B6D29 /* GeneratedBuildEnvironment.swift */; };
13+
900F6DA1284A1C0C000B6D29 /* GeneratedBuildSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 900F6DA0284A1C0C000B6D29 /* GeneratedBuildSettings.swift */; };
1414
DA2384A127CB9714009E15E0 /* Font+.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2384A027CB9714009E15E0 /* Font+.swift */; };
1515
DA2384BA27CBC2CE009E15E0 /* GintoBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = DA2384B827CBC2CE009E15E0 /* GintoBold.otf */; };
1616
DA2384BB27CBC2CE009E15E0 /* GintoMedium.otf in Resources */ = {isa = PBXBuildFile; fileRef = DA2384B927CBC2CE009E15E0 /* GintoMedium.otf */; };
@@ -95,7 +95,10 @@
9595
36004E1C283D63E500F0BA73 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
9696
36367144283C19E500A5CBE6 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = System/Library/Frameworks/AVKit.framework; sourceTree = SDKROOT; };
9797
3684BB5A283C69C5005045AE /* Sparkle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sparkle.swift; sourceTree = "<group>"; };
98-
900F6D96284A141D000B6D29 /* GeneratedBuildEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneratedBuildEnvironment.swift; sourceTree = "<group>"; };
98+
900F6D9D284A1A92000B6D29 /* Project Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project Shared.xcconfig"; sourceTree = "<group>"; };
99+
900F6D9E284A1ADE000B6D29 /* Project Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project Debug.xcconfig"; sourceTree = "<group>"; };
100+
900F6D9F284A1AE6000B6D29 /* Project Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Project Release.xcconfig"; sourceTree = "<group>"; };
101+
900F6DA0284A1C0C000B6D29 /* GeneratedBuildSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedBuildSettings.swift; sourceTree = "<group>"; };
99102
DA23843827CB934D009E15E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
100103
DA2384A027CB9714009E15E0 /* Font+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+.swift"; sourceTree = "<group>"; };
101104
DA2384B827CBC2CE009E15E0 /* GintoBold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = GintoBold.otf; sourceTree = "<group>"; };
@@ -194,6 +197,16 @@
194197
/* End PBXFrameworksBuildPhase section */
195198

196199
/* Begin PBXGroup section */
200+
900F6D9C284A1A75000B6D29 /* Configurations */ = {
201+
isa = PBXGroup;
202+
children = (
203+
900F6D9D284A1A92000B6D29 /* Project Shared.xcconfig */,
204+
900F6D9E284A1ADE000B6D29 /* Project Debug.xcconfig */,
205+
900F6D9F284A1AE6000B6D29 /* Project Release.xcconfig */,
206+
);
207+
path = Configurations;
208+
sourceTree = "<group>";
209+
};
197210
DA23843C27CB9621009E15E0 /* Fonts */ = {
198211
isa = PBXGroup;
199212
children = (
@@ -278,6 +291,7 @@
278291
DA4A888627C0AF3000720909 /* Swiftcord */ = {
279292
isa = PBXGroup;
280293
children = (
294+
900F6D9C284A1A75000B6D29 /* Configurations */,
281295
DA520ABD27D322F0009FD740 /* Resources */,
282296
DA4A88E327C3481700720909 /* Views */,
283297
DA7720CE283F182700D3C335 /* Commands */,
@@ -286,7 +300,7 @@
286300
DA4A888727C0AF3000720909 /* SwiftcordApp.swift */,
287301
DA2802782808337B00B14E5C /* AppDelegate.swift */,
288302
DA4A889027C0AF3200720909 /* Persistence.swift */,
289-
900F6D96284A141D000B6D29 /* GeneratedBuildEnvironment.swift */,
303+
900F6DA0284A1C0C000B6D29 /* GeneratedBuildSettings.swift */,
290304
DA4A889527C0AF3200720909 /* Swiftcord.entitlements */,
291305
DA23843827CB934D009E15E0 /* Info.plist */,
292306
DA2ADF2F2847B13F004A35F2 /* Localizable.strings */,
@@ -626,6 +640,7 @@
626640
E7AF1C27282FA3ED001F78DF /* Array.Channel+.swift in Sources */,
627641
DA520AC327D37873009FD740 /* MergePartialMessage.swift in Sources */,
628642
E7AF1C36282FC2E8001F78DF /* NSTextView+.swift in Sources */,
643+
900F6DA1284A1C0C000B6D29 /* GeneratedBuildSettings.swift in Sources */,
629644
DA32EF3027C676B300A9ED72 /* WrapperLottieView.swift in Sources */,
630645
DA32EF3927C77E3300A9ED72 /* AttachmentView.swift in Sources */,
631646
DA2384A127CB9714009E15E0 /* Font+.swift in Sources */,
@@ -637,7 +652,6 @@
637652
DA54D5762844B9C500B11857 /* CurrentUser+.swift in Sources */,
638653
DA520AD727D4D17A009FD740 /* MiscSettingsView.swift in Sources */,
639654
DA32EF3F27C7C1D000A9ED72 /* MessageInputView.swift in Sources */,
640-
900F6D97284A141D000B6D29 /* GeneratedBuildEnvironment.swift in Sources */,
641655
DA520AD327D4D073009FD740 /* AppSettingsView.swift in Sources */,
642656
DA54D5812846495A00B11857 /* ReversingOpacity.swift in Sources */,
643657
DA4A889C27C0B23C00720909 /* WebView.swift in Sources */,
@@ -705,6 +719,7 @@
705719
/* Begin XCBuildConfiguration section */
706720
DA4A889627C0AF3200720909 /* Debug */ = {
707721
isa = XCBuildConfiguration;
722+
baseConfigurationReference = 900F6D9E284A1ADE000B6D29 /* Project Debug.xcconfig */;
708723
buildSettings = {
709724
ALWAYS_SEARCH_USER_PATHS = NO;
710725
CLANG_ANALYZER_NONNULL = YES;
@@ -767,6 +782,7 @@
767782
};
768783
DA4A889727C0AF3200720909 /* Release */ = {
769784
isa = XCBuildConfiguration;
785+
baseConfigurationReference = 900F6D9F284A1AE6000B6D29 /* Project Release.xcconfig */;
770786
buildSettings = {
771787
ALWAYS_SEARCH_USER_PATHS = NO;
772788
CLANG_ANALYZER_NONNULL = YES;

Swiftcord.xcodeproj/xcshareddata/xcschemes/Swiftcord.xcscheme

+2-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
1111
<ActionContent
1212
title = "Export Build Environment to Swift"
13-
scriptText = "BUILD_SETTINGS_OUTPUT_PATH=&quot;${SOURCE_ROOT}/${PRODUCT_NAME}/GeneratedBuildSettings.swift&quot;&#10;&#10;pushd &quot;${SOURCE_ROOT}&quot;&#10;&#10;# Ensure that changes to the build settings file do not affect the output build information while we&apos;re building a release build.&#10;git update-index --assume-unchanged &quot;${BUILD_SETTINGS_OUTPUT_PATH}&quot;&#10;&#10;# Generate the output file&#10;&quot;${SOURCE_ROOT}/Scripts/export-build-settings-to-swift.sh&quot;&#10;&#10;popd&#10;">
13+
scriptText = "pushd &quot;${SOURCE_ROOT}&quot;&#10;&#10;# Ensure that changes to the build settings file do not affect the output build information while we&apos;re building a release build.&#10;git update-index --assume-unchanged &quot;${BUILD_SETTINGS_SWIFT_SOURCE_PATH}&quot;&#10;&#10;# Generate the output file&#10;&quot;${SOURCE_ROOT}/Scripts/export-build-settings-to-swift.sh&quot;&#10;&#10;popd&#10;">
1414
<EnvironmentBuildable>
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
@@ -28,7 +28,7 @@
2828
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
2929
<ActionContent
3030
title = "Reset Exported Build Environment"
31-
scriptText = "BUILD_SETTINGS_OUTPUT_PATH=&quot;${SOURCE_ROOT}/${PRODUCT_NAME}/GeneratedBuildSettings.swift&quot;&#10;&#10;pushd &quot;${SOURCE_ROOT}&quot;&#10;&#10;# Restore the original build settings output file&#10;git update-index --no-assume-unchanged &quot;${BUILD_SETTINGS_OUTPUT_PATH}&quot;&#10;git checkout &quot;${BUILD_SETTINGS_OUTPUT_PATH}&quot;&#10;&#10;popd&#10;">
31+
scriptText = "pushd &quot;${SOURCE_ROOT}&quot;&#10;&#10;# Restore the original build settings output file&#10;git update-index --no-assume-unchanged &quot;${BUILD_SETTINGS_SWIFT_SOURCE_PATH}&quot;&#10;git checkout &quot;${BUILD_SETTINGS_SWIFT_SOURCE_PATH}&quot;&#10;&#10;popd&#10;">
3232
<EnvironmentBuildable>
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
@@ -87,13 +87,6 @@
8787
ReferencedContainer = "container:Swiftcord.xcodeproj">
8888
</BuildableReference>
8989
</BuildableProductRunnable>
90-
<EnvironmentVariables>
91-
<EnvironmentVariable
92-
key = "APPCENTER_APP_SECRET"
93-
value = "Enter a valid AppCenter App Secret here and enable this environment variable if you want to test AppCenter"
94-
isEnabled = "NO">
95-
</EnvironmentVariable>
96-
</EnvironmentVariables>
9790
</LaunchAction>
9891
<ProfileAction
9992
buildConfiguration = "Release"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "Project Shared.xcconfig"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "Project Shared.xcconfig"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APPCENTER_APP_SECRET=
2+
BUILD_SETTINGS_SWIFT_SOURCE_PATH=$(SOURCE_ROOT)/$(PRODUCT_NAME)/GeneratedBuildSettings.swift

0 commit comments

Comments
 (0)