Skip to content

Commit 64b1f3d

Browse files
committed
build: Add scripts to build and test using Xcode
- xcode-build.sh builds and optionally tests SwiftFoundation. usage: ./xcode-build.sh [--clean] [--debug|--release] [--test] - DarwinCompatibilityTests/xcode-build.sh builds and tests using the DarwinCompatibilityTests. usage: DarwinCompatibilityTests/xcode-build.sh [--clean]
1 parent ed17690 commit 64b1f3d

File tree

5 files changed

+127
-6
lines changed

5 files changed

+127
-6
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
TestByteCountFormatter
2+
TestCodable
3+
TestDateComponents
4+
TestDateFormatter
5+
TestDateIntervalFormatter
6+
TestDecimal
7+
TestFileManager
8+
TestHTTPCookie
9+
TestHTTPCookieStorage
10+
TestHTTPURLResponse
11+
TestISO8601DateFormatter
12+
TestIndexSet
13+
TestJSONEncoder
14+
TestJSONSerialization
15+
TestLengthFormatter
16+
TestNSArray
17+
TestNSAttributedString
18+
TestNSCache
19+
TestNSData
20+
TestNSDateComponents
21+
TestNSDictionary
22+
TestNSGeometry
23+
TestNSKeyedArchiver
24+
TestNSMutableAttributedString
25+
TestNSNumber
26+
TestNSOrderedSet
27+
TestNSRegularExpression
28+
TestNSSet
29+
TestNSSortDescriptor
30+
TestNSString
31+
TestNSTextCheckingResult
32+
TestNSURLRequest
33+
TestNotificationQueue
34+
TestNumberFormatter
35+
TestObjCRuntime
36+
TestProcess
37+
TestProcessInfo
38+
TestRunLoop
39+
TestTimeZone
40+
TestURLComponents
41+
TestURLProtocol
42+
TestURLRequest
43+
TestURLResponse
44+
TestURLSessionFTP
45+
TestUserDefaults
46+
TestXMLDocument
47+
TestXMLParser
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
DERIVED_DATA=dct-xcode-test-build
4+
if [ "$1" == "--clean" ]; then
5+
rm -rf "${DERIVED_DATA}"
6+
shift
7+
fi
8+
9+
if [ "$1" != "" ]; then
10+
xcodebuild -derivedDataPath $DERIVED_DATA -project DarwinCompatibilityTests.xcodeproj -scheme xdgTestHelper "-only-testing:DarwinCompatibilityTests/$1" test
11+
else
12+
xcodebuild -derivedDataPath $DERIVED_DATA -project DarwinCompatibilityTests.xcodeproj -scheme xdgTestHelper `sed 's/^/-skip-testing:DarwinCompatibilityTests\//g' DarwinCompatibilityTests/TestsToSkip.txt` test
13+
fi

