Skip to content

Commit 5ce542b

Browse files
committed
Reorganize building scripts
1 parent 55902c3 commit 5ce542b

File tree

8 files changed

+135
-142
lines changed

8 files changed

+135
-142
lines changed

CrashReporter.xcodeproj/project.pbxproj

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
isa = PBXAggregateTarget;
4343
buildConfigurationList = C2B90D962456FBD000834AFB /* Build configuration list for PBXAggregateTarget "CrashReporter iOS Universal" */;
4444
buildPhases = (
45-
C2B90DAB2457178800834AFB /* Build Universal Framework */,
45+
C2B90DAB2457178800834AFB /* Build iOS Device Framework */,
46+
C2C74A842535CCC700313817 /* Build iOS Simulator Framework */,
47+
C2C74A892535CD8000313817 /* Combine iOS Universal Framework */,
4648
);
4749
dependencies = (
4850
);
@@ -1195,22 +1197,23 @@
11951197
C2B90DA6245714E900834AFB /* create-static-libs-archive.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "create-static-libs-archive.sh"; sourceTree = "<group>"; };
11961198
C2B90DA7245714E900834AFB /* verify-modifications.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "verify-modifications.sh"; sourceTree = "<group>"; };
11971199
C2B90DA8245714E900834AFB /* create-disk-image.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "create-disk-image.sh"; sourceTree = "<group>"; };
1198-
C2B90DA9245714EA00834AFB /* build-tvos-universal.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "build-tvos-universal.sh"; sourceTree = "<group>"; };
1199-
C2B90DAA245714EA00834AFB /* build-ios-universal.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "build-ios-universal.sh"; sourceTree = "<group>"; };
12001200
C2BBCD7E2456E03D00F9E820 /* PLCrashMachExceptionPortTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLCrashMachExceptionPortTests.m; sourceTree = "<group>"; };
12011201
C2BBCD7F2456E03D00F9E820 /* PLCrashAsyncDwarfEncodingTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PLCrashAsyncDwarfEncodingTests.mm; sourceTree = "<group>"; };
12021202
C2BBCD802456E03D00F9E820 /* PLCrashMachExceptionServerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLCrashMachExceptionServerTests.m; sourceTree = "<group>"; };
12031203
C2BBCD812456E03D00F9E820 /* PLCrashFrameStackUnwindTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLCrashFrameStackUnwindTests.m; sourceTree = "<group>"; };
12041204
C2BBCD822456E03D00F9E820 /* PLCrashAsyncLinkedListTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PLCrashAsyncLinkedListTests.mm; sourceTree = "<group>"; };
12051205
C2BBCD832456E03D00F9E820 /* PLCrashSysctlTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLCrashSysctlTests.m; sourceTree = "<group>"; };
12061206
C2BBCD842456E03D00F9E820 /* PLCrashAsyncMachOStringTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLCrashAsyncMachOStringTests.m; sourceTree = "<group>"; };
1207+
C2C74A852535CD3A00313817 /* combine-frameworks.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "combine-frameworks.sh"; sourceTree = "<group>"; };
1208+
C2C74A862535CD3A00313817 /* combine-xcframework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "combine-xcframework.sh"; sourceTree = "<group>"; };
1209+
C2C74A872535CD3A00313817 /* combine-libs.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "combine-libs.sh"; sourceTree = "<group>"; };
1210+
C2C74A882535CD3A00313817 /* build-framework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "build-framework.sh"; sourceTree = "<group>"; };
12071211
C2DCD87724657B24007322C5 /* DemoCrash-iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "DemoCrash-iOS.entitlements"; sourceTree = "<group>"; };
12081212
C2F0AC9F24AB7C28004890EC /* CrashReporterFramework.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CrashReporterFramework.m; sourceTree = "<group>"; };
12091213
C2F7F22F2451F081002BD8BF /* DemoCrash-tvOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DemoCrash-tvOS-Info.plist"; sourceTree = "<group>"; };
12101214
C2F7F2302451F081002BD8BF /* DemoCrash-iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DemoCrash-iOS-Info.plist"; sourceTree = "<group>"; };
12111215
C2F7F26A2451F796002BD8BF /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
12121216
C2F7F2BB2451FE1F002BD8BF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS13.4.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
1213-
F8B9C72F24695C2200B9FEF6 /* build-xcframework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "build-xcframework.sh"; sourceTree = "<group>"; };
12141217
F8CF2BCB246C043200904633 /* create-xcframework-archive.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "create-xcframework-archive.sh"; sourceTree = "<group>"; };
12151218
FCE4522F86AC61C08E9DCC17 /* PLCrashFrameStackUnwind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLCrashFrameStackUnwind.h; sourceTree = "<group>"; };
12161219
FCE45837C8C773EFFD15C52B /* PLCrashFrameStackUnwind.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = PLCrashFrameStackUnwind.c; sourceTree = "<group>"; };
@@ -1957,9 +1960,10 @@
19571960
C2B90DA4245707BD00834AFB /* Scripts */ = {
19581961
isa = PBXGroup;
19591962
children = (
1960-
C2B90DAA245714EA00834AFB /* build-ios-universal.sh */,
1961-
C2B90DA9245714EA00834AFB /* build-tvos-universal.sh */,
1962-
F8B9C72F24695C2200B9FEF6 /* build-xcframework.sh */,
1963+
C2C74A882535CD3A00313817 /* build-framework.sh */,
1964+
C2C74A852535CD3A00313817 /* combine-frameworks.sh */,
1965+
C2C74A872535CD3A00313817 /* combine-libs.sh */,
1966+
C2C74A862535CD3A00313817 /* combine-xcframework.sh */,
19631967
C2B90DA8245714E900834AFB /* create-disk-image.sh */,
19641968
C2B90DA6245714E900834AFB /* create-static-libs-archive.sh */,
19651969
F8CF2BCB246C043200904633 /* create-xcframework-archive.sh */,
@@ -2770,7 +2774,7 @@
27702774
shellScript = "\"$SRCROOT/Scripts/create-static-libs-archive.sh\"\n";
27712775
showEnvVarsInLog = 0;
27722776
};
2773-
C2B90DAB2457178800834AFB /* Build Universal Framework */ = {
2777+
C2B90DAB2457178800834AFB /* Build iOS Device Framework */ = {
27742778
isa = PBXShellScriptBuildPhase;
27752779
buildActionMask = 2147483647;
27762780
files = (
@@ -2779,14 +2783,14 @@
27792783
);
27802784
inputPaths = (
27812785
);
2782-
name = "Build Universal Framework";
2786+
name = "Build iOS Device Framework";
27832787
outputFileListPaths = (
27842788
);
27852789
outputPaths = (
27862790
);
27872791
runOnlyForDeploymentPostprocessing = 0;
27882792
shellPath = /bin/sh;
2789-
shellScript = "\"$SRCROOT/Scripts/build-ios-universal.sh\"\n";
2793+
shellScript = "\"$SRCROOT/Scripts/build-framework.sh\" \"$PROJECT_NAME iOS Framework\" \"iphoneos\"\n";
27902794
showEnvVarsInLog = 0;
27912795
};
27922796
C2B90DAC245717D800834AFB /* Build Universal Framework */ = {
@@ -2808,6 +2812,44 @@
28082812
shellScript = "\"$SRCROOT/Scripts/build-tvos-universal.sh\"\n";
28092813
showEnvVarsInLog = 0;
28102814
};
2815+
C2C74A842535CCC700313817 /* Build iOS Simulator Framework */ = {
2816+
isa = PBXShellScriptBuildPhase;
2817+
buildActionMask = 2147483647;
2818+
files = (
2819+
);
2820+
inputFileListPaths = (
2821+
);
2822+
inputPaths = (
2823+
);
2824+
name = "Build iOS Simulator Framework";
2825+
outputFileListPaths = (
2826+
);
2827+
outputPaths = (
2828+
);
2829+
runOnlyForDeploymentPostprocessing = 0;
2830+
shellPath = /bin/sh;
2831+
shellScript = "\"$SRCROOT/Scripts/build-framework.sh\" \"$PROJECT_NAME iOS Framework\" \"iphonesimulator\"\n";
2832+
showEnvVarsInLog = 0;
2833+
};
2834+
C2C74A892535CD8000313817 /* Combine iOS Universal Framework */ = {
2835+
isa = PBXShellScriptBuildPhase;
2836+
buildActionMask = 2147483647;
2837+
files = (
2838+
);
2839+
inputFileListPaths = (
2840+
);
2841+
inputPaths = (
2842+
);
2843+
name = "Combine iOS Universal Framework";
2844+
outputFileListPaths = (
2845+
);
2846+
outputPaths = (
2847+
);
2848+
runOnlyForDeploymentPostprocessing = 0;
2849+
shellPath = /bin/sh;
2850+
shellScript = "DEVICE_FRAMEWORK=\"$BUILD_DIR/$CONFIGURATION-iphoneos/$PRODUCT_NAME.framework\"\nSIMULATOR_FRAMEWORK=\"$BUILD_DIR/$CONFIGURATION-iphonesimulator/$PRODUCT_NAME.framework\"\n\"$SRCROOT/Scripts/combine-frameworks.sh\" \"$DEVICE_FRAMEWORK\" \"$SIMULATOR_FRAMEWORK\" \"$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.framework\"\n";
2851+
showEnvVarsInLog = 0;
2852+
};
28112853
F8B9C72E24695BF200B9FEF6 /* Build XCFramework */ = {
28122854
isa = PBXShellScriptBuildPhase;
28132855
buildActionMask = 2147483647;
@@ -3423,7 +3465,6 @@
34233465
isa = XCBuildConfiguration;
34243466
buildSettings = {
34253467
CODE_SIGN_IDENTITY = "-";
3426-
EFFECTIVE_PLATFORM_NAME = "-macOS";
34273468
PRODUCT_NAME = "Fuzz Testing";
34283469
SDKROOT = macosx;
34293470
};
@@ -3433,7 +3474,6 @@
34333474
isa = XCBuildConfiguration;
34343475
buildSettings = {
34353476
CODE_SIGN_IDENTITY = "-";
3436-
EFFECTIVE_PLATFORM_NAME = "-macOS";
34373477
PRODUCT_NAME = "Fuzz Testing";
34383478
SDKROOT = macosx;
34393479
};
@@ -3593,7 +3633,6 @@
35933633
isa = XCBuildConfiguration;
35943634
buildSettings = {
35953635
DEVELOPMENT_TEAM = 5Z97G9NZQ6;
3596-
EFFECTIVE_PLATFORM_NAME = "-macOS";
35973636
INFOPLIST_FILE = "Resources/Tests-Info.plist";
35983637
PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.${PRODUCT_NAME:rfc1034identifier}";
35993638
PRODUCT_NAME = "Tests macOS";
@@ -3606,7 +3645,6 @@
36063645
isa = XCBuildConfiguration;
36073646
buildSettings = {
36083647
DEVELOPMENT_TEAM = 5Z97G9NZQ6;
3609-
EFFECTIVE_PLATFORM_NAME = "-macOS";
36103648
INFOPLIST_FILE = "Resources/Tests-Info.plist";
36113649
PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.${PRODUCT_NAME:rfc1034identifier}";
36123650
PRODUCT_NAME = "Tests macOS";
@@ -3647,7 +3685,6 @@
36473685
isa = XCBuildConfiguration;
36483686
buildSettings = {
36493687
CODE_SIGN_IDENTITY = "-";
3650-
EFFECTIVE_PLATFORM_NAME = "-macOS";
36513688
PRODUCT_NAME = plcrashutil;
36523689
SDKROOT = macosx;
36533690
};
@@ -3657,7 +3694,6 @@
36573694
isa = XCBuildConfiguration;
36583695
buildSettings = {
36593696
CODE_SIGN_IDENTITY = "-";
3660-
EFFECTIVE_PLATFORM_NAME = "-macOS";
36613697
PRODUCT_NAME = plcrashutil;
36623698
SDKROOT = macosx;
36633699
};
@@ -3667,7 +3703,6 @@
36673703
isa = XCBuildConfiguration;
36683704
buildSettings = {
36693705
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
3670-
EFFECTIVE_PLATFORM_NAME = "-macOS";
36713706
OTHER_CFLAGS = (
36723707
"$(inherited)",
36733708
"-DPLCF_MIN_MACOSX_SDK=$(PL_MIN_MACOSX_SDK)",
@@ -3682,7 +3717,6 @@
36823717
isa = XCBuildConfiguration;
36833718
buildSettings = {
36843719
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
3685-
EFFECTIVE_PLATFORM_NAME = "-macOS";
36863720
OTHER_CFLAGS = (
36873721
"$(inherited)",
36883722
"-DPLCF_MIN_MACOSX_SDK=$(PL_MIN_MACOSX_SDK)",
@@ -3699,7 +3733,6 @@
36993733
CODE_SIGN_IDENTITY = "-";
37003734
CODE_SIGN_STYLE = Automatic;
37013735
DEVELOPMENT_TEAM = 5Z97G9NZQ6;
3702-
EFFECTIVE_PLATFORM_NAME = "-macOS";
37033736
INFOPLIST_FILE = "Resources/DemoCrash-macOS-Info.plist";
37043737
LD_RUNPATH_SEARCH_PATHS = (
37053738
"$(inherited)",
@@ -3719,7 +3752,6 @@
37193752
CODE_SIGN_IDENTITY = "-";
37203753
CODE_SIGN_STYLE = Automatic;
37213754
DEVELOPMENT_TEAM = 5Z97G9NZQ6;
3722-
EFFECTIVE_PLATFORM_NAME = "-macOS";
37233755
INFOPLIST_FILE = "Resources/DemoCrash-macOS-Info.plist";
37243756
LD_RUNPATH_SEARCH_PATHS = (
37253757
"$(inherited)",
@@ -3737,7 +3769,6 @@
37373769
isa = XCBuildConfiguration;
37383770
buildSettings = {
37393771
DEFINES_MODULE = YES;
3740-
EFFECTIVE_PLATFORM_NAME = "-macOS";
37413772
EXPORTED_SYMBOLS_FILE = Resources/CrashReporter.exp;
37423773
GENERATE_MASTER_OBJECT_FILE = YES;
37433774
INFOPLIST_FILE = Resources/Info.plist;
@@ -3759,7 +3790,6 @@
37593790
isa = XCBuildConfiguration;
37603791
buildSettings = {
37613792
DEFINES_MODULE = YES;
3762-
EFFECTIVE_PLATFORM_NAME = "-macOS";
37633793
EXPORTED_SYMBOLS_FILE = Resources/CrashReporter.exp;
37643794
GENERATE_MASTER_OBJECT_FILE = YES;
37653795
INFOPLIST_FILE = Resources/Info.plist;

Scripts/build-framework.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Builds the framework for the specified target.
5+
# Usage: build-framework.sh <target> <sdk>
6+
# Note: it must be run from Xcode's build phase.
7+
8+
# Print only target name and configuration. Mimic Xcode output to make prettify tools happy.
9+
echo "=== BUILD TARGET $1 OF PROJECT ${PROJECT_NAME} WITH CONFIGURATION ${CONFIGURATION} ==="
10+
11+
# OBJROOT must be customized to avoid conflicts with the current process.
12+
if [ "$2" == "maccatalyst" ]; then
13+
# Mac Catalyst is a special case - "destination" parameter must be used here.
14+
env -i "PATH=$PATH" xcodebuild \
15+
SYMROOT="${SYMROOT}" OBJROOT="${BUILT_PRODUCTS_DIR}" PROJECT_TEMP_DIR="${PROJECT_TEMP_DIR}" \
16+
ONLY_ACTIVE_ARCH=NO \
17+
-project "${PROJECT_NAME}.xcodeproj" -configuration "${CONFIGURATION}" \
18+
-scheme "$1" -destination 'platform=macOS,variant=Mac Catalyst'
19+
else
20+
env -i "PATH=$PATH" xcodebuild \
21+
SYMROOT="${SYMROOT}" OBJROOT="${BUILT_PRODUCTS_DIR}" PROJECT_TEMP_DIR="${PROJECT_TEMP_DIR}" \
22+
ONLY_ACTIVE_ARCH=NO \
23+
-project "${PROJECT_NAME}.xcodeproj" -configuration "${CONFIGURATION}" \
24+
-target "$1" -sdk "$2"
25+
fi

Scripts/build-ios-universal.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

Scripts/build-tvos-universal.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

Scripts/build-xcframework.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

Scripts/combine-frameworks.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Combines frameworks for device and simulator into universal one.
5+
# Usage: combine-libs.sh <device> <simulator> <output>
6+
7+
echo "Combining device and simulator frameworks"
8+
cp -Rv "$1" "$3"
9+
10+
# Combining libraries.
11+
product_name=${1##*/}
12+
product_name=${product_name%.*}
13+
$(dirname "$0")/combine-libs.sh \
14+
"$1/${product_name}" \
15+
"$2/${product_name}" \
16+
"$3/${product_name}"
17+
18+
echo "Appending simulator platform to Info.plist"
19+
simulator_platform=$(plutil -extract CFBundleSupportedPlatforms.0 xml1 "$2/Info.plist" -o -| sed -n "s/.*<string>\(.*\)<\/string>.*/\1/p")
20+
plutil -insert CFBundleSupportedPlatforms.1 -string $simulator_platform "$3/Info.plist"

0 commit comments

Comments
 (0)