Skip to content

Add watchOS, tvOS, iOS platforms support #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
80 changes: 47 additions & 33 deletions XCTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
AE2FE11C1CFE86E6003EF0D7 /* XCTestCaseSuite.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE1131CFE86E6003EF0D7 /* XCTestCaseSuite.swift */; };
AE2FE11D1CFE86E6003EF0D7 /* XCTestInternalObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE1141CFE86E6003EF0D7 /* XCTestInternalObservation.swift */; };
AE63767E1D01ED17002C0EA8 /* TestListing.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE63767D1D01ED17002C0EA8 /* TestListing.swift */; };
DA7805FA1C6704A2003C6636 /* SwiftFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7805F91C6704A2003C6636 /* SwiftFoundation.framework */; };
DA9D44191D920A3500108768 /* XCNotificationExpectationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44141D920A3500108768 /* XCNotificationExpectationHandler.swift */; };
DA9D441A1D920A3500108768 /* XCPredicateExpectationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44151D920A3500108768 /* XCPredicateExpectationHandler.swift */; };
DA9D441B1D920A3500108768 /* XCTestCase+Asynchronous.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44161D920A3500108768 /* XCTestCase+Asynchronous.swift */; };
Expand Down Expand Up @@ -93,7 +92,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
DA7805FA1C6704A2003C6636 /* SwiftFoundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -391,7 +389,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 1.0;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -409,11 +407,16 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
INFOPLIST_FILE = Info.plist;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.swift.XCTest;
PRODUCT_BUNDLE_PACKAGE_TYPE = BNDL;
PRODUCT_NAME = SwiftXCTest;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These SDKROOT changes are surprising to me. Can you explain what's going on here? This corresponds to the Base SDK setting in the Xcode UI.

Copy link
Contributor Author

@larryonoff larryonoff Jan 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good question!

Please note that most of the changes I made are based on PromiseKit and the article.

We also should note that we're making the multi-platform single-scheme framework now, so each platform needs it's own SDKROOT.

I tried the same setup for SDKROOT as for PromiseKit (just by removing SDKROOT on project level) and it works for swift-corelibs-xctest. But I had to add to specify SDKROOT for SwiftXCTestFunctionalTests target, because without SDKROOT it failed to build.

PS. I agree that it would be better having SDKROOT on project level for each platform, but Xcode only allows configuring it for architecture (I tried doing it via Xcode UI), not for platform.

It would be awesome if you provide any better solution. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, Xcode will automatically adjust the SDKROOT used for a build such that it matches the platform of the run destination. For example, if the selected SDK is "Latest macOS" and the build has an iOS device destination selected, it will implicitly use the "Latest iOS" SDK instead. Therefore I would prefer keeping the Base SDK setting at the project level with no target overrides.

One other minor point: I think it would be better to specify the new SUPPORTED_PLATFORMS value at the level of the SwiftXCTest target, rather than at the project level, for now anyway. This is because the SwiftXCTestFunctionalTests target only works on macOS, and I don't foresee that changing.

Copy link
Contributor Author

@larryonoff larryonoff Jan 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comments. I did the following updates:

  • move SUPPORTED_PLATFORMS from project level to 'XCTest' target.
  • move deployment targets from project level to 'XCTest' target. Because there're relevant only for 'XCTest' target.
  • revert SDKROOT to macosx for project level.

SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -440,7 +443,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 1.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -452,10 +455,14 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
INFOPLIST_FILE = Info.plist;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = org.swift.XCTest;
PRODUCT_BUNDLE_PACKAGE_TYPE = BNDL;
PRODUCT_NAME = SwiftXCTest;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -464,45 +471,48 @@
5B5D86E41BBC74AD00234F36 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*]" = $BUILT_PRODUCTS_DIR;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = org.swift.XCTest;
PRODUCT_NAME = SwiftXCTest;
"OTHER_LDFLAGS[sdk=macosx*]" = (
"-framework",
SwiftFoundation,
);
PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 10.0;
USER_HEADER_SEARCH_PATHS = $BUILT_PRODUCTS_DIR/usr/local/include/CoreFoundation;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
name = Debug;
};
5B5D86E51BBC74AD00234F36 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*]" = $BUILT_PRODUCTS_DIR;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = org.swift.XCTest;
PRODUCT_NAME = SwiftXCTest;
"OTHER_LDFLAGS[sdk=macosx*]" = (
"-framework",
SwiftFoundation,
);
PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 10.0;
USER_HEADER_SEARCH_PATHS = $BUILT_PRODUCTS_DIR/usr/local/include/CoreFoundation;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
name = Release;
};
Expand All @@ -513,9 +523,11 @@
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
MACOSX_DEPLOYMENT_TARGET = 10.11;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[sdk=macosx*]" = (
"-framework",
SwiftFoundation,
);
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EXEC = "$(TOOLCHAIN_DIR)/usr/bin/swiftc";
};
Expand All @@ -525,9 +537,11 @@
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
MACOSX_DEPLOYMENT_TARGET = 10.11;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[sdk=macosx*]" = (
"-framework",
SwiftFoundation,
);
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EXEC = "$(TOOLCHAIN_DIR)/usr/bin/swiftc";
};
Expand Down