diff --git a/cmake/modules/DarwinSDKs.cmake b/cmake/modules/DarwinSDKs.cmake index 20d555b7475..53f18a1ee43 100644 --- a/cmake/modules/DarwinSDKs.cmake +++ b/cmake/modules/DarwinSDKs.cmake @@ -3,7 +3,7 @@ set(SUPPORTED_IOS_SIMULATOR_ARCHS "x86_64;arm64") set(SUPPORTED_TVOS_ARCHS "arm64") set(SUPPORTED_TVOS_SIMULATOR_ARCHS "x86_64;arm64") set(SUPPORTED_WATCHOS_ARCHS "armv7k;arm64_32") -set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "x86_64;arm64") +set(SUPPORTED_WATCHOS_SIMULATOR_ARCHS "i386;x86_64;arm64") set(SUPPORTED_OSX_ARCHS "x86_64;arm64") set(SUPPORTED_XROS_ARCHS "arm64;arm64e") set(SUPPORTED_XROS_SIMULATOR_ARCHS "arm64") diff --git a/cmake/modules/SwiftConfigureSDK.cmake b/cmake/modules/SwiftConfigureSDK.cmake index b1dbea4f999..45b1900a63e 100644 --- a/cmake/modules/SwiftConfigureSDK.cmake +++ b/cmake/modules/SwiftConfigureSDK.cmake @@ -91,6 +91,10 @@ function(remove_sdk_unsupported_archs name os sdk_path deployment_version archit # 32-bit watchOS is not listed explicitly in SDK settings. message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}") list(APPEND architectures ${arch}) + elseif(arch STREQUAL "i386" AND os STREQUAL "watchsimulator") + # 32-bit watchOS simulator is not listed explicitly in SDK settings. + message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}") + list(APPEND architectures ${arch}) else() message(STATUS "${name} SDK at ${sdk_path} does not support architecture ${arch}") endif() diff --git a/utils/build-script-impl b/utils/build-script-impl index 05d9070cda5..8ad69246b53 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -486,6 +486,7 @@ function verify_host_is_supported() { | appletvsimulator-x86_64 \ | appletvsimulator-arm64 \ | appletvos-arm64 \ + | watchsimulator-i386 \ | watchsimulator-x86_64 \ | watchsimulator-arm64 \ | watchos-armv7k \ @@ -664,6 +665,13 @@ function set_build_options_for_host() { SWIFT_HOST_VARIANT_SDK="TVOS" cmake_osx_deployment_target="" ;; + watchsimulator-i386) + SWIFT_HOST_TRIPLE="i386-apple-watchos${DARWIN_DEPLOYMENT_VERSION_WATCHOS}-simulator" + llvm_target_arch="X86" + + SWIFT_HOST_VARIANT_SDK="WATCHOS_SIMULATOR" + cmake_osx_deployment_target="" + ;; watchsimulator-x86_64) SWIFT_HOST_TRIPLE="x86_64-apple-watchos${DARWIN_DEPLOYMENT_VERSION_WATCHOS}-simulator" llvm_target_arch="X86" diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index bc36cbf03ab..6d5759cab41 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -1268,6 +1268,10 @@ def create_argument_parser(): option('--skip-test-ios-simulator', toggle_false('test_ios_simulator'), help='skip testing iOS simulator targets') + option('--skip-test-watchos-32bit-simulator', + toggle_false('test_watchos_32bit_simulator'), + default=False, + help='skip testing watchOS 32 bit simulator targets') option('--skip-test-ios-host', toggle_false('test_ios_host'), help='skip testing iOS device targets on the host machine (the ' diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index 6a106f996f6..e1faa5a8769 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -292,6 +292,7 @@ EXPECTED_DEFAULTS = { 'test_cygwin': False, 'test_freebsd': False, 'test_ios': False, + 'test_watchos_32bit_simulator': False, 'test_ios_host': False, 'test_ios_simulator': False, 'test_linux': False, @@ -735,6 +736,8 @@ EXPECTED_OPTIONS = [ DisableOption('--skip-test-cygwin', dest='test_cygwin'), DisableOption('--skip-test-freebsd', dest='test_freebsd'), DisableOption('--skip-test-ios', dest='test_ios'), + DisableOption('--skip-test-watchos-32bit-simulator', + dest='test_watchos_32bit_simulator'), DisableOption('--skip-test-ios-host', dest='test_ios_host'), DisableOption('--skip-test-ios-simulator', dest='test_ios_simulator'), DisableOption('--skip-test-linux', dest='test_linux'), diff --git a/utils/sil-opt-verify-all-modules.py b/utils/sil-opt-verify-all-modules.py index b71ece1382c..34662f1ff96 100755 --- a/utils/sil-opt-verify-all-modules.py +++ b/utils/sil-opt-verify-all-modules.py @@ -63,6 +63,7 @@ def get_verify_resource_dir_modules_commands( ('iphonesimulator', 'x86_64', 'x86_64-apple-ios7.0'), ('macosx', 'x86_64', 'x86_64-apple-macosx10.9'), ('watchos', 'armv7k', 'armv7k-apple-watchos2.0'), + ('watchsimulator', 'i386', 'i386-apple-watchos2.0'), ] commands = [] diff --git a/utils/swift_build_support/swift_build_support/host_specific_configuration.py b/utils/swift_build_support/swift_build_support/host_specific_configuration.py index 5d37027ce0c..ede1c81d74c 100644 --- a/utils/swift_build_support/swift_build_support/host_specific_configuration.py +++ b/utils/swift_build_support/swift_build_support/host_specific_configuration.py @@ -323,6 +323,9 @@ class HostSpecificConfiguration(object): def __platforms_archs_to_skip_test(self, args, stage_dependent_args, host_target): platforms_archs_to_skip_test = set() + if not stage_dependent_args.test_watchos_32bit_simulator: + platforms_archs_to_skip_test.add( + StdlibDeploymentTarget.AppleWatchSimulator.i386) if host_target == StdlibDeploymentTarget.OSX.x86_64.name: platforms_archs_to_skip_test.add( StdlibDeploymentTarget.iOSSimulator.arm64) @@ -338,6 +341,8 @@ class HostSpecificConfiguration(object): StdlibDeploymentTarget.iOSSimulator.x86_64) platforms_archs_to_skip_test.add( StdlibDeploymentTarget.AppleTVSimulator.x86_64) + platforms_archs_to_skip_test.add( + StdlibDeploymentTarget.AppleWatchSimulator.i386) platforms_archs_to_skip_test.add( StdlibDeploymentTarget.AppleWatchSimulator.x86_64) diff --git a/utils/swift_build_support/swift_build_support/products/cmake_product.py b/utils/swift_build_support/swift_build_support/products/cmake_product.py index 53c0ed7ad30..6b4eaca1062 100644 --- a/utils/swift_build_support/swift_build_support/products/cmake_product.py +++ b/utils/swift_build_support/swift_build_support/products/cmake_product.py @@ -303,6 +303,13 @@ class CMakeProduct(product.Product): swift_host_variant_sdk = 'TVOS' cmake_osx_deployment_target = None + elif host_target == 'watchsimulator-i386': + swift_host_triple = 'i386-apple-watchos{}-simulator'.format( + self.args.darwin_deployment_version_watchos) + llvm_target_arch = 'X86' + swift_host_variant_sdk = 'WATCHOS_SIMULATOR' + cmake_osx_deployment_target = None + elif host_target == 'watchsimulator-x86_64': swift_host_triple = 'x86_64-apple-watchos{}-simulator'.format( self.args.darwin_deployment_version_watchos) diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.py index 508d6204eaf..53c7fc3cdbf 100644 --- a/utils/swift_build_support/swift_build_support/targets.py +++ b/utils/swift_build_support/swift_build_support/targets.py @@ -258,7 +258,7 @@ class StdlibDeploymentTarget(object): sdk_name="WATCHOS") AppleWatchSimulator = DarwinPlatform("watchsimulator", - archs=["x86_64", "arm64"], + archs=["i386", "x86_64", "arm64"], sdk_name="WATCHOS_SIMULATOR", is_simulator=True) diff --git a/utils/swift_build_support/tests/test_host_specific_configuration.py b/utils/swift_build_support/tests/test_host_specific_configuration.py index 6d2d98536f0..fd2c36e9e04 100644 --- a/utils/swift_build_support/tests/test_host_specific_configuration.py +++ b/utils/swift_build_support/tests/test_host_specific_configuration.py @@ -191,9 +191,9 @@ class ToolchainTestCase(unittest.TestCase): 'build_watchos_device') test_should_skip_building_watchos_sim =\ generate_should_skip_building_platform( - 'watchsimulator-x86_64', + 'watchsimulator-i386', 'WATCHOS_SIMULATOR', - 'swift-test-stdlib-watchsimulator-x86_64', + 'swift-test-stdlib-watchsimulator-i386', 'build_watchos_simulator') def generate_should_build_full_targets_when_test(test_arg_name): @@ -233,7 +233,7 @@ class ToolchainTestCase(unittest.TestCase): 'stress_test') def generate_should_skip_testing_platform( - host_target, build_arg_name, test_arg_name, extra_test_arg_name=None): + host_target, build_arg_name, test_arg_name): def test(self): args = self.default_args() setattr(args, build_arg_name, True) @@ -245,8 +245,6 @@ class ToolchainTestCase(unittest.TestCase): self.assertEqual(len(before.swift_test_run_targets), 0) setattr(args, test_arg_name, True) - if extra_test_arg_name is not None: - setattr(args, extra_test_arg_name, True) after = HostSpecificConfiguration(host_target, args) self.assertIn('check-swift-{}'.format(host_target), after.swift_test_run_targets) @@ -292,10 +290,27 @@ class ToolchainTestCase(unittest.TestCase): # NOTE: test_watchos_host is not supported in open-source Swift test_should_skip_testing_watchos_sim =\ generate_should_skip_testing_platform( - 'watchsimulator-x86_64', + 'watchsimulator-i386', 'build_watchos_simulator', - 'test_watchos_simulator', - 'test_watchos_64bit_simulator') + 'test_watchos_simulator') + + def test_should_skip_testing_32bit_watchos(self): + host_target = 'watchsimulator-i386' + args = self.default_args() + args.build_watchos_simulator = True + args.test_watchos_simulator = True + args.test_watchos_32bit_simulator = False + args.host_target = host_target + args.stdlib_deployment_targets = [host_target] + args.build_stdlib_deployment_targets = 'all' + + before = HostSpecificConfiguration(host_target, args) + self.assertEqual(len(before.swift_test_run_targets), 0) + + args.test_watchos_32bit_simulator = True + after = HostSpecificConfiguration(host_target, args) + self.assertIn('check-swift-watchsimulator-i386', + after.swift_test_run_targets) def generate_should_allow_testing_only_host( host_target, build_arg_name, test_arg_name, host_test_arg_name): @@ -666,6 +681,7 @@ class ToolchainTestCase(unittest.TestCase): test_freebsd=False, test_ios_host=False, test_ios_simulator=False, + test_watchos_32bit_simulator=True, test_linux=False, test_optimize_for_size=False, test_optimize_none_with_implicit_dynamic=False,