Foundation.xcodeproj/project.pbxproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@
405405
B940492D223B146800FB4384 /* TestProgressFraction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B940492C223B146800FB4384 /* TestProgressFraction.swift */; };
406406
B951B5EC1F4E2A2000D8B332 /* TestNSLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B951B5EB1F4E2A2000D8B332 /* TestNSLock.swift */; };
407407
B95FC97622B84B0A005DEA0A /* TestNSSortDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152EF3932283457B001E1269 /* TestNSSortDescriptor.swift */; };
408+
B95FC97122AF0049005DEA0A /* SwiftFoundationNetworking.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 15B8043A228F376000B30FF6 /* SwiftFoundationNetworking.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
409+
B95FC97322AF0060005DEA0A /* SwiftXCTest.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B95FC97222AF0050005DEA0A /* SwiftXCTest.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
410+
B95FC97522AF051B005DEA0A /* xcode-build.sh in Resources */ = {isa = PBXBuildFile; fileRef = B95FC97422AF051B005DEA0A /* xcode-build.sh */; };
408411
B98E33DD2136AA740044EBE9 /* TestFileWithZeros.txt in Resources */ = {isa = PBXBuildFile; fileRef = B98E33DC2136AA740044EBE9 /* TestFileWithZeros.txt */; };
409412
B9C0E89620C31AB60064C68C /* CFInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B5D888A1BBC963C00234F36 /* CFInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
410413
BB3D7558208A1E500085CFDC /* TestImports.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3D7557208A1E500085CFDC /* TestImports.swift */; };
@@ -597,6 +600,8 @@
597600
dstSubfolderSpec = 10;
598601
files = (
599602
5BDC406E1BD6D8C400ED97BB /* SwiftFoundation.framework in CopyFiles */,
603+
B95FC97122AF0049005DEA0A /* SwiftFoundationNetworking.framework in CopyFiles */,
604+
B95FC97322AF0060005DEA0A /* SwiftXCTest.framework in CopyFiles */,
600605
);
601606
runOnlyForDeploymentPostprocessing = 0;
602607
};
@@ -977,8 +982,10 @@
977982
B91095791EEF237800A71930 /* NSString-UTF16-BE-data.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "NSString-UTF16-BE-data.txt"; sourceTree = "<group>"; };
978983
B933A79C1F3055F600FE6846 /* NSString-UTF32-BE-data.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "NSString-UTF32-BE-data.txt"; sourceTree = "<group>"; };
979984
B933A79D1F3055F600FE6846 /* NSString-UTF32-LE-data.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "NSString-UTF32-LE-data.txt"; sourceTree = "<group>"; };
980-
B940492C223B146800FB4384 /* TestProgressFraction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TestProgressFraction.swift; path = TestFoundation/TestProgressFraction.swift; sourceTree = "<group>"; };
985+
B940492C223B146800FB4384 /* TestProgressFraction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestProgressFraction.swift; sourceTree = "<group>"; };
981986
B951B5EB1F4E2A2000D8B332 /* TestNSLock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestNSLock.swift; sourceTree = "<group>"; };
987+
B95FC97222AF0050005DEA0A /* SwiftXCTest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftXCTest.framework; sourceTree = BUILT_PRODUCTS_DIR; };
988+
B95FC97422AF051B005DEA0A /* xcode-build.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "xcode-build.sh"; sourceTree = "<group>"; };
982989
B98E33DC2136AA740044EBE9 /* TestFileWithZeros.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TestFileWithZeros.txt; sourceTree = "<group>"; };
983990
B9974B8F1EDF4A22007F15B8 /* TransferState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferState.swift; sourceTree = "<group>"; };
984991
B9974B901EDF4A22007F15B8 /* MultiHandle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultiHandle.swift; sourceTree = "<group>"; };
@@ -1223,7 +1230,7 @@
12231230
5B5D88531BBC938800234F36 = {
12241231
isa = PBXGroup;
12251232
children = (
1226-
B940492C223B146800FB4384 /* TestProgressFraction.swift */,
1233+
B95FC97422AF051B005DEA0A /* xcode-build.sh */,
12271234
B167A6641ED7303F0040B09A /* README.md */,
12281235
5BDC3F2C1BCC5DB500ED97BB /* Foundation */,
12291236
EAB57B681BD1A255004AC5C5 /* CoreFoundation */,
@@ -1232,6 +1239,7 @@
12321239
EA66F6371BF1619600136161 /* TestFoundation */,
12331240
5B5D89AB1BBDCD0B00234F36 /* Frameworks */,
12341241
5B5D885E1BBC938800234F36 /* Products */,
1242+
B95FC97222AF0050005DEA0A /* SwiftXCTest.framework */,
12351243
);
12361244
indentWidth = 4;
12371245
sourceTree = "<group>";
@@ -1709,6 +1717,7 @@
17091717
3EA9D66F1EF0532D00B362D6 /* TestJSONEncoder.swift */,
17101718
AA9E0E0C21FA6E0700963F4C /* TestPropertyListEncoder.swift */,
17111719
DCA8120A1F046D13000D0C86 /* TestCodable.swift */,
1720+
B940492C223B146800FB4384 /* TestProgressFraction.swift */,
17121721
C93559281C12C49F009FD6A9 /* TestAffineTransform.swift */,
17131722
EA66F63C1BF1619600136161 /* TestNSArray.swift */,
17141723
294E3C1C1CC5E19300E4F44C /* TestNSAttributedString.swift */,
@@ -2455,6 +2464,7 @@
24552464
isa = PBXResourcesBuildPhase;
24562465
buildActionMask = 2147483647;
24572466
files = (
2467+
B95FC97522AF051B005DEA0A /* xcode-build.sh in Resources */,
24582468
);
24592469
runOnlyForDeploymentPostprocessing = 0;
24602470
};

Foundation.xcodeproj/xcshareddata/xcschemes/TestFoundation.xcscheme

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@
8383
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
8484
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
8585
shouldUseLaunchSchemeArgsEnv = "YES">
86-
<Testables>
87-
</Testables>
8886
<MacroExpansion>
8987
<BuildableReference
9088
BuildableIdentifier = "primary"
@@ -94,8 +92,8 @@
9492
ReferencedContainer = "container:Foundation.xcodeproj">
9593
</BuildableReference>
9694
</MacroExpansion>
97-
<AdditionalOptions>
98-
</AdditionalOptions>
95+
<Testables>
96+
</Testables>
9997
</TestAction>
10098
<LaunchAction
10199
buildConfiguration = "Debug"

xcode-build.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
DERIVED_DATA=xcode-test-build
4+
5+
CLEAN=0
6+
CONFIG=Debug
7+
TEST=0
8+
TESTCASE=""
9+
10+
for i in "$@"
11+
do
12+
case $i in
13+
-h)
14+
echo "usage: $0 [--clean] [--debug|--release] [--test]"
15+
exit 0
16+
;;
17+
18+
--clean)
19+
CLEAN=1
20+
;;
21+
22+
--debug)
23+
CONFIG=Debug
24+
;;
25+
26+
--release)
27+
CONFIG=Release
28+
;;
29+
30+
--test)
31+
TEST=1
32+
;;
33+
*)
34+
TESTCASE="$i"
35+
break
36+
;;
37+
esac
38+
done
39+
40+
if [ $CLEAN = 1 ]; then
41+
echo Cleaning
42+
rm -rf "${DERIVED_DATA}"
43+
fi
44+
45+
xcodebuild -derivedDataPath $DERIVED_DATA -workspace Foundation.xcworkspace -scheme SwiftFoundation -configuration $CONFIG build || exit 1
46+
xcodebuild -derivedDataPath $DERIVED_DATA -workspace Foundation.xcworkspace -scheme SwiftFoundationNetworking -configuration $CONFIG build || exit 1
47+
48+
if [ $TEST = 1 ]; then
49+
echo Testing
50+
xcodebuild -derivedDataPath $DERIVED_DATA -workspace Foundation.xcworkspace -scheme TestFoundation -configuration $CONFIG build || exit 1
51+
$DERIVED_DATA/Build/Products/$CONFIG/TestFoundation.app/Contents/MacOS/TestFoundation $TESTCASE
52+
fi
53+

0 commit comments

Comments
 (0)