From b27b4d4bb6fbedcf3b0fa0b2adaf8f5bdae12096 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 20 Apr 2020 21:10:31 -0700 Subject: [PATCH 1/3] [CMake] Use proper module triples for the names of standard library modules. The standard library (and other Swift modules built by our CMake build system) has been building module files with an architecture only (e.g., x86_64.swiftmodule) rather than a proper module triple (x86_86-apple-macosx10.15, x86_64-apple-ios13.0-simulator, etc.), unlike every other build system. There are hacks in the compiler and other tools to cope with this unnecessary build difference. Fix the module file names so we'll be able to remove the hacks later. Fixes rdar://problem/49071536. --- cmake/modules/DarwinSDKs.cmake | 17 +++++++------ cmake/modules/SwiftConfigureSDK.cmake | 25 +++++++++++++------ stdlib/cmake/modules/SwiftSource.cmake | 19 ++++++++++++-- .../force-module-loading-mode-archs.swift | 4 +-- .../force-module-loading-mode-framework.swift | 4 +-- .../swiftdoc-next-to-swiftinterface.swift | 2 +- test/lit.cfg | 6 ++--- utils/swift_build_sdk_interfaces.py | 19 -------------- .../ParseableInterface/verify_all_overlays.py | 6 ++--- 9 files changed, 56 insertions(+), 46 deletions(-) diff --git a/cmake/modules/DarwinSDKs.cmake b/cmake/modules/DarwinSDKs.cmake index f10940b79b82b..23fa42a9bd43e 100644 --- a/cmake/modules/DarwinSDKs.cmake +++ b/cmake/modules/DarwinSDKs.cmake @@ -20,7 +20,7 @@ is_sdk_requested(OSX swift_build_osx) if(swift_build_osx) configure_sdk_darwin( OSX "OS X" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX}" - macosx macosx macosx "${SUPPORTED_OSX_ARCHS}") + macosx macosx macosx macos "${SUPPORTED_OSX_ARCHS}") configure_target_variant(OSX-DA "OS X Debug+Asserts" OSX DA "Debug+Asserts") configure_target_variant(OSX-RA "OS X Release+Asserts" OSX RA "Release+Asserts") configure_target_variant(OSX-R "OS X Release" OSX R "Release") @@ -33,7 +33,7 @@ is_sdk_requested(IOS swift_build_ios) if(swift_build_ios) configure_sdk_darwin( IOS "iOS" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS}" - iphoneos ios ios "${SUPPORTED_IOS_ARCHS}") + iphoneos ios ios ios "${SUPPORTED_IOS_ARCHS}") configure_target_variant(IOS-DA "iOS Debug+Asserts" IOS DA "Debug+Asserts") configure_target_variant(IOS-RA "iOS Release+Asserts" IOS RA "Release+Asserts") configure_target_variant(IOS-R "iOS Release" IOS R "Release") @@ -43,7 +43,8 @@ is_sdk_requested(IOS_SIMULATOR swift_build_ios_simulator) if(swift_build_ios_simulator) configure_sdk_darwin( IOS_SIMULATOR "iOS Simulator" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS}" - iphonesimulator ios-simulator ios "${SUPPORTED_IOS_SIMULATOR_ARCHS}") + iphonesimulator ios-simulator ios ios-simulator + "${SUPPORTED_IOS_SIMULATOR_ARCHS}") configure_target_variant( IOS_SIMULATOR-DA "iOS Debug+Asserts" IOS_SIMULATOR DA "Debug+Asserts") configure_target_variant( @@ -56,7 +57,7 @@ is_sdk_requested(TVOS swift_build_tvos) if(swift_build_tvos) configure_sdk_darwin( TVOS "tvOS" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS}" - appletvos tvos tvos "${SUPPORTED_TVOS_ARCHS}") + appletvos tvos tvos tvos "${SUPPORTED_TVOS_ARCHS}") configure_target_variant(TVOS-DA "tvOS Debug+Asserts" TVOS DA "Debug+Asserts") configure_target_variant(TVOS-RA "tvOS Release+Asserts" TVOS RA "Release+Asserts") configure_target_variant(TVOS-R "tvOS Release" TVOS R "Release") @@ -66,7 +67,8 @@ is_sdk_requested(TVOS_SIMULATOR swift_build_tvos_simulator) if(swift_build_tvos_simulator) configure_sdk_darwin( TVOS_SIMULATOR "tvOS Simulator" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS}" - appletvsimulator tvos-simulator tvos "${SUPPORTED_TVOS_SIMULATOR_ARCHS}") + appletvsimulator tvos-simulator tvos tvos-simulator + "${SUPPORTED_TVOS_SIMULATOR_ARCHS}") configure_target_variant( TVOS_SIMULATOR-DA "tvOS Debug+Asserts" TVOS_SIMULATOR DA "Debug+Asserts") configure_target_variant( @@ -79,7 +81,7 @@ is_sdk_requested(WATCHOS swift_build_watchos) if(swift_build_watchos) configure_sdk_darwin( WATCHOS "watchOS" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS}" - watchos watchos watchos "${SUPPORTED_WATCHOS_ARCHS}") + watchos watchos watchos watchos "${SUPPORTED_WATCHOS_ARCHS}") configure_target_variant(WATCHOS-DA "watchOS Debug+Asserts" WATCHOS DA "Debug+Asserts") configure_target_variant(WATCHOS-RA "watchOS Release+Asserts" WATCHOS RA "Release+Asserts") configure_target_variant(WATCHOS-R "watchOS Release" WATCHOS R "Release") @@ -89,7 +91,8 @@ is_sdk_requested(WATCHOS_SIMULATOR swift_build_watchos_simulator) if(swift_build_watchos_simulator) configure_sdk_darwin( WATCHOS_SIMULATOR "watchOS Simulator" "${SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS}" - watchsimulator watchos-simulator watchos "${SUPPORTED_WATCHOS_SIMULATOR_ARCHS}") + watchsimulator watchos-simulator watchos watchos-simulator + "${SUPPORTED_WATCHOS_SIMULATOR_ARCHS}") configure_target_variant(WATCHOS_SIMULATOR-DA "watchOS Debug+Asserts" WATCHOS_SIMULATOR DA "Debug+Asserts") configure_target_variant(WATCHOS_SIMULATOR-RA "watchOS Release+Asserts" WATCHOS_SIMULATOR RA "Release+Asserts") configure_target_variant(WATCHOS_SIMULATOR-R "watchOS Release" WATCHOS_SIMULATOR R "Release") diff --git a/cmake/modules/SwiftConfigureSDK.cmake b/cmake/modules/SwiftConfigureSDK.cmake index 25c7baa3e8b83..5953feca4b9fd 100644 --- a/cmake/modules/SwiftConfigureSDK.cmake +++ b/cmake/modules/SwiftConfigureSDK.cmake @@ -39,6 +39,7 @@ function(_report_sdk prefix) message(STATUS " Architectures: ${SWIFT_SDK_${prefix}_ARCHITECTURES}") foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES}) message(STATUS " ${arch} triple: ${SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE}") + message(STATUS " Module triple: ${SWIFT_SDK_${prefix}_ARCH_${arch}_MODULE}") endforeach() if("${prefix}" STREQUAL "WINDOWS") foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES}) @@ -115,9 +116,10 @@ endfunction() # SWIFT_SDK_${prefix}_ARCHITECTURES Architectures (as a list) # SWIFT_SDK_${prefix}_IS_SIMULATOR Whether this is a simulator target. # SWIFT_SDK_${prefix}_ARCH_${ARCH}_TRIPLE Triple name +# SWIFT_SDK_${prefix}_ARCH_${ARCH}_MODULE Module triple name for this SDK macro(configure_sdk_darwin prefix name deployment_version xcrun_name - version_min_name triple_name architectures) + version_min_name triple_name module_name architectures) # Note: this has to be implemented as a macro because it sets global # variables. @@ -190,6 +192,9 @@ macro(configure_sdk_darwin set(SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE "${arch}-apple-${SWIFT_SDK_${prefix}_TRIPLE_NAME}") + set(SWIFT_SDK_${prefix}_ARCH_${arch}_MODULE + "${arch}-apple-${module_name}") + # If this is a simulator target, append -simulator. if (SWIFT_SDK_${prefix}_IS_SIMULATOR) set(SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE @@ -198,12 +203,8 @@ macro(configure_sdk_darwin if(SWIFT_ENABLE_MACCATALYST AND "${prefix}" STREQUAL "OSX") # For macCatalyst append the '-macabi' environment to the target triple. - set(SWIFT_SDK_MACCATALYST_ARCH_${arch}_TRIPLE - "${SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE}-macabi") - - # macCatalyst triple - set(SWIFT_MACCATALYST_TRIPLE - "x86_64-apple-ios${SWIFT_DARWIN_DEPLOYMENT_VERSION_MACCATALYST}-macabi") + set(SWIFT_SDK_MACCATALYST_ARCH_${arch}_TRIPLE "${arch}-apple-ios-macabi") + set(SWIFT_SDK_MACCATALYST_ARCH_${arch}_MODULE "${arch}-apple-ios-macabi") # For macCatalyst, the xcrun_name is "macosx" since it uses that sdk. # Hard code the library subdirectory to "maccatalyst" in that case. @@ -256,6 +257,8 @@ macro(configure_sdk_unix name architectures) message(SEND_ERROR "Couldn't find SWIFT_SDK_ANDROID_ARCH_armv7_PATH") endif() set(SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "armv7-none-linux-androideabi") + # The Android ABI isn't part of the module triple. + set(SWIFT_SDK_ANDROID_ARCH_${arch}_MODULE "armv7-none-linux-android") elseif("${arch}" STREQUAL "aarch64") set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "aarch64-linux-android") set(SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "aarch64") @@ -358,6 +361,11 @@ macro(configure_sdk_unix name architectures) message(FATAL_ERROR "unknown Unix OS: ${prefix}") endif() endif() + + # If the module triple wasn't set explicitly, it's the same as the triple. + if(NOT SWIFT_SDK_${prefix}_ARCH_${arch}_MODULE) + set(SWIFT_SDK_${prefix}_ARCH_${arch}_MODULE "${SWIFT_SDK_${prefix}_ARCH_${arch}_MODULE}") + endif() endforeach() # Add this to the list of known SDKs. @@ -388,6 +396,9 @@ macro(configure_sdk_windows name environment architectures) set(SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE "${arch}-unknown-windows-${environment}") endif() + + set(SWIFT_SDK_${prefix}_ARCH_${arch}_MODULE "${SWIFT_SDK_${prefix}_ARCH_${arch}_MODULE}") + # NOTE: set the path to / to avoid a spurious `--sysroot` from being passed # to the driver -- rely on the `INCLUDE` AND `LIB` environment variables # instead. diff --git a/stdlib/cmake/modules/SwiftSource.cmake b/stdlib/cmake/modules/SwiftSource.cmake index 3b7b6f344e0b1..84f61626b079f 100644 --- a/stdlib/cmake/modules/SwiftSource.cmake +++ b/stdlib/cmake/modules/SwiftSource.cmake @@ -464,10 +464,11 @@ function(_compile_swift_files list(APPEND swift_flags "-parse-as-library") set(module_base "${module_dir}/${SWIFTFILE_MODULE_NAME}") + set(module_triple ${SWIFT_SDK_${SWIFTFILE_SDK}_ARCH_${SWIFTFILE_ARCHITECTURE}_MODULE}) if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS OR SWIFTFILE_SDK STREQUAL "MACCATALYST") set(specific_module_dir "${module_base}.swiftmodule") - set(module_base "${module_base}.swiftmodule/${SWIFTFILE_ARCHITECTURE}") + set(module_base "${module_base}.swiftmodule/${module_triple}") else() set(specific_module_dir) endif() @@ -530,12 +531,20 @@ function(_compile_swift_files set(maccatalyst_specific_module_dir "${maccatalyst_module_dir}/${SWIFTFILE_MODULE_NAME}.swiftmodule") - set(maccatalyst_module_base "${maccatalyst_specific_module_dir}/${SWIFTFILE_ARCHITECTURE}") + set(maccatalyst_module_triple ${SWIFT_SDK_MACCATALYST_ARCH_${SWIFTFILE_ARCHITECTURE}_MODULE}) + set(maccatalyst_module_base "${maccatalyst_specific_module_dir}/${maccatalyst_module_triple}") set(maccatalyst_module_file "${maccatalyst_module_base}.swiftmodule") set(maccatalyst_module_doc_file "${maccatalyst_module_base}.swiftdoc") set(maccatalyst_module_outputs "${maccatalyst_module_file}" "${maccatalyst_module_doc_file}") + if(SWIFT_ENABLE_MODULE_INTERFACES) + set(maccatalyst_interface_file "${maccatalyst_module_base}.swiftinterface") + list(APPEND maccatalyst_module_outputs "${maccatalyst_interface_file}") + else() + set(maccatalyst_interface_file) + endif() + swift_install_in_component(DIRECTORY ${maccatalyst_specific_module_dir} DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${maccatalyst_library_subdir}" COMPONENT "${SWIFTFILE_INSTALL_IN_COMPONENT}" @@ -611,6 +620,12 @@ function(_compile_swift_files list(APPEND maccatalyst_swift_flags "-I" "${SWIFTLIB_DIR}/${maccatalyst_library_subdir}") set(maccatalyst_swift_module_flags ${swift_module_flags}) + list(FIND maccatalyst_swift_module_flags "${interface_file}" interface_file_index) + if(NOT interface_file_index EQUAL -1) + list(INSERT maccatalyst_swift_module_flags ${interface_file_index} "${maccatalyst_interface_file}") + math(EXPR old_interface_file_index "${interface_file_index} + 1") + list(REMOVE_AT maccatalyst_swift_module_flags ${old_interface_file_index}) + endif() elseif(maccatalyst_build_flavor STREQUAL "ios-like") compute_library_subdir(maccatalyst_library_subdir "MACCATALYST" "${SWIFTFILE_ARCHITECTURE}") diff --git a/test/ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift b/test/ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift index 280b1a82aa273..8fab48c91971a 100644 --- a/test/ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift +++ b/test/ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift @@ -10,7 +10,7 @@ // 2. Only interface is present. // RUN: %empty-directory(%t/Lib.swiftmodule) -// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/%target-cpu.swiftinterface +// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/%module-target-triple.swiftinterface // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s // RUN: env SWIFT_FORCE_MODULE_LOADING=only-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s @@ -34,7 +34,7 @@ // RUN: %empty-directory(%t/MCP) // 4. Both are present. -// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/%target-cpu.swiftinterface +// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.swiftmodule/%module-target-triple.swiftinterface // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s // RUN: %empty-directory(%t/MCP) // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-SERIALIZED %s diff --git a/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift b/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift index cd2a43d5f7fec..85e2bc076b00e 100644 --- a/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift +++ b/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift @@ -10,7 +10,7 @@ // 2. Only interface is present. // RUN: %empty-directory(%t/Lib.framework/Modules/Lib.swiftmodule) -// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface +// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/%module-target-triple.swiftinterface // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s // RUN: env SWIFT_FORCE_MODULE_LOADING=only-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s @@ -29,7 +29,7 @@ // RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=FROM-SERIALIZED %s // 4. Both are present. -// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface +// RUN: cp %S/Inputs/force-module-loading-mode/Lib.swiftinterface %t/Lib.framework/Modules/Lib.swiftmodule/%module-target-triple.swiftinterface // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-parseable not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s // RUN: %empty-directory(%t/MCP) // RUN: env SWIFT_FORCE_MODULE_LOADING=prefer-serialized not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-SERIALIZED %s diff --git a/test/ModuleInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift b/test/ModuleInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift index 7ae35c9df8d58..3d20b7727e4a8 100644 --- a/test/ModuleInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift +++ b/test/ModuleInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift @@ -10,7 +10,7 @@ // Try again with architecture-specific subdirectories. // RUN: %empty-directory(%t) // RUN: %empty-directory(%t/Lib.swiftmodule) -// RUN: %target-swift-frontend -emit-module -emit-module-interface-path %t/Lib.swiftmodule/%target-cpu.swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule/%target-swiftmodule-name -module-name Lib %s +// RUN: %target-swift-frontend -emit-module -emit-module-interface-path %t/Lib.swiftmodule/%module-target-triple.swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule/%target-swiftmodule-name -module-name Lib %s // RUN: %target-swift-ide-test -print-module -module-to-print=Lib -access-filter-public -I %t -source-filename=x -prefer-type-repr=false -fully-qualified-types=true > %t/from-module.txt // RUN: %FileCheck %s < %t/from-module.txt diff --git a/test/lit.cfg b/test/lit.cfg index d92c77690190c..d8750f43ad07f 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -1791,9 +1791,9 @@ if run_vendor != 'apple': extra_frameworks_dir = '' config.substitutions.append(('%xcode-extra-frameworks-dir', extra_frameworks_dir)) -config.substitutions.append(('%target-swiftmodule-name', run_cpu + '.swiftmodule')) -config.substitutions.append(('%target-swiftdoc-name', run_cpu + '.swiftdoc')) -config.substitutions.append(('%target-swiftsourceinfo-name', run_cpu + '.swiftsourceinfo')) +config.substitutions.append(('%target-swiftmodule-name', target_specific_module_triple + '.swiftmodule')) +config.substitutions.append(('%target-swiftdoc-name', target_specific_module_triple + '.swiftdoc')) +config.substitutions.append(('%target-swiftsourceinfo-name', target_specific_module_triple + '.swiftsourceinfo')) config.substitutions.append(('%target-object-format', config.target_object_format)) config.substitutions.append(('%{target-shared-library-prefix}', config.target_shared_library_prefix)) diff --git a/utils/swift_build_sdk_interfaces.py b/utils/swift_build_sdk_interfaces.py index e26ac8f8e505e..112d66a974926 100755 --- a/utils/swift_build_sdk_interfaces.py +++ b/utils/swift_build_sdk_interfaces.py @@ -240,30 +240,11 @@ def log_output_to_file(content, module_name, interface_base, label, log_path): def looks_like_iosmac(interface_base): return 'ios-macabi' in interface_base - -def rename_interface_for_iosmac_if_needed(interface_base, module_path): - """Hack: Both macOS and iOSMac use 'x86_64' as the short name for a module - interface file, and while we want to move away from this it's something we - need to handle in the short term. Manually rename these to the full form of - the target-specific module when we're obviously on macOS or iOSMac. - """ - if interface_base != 'x86_64': - return interface_base - if '/iOSSupport/' in module_path: - return 'x86_64-apple-ios-macabi' - if '/MacOS' in module_path: - return 'x86_64-apple-macos' - return interface_base - - def process_module(module_file): global args, shared_output_lock try: interface_base, _ = \ os.path.splitext(os.path.basename(module_file.path)) - interface_base = \ - rename_interface_for_iosmac_if_needed(interface_base, - module_file.path) swiftc = os.getenv('SWIFT_EXEC', os.path.join(os.path.dirname(__file__), 'swiftc')) diff --git a/validation-test/ParseableInterface/verify_all_overlays.py b/validation-test/ParseableInterface/verify_all_overlays.py index 94b692e60baaa..e3668a6e16892 100755 --- a/validation-test/ParseableInterface/verify_all_overlays.py +++ b/validation-test/ParseableInterface/verify_all_overlays.py @@ -4,7 +4,7 @@ # generated. # RUN: %empty-directory(%t) -# RUN: %{python} %s %target-os %target-cpu %platform-sdk-overlay-dir %t \ +# RUN: %{python} %s %target-os %module-target-triple %platform-sdk-overlay-dir %t \ # RUN: %target-swift-frontend -build-module-from-parseable-interface \ # RUN: -Fsystem %sdk/System/Library/PrivateFrameworks/ \ # RUN: | sort > %t/failures.txt @@ -30,7 +30,7 @@ import sys target_os = sys.argv[1] -target_cpu = sys.argv[2] +target_module_triple = sys.argv[2] sdk_overlay_dir = sys.argv[3] output_dir = sys.argv[4] compiler_invocation = sys.argv[5:] @@ -43,7 +43,7 @@ module_path = os.path.join(sdk_overlay_dir, filename) if os.path.isdir(module_path): interface_file = os.path.join(module_path, - target_cpu + ".swiftinterface") + target_module_triple + ".swiftinterface") else: continue else: From 58296b9dab56c960ed195f0507182f748df6abef Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Tue, 21 Apr 2020 11:20:30 -0700 Subject: [PATCH 2/3] Update test for building module interfaces for an SDK --- ...ftinterface => x86_64-apple-macos.swiftinterface} | 0 .../x86_64-apple-ios-macabi.swiftinterface} | 0 .../x86_64-apple-ios-macabi.swiftinterface} | 0 .../x86_64-apple-macos.swiftinterface} | 0 .../lib/swift/Foo.swiftmodule/x86_64.swiftinterface | 0 .../swift_build_sdk_interfaces/iosmac.test-sh | 12 ++++++------ 6 files changed, 6 insertions(+), 6 deletions(-) rename test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/{x86_64.swiftinterface => x86_64-apple-macos.swiftinterface} (100%) rename test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/{Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64.swiftinterface => iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64-apple-ios-macabi.swiftinterface} (100%) rename test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/{System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface => usr/lib/swift/Foo.swiftmodule/x86_64-apple-ios-macabi.swiftinterface} (100%) rename test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/{System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface => usr/lib/swift/Foo.swiftmodule/x86_64-apple-macos.swiftinterface} (100%) delete mode 100644 test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64-apple-macos.swiftinterface similarity index 100% rename from test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64-apple-macos.swiftinterface diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64-apple-ios-macabi.swiftinterface similarity index 100% rename from test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64-apple-ios-macabi.swiftinterface diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64-apple-ios-macabi.swiftinterface similarity index 100% rename from test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64-apple-ios-macabi.swiftinterface diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64-apple-macos.swiftinterface similarity index 100% rename from test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64-apple-macos.swiftinterface diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/ModuleInterface/swift_build_sdk_interfaces/iosmac.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/iosmac.test-sh index 9fbf9e62d6b74..0ced89bcc676f 100644 --- a/test/ModuleInterface/swift_build_sdk_interfaces/iosmac.test-sh +++ b/test/ModuleInterface/swift_build_sdk_interfaces/iosmac.test-sh @@ -2,13 +2,13 @@ RUN: %swift_build_sdk_interfaces -sdk %S/Inputs/iosmac-sdk/MacOSX.sdk/ -Fsystem- RUN: %FileCheck %s < %t.txt RUN: %FileCheck -check-prefix NEGATIVE %s < %t.txt -CHECK-DAG: MacOSX.sdk/System/Library/Frameworks{{\\|/}}FMWK.framework{{\\|/}}Modules{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64.swiftinterface -o {{.+}}/output{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64-apple-macos.swiftmodule -CHECK-DAG: -Fsystem SECRET_SEARCH_PATH -Fsystem {{.+}}MacOSX.sdk/System{{\\|/}}iOSSupport{{\\|/}}System{{\\|/}}Library{{\\|/}}Frameworks {{.+}}MacOSX.sdk/System/iOSSupport/System/Library/Frameworks{{\\|/}}FMWK.framework{{\\|/}}Modules{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64.swiftinterface -o {{.+}}/output{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftmodule -CHECK-DAG: MacOSX.sdk/usr/lib/swift{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64.swiftinterface -o {{.+}}output{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64-apple-macos.swiftmodule -CHECK-DAG: -Fsystem SECRET_SEARCH_PATH -Fsystem {{.+}}MacOSX.sdk/System{{\\|/}}iOSSupport{{\\|/}}System{{\\|/}}Library{{\\|/}}Frameworks {{.+}}MacOSX.sdk/System/iOSSupport/usr/lib/swift{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64.swiftinterface -o {{.+}}output{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftmodule -CHECK-DAG: MacOSX.sdk/System/Library/Frameworks{{\\|/}}Zippered.framework{{\\|/}}Modules{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64.swiftinterface -o {{.+}}/output{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64-apple-macos.swiftmodule -CHECK-DAG: MacOSX.sdk/System/Library/Frameworks{{\\|/}}Zippered.framework{{\\|/}}Modules{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64-apple-macos.swiftinterface -o {{.+}}/output{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64-apple-macos.swiftmodule +CHECK-DAG: MacOSX.sdk/System/Library/Frameworks{{\\|/}}FMWK.framework{{\\|/}}Modules{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64-apple-macos.swiftinterface -o {{.+}}/output{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64-apple-macos.swiftmodule +CHECK-DAG: -Fsystem SECRET_SEARCH_PATH -Fsystem {{.+}}MacOSX.sdk/System{{\\|/}}iOSSupport{{\\|/}}System{{\\|/}}Library{{\\|/}}Frameworks {{.+}}MacOSX.sdk/System/iOSSupport/System/Library/Frameworks{{\\|/}}FMWK.framework{{\\|/}}Modules{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftinterface -o {{.+}}/output{{\\|/}}FMWK.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftmodule +CHECK-DAG: MacOSX.sdk/usr/lib/swift{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64-apple-macos.swiftinterface -o {{.+}}output{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64-apple-macos.swiftmodule +CHECK-DAG: -Fsystem SECRET_SEARCH_PATH -Fsystem {{.+}}MacOSX.sdk/System{{\\|/}}iOSSupport{{\\|/}}System{{\\|/}}Library{{\\|/}}Frameworks {{.+}}MacOSX.sdk/System/iOSSupport/usr/lib/swift{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftinterface -o {{.+}}output{{\\|/}}Foo.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftmodule + CHECK-DAG: -Fsystem SECRET_SEARCH_PATH -Fsystem {{.+}}MacOSX.sdk/System{{\\|/}}iOSSupport{{\\|/}}System{{\\|/}}Library{{\\|/}}Frameworks {{.+}}MacOSX.sdk/System/Library/Frameworks{{\\|/}}Zippered.framework{{\\|/}}Modules{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftinterface -o {{.+}}/output{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64-apple-ios-macabi.swiftmodule +CHECK-DAG: MacOSX.sdk/System/Library/Frameworks{{\\|/}}Zippered.framework{{\\|/}}Modules{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64-apple-macos.swiftinterface -o {{.+}}/output{{\\|/}}Zippered.swiftmodule{{\\|/}}x86_64-apple-macos.swiftmodule NEGATIVE-NOT: iOSSupport{{.+}}{{macos|x86_64}}.swiftmodule NEGATIVE-NOT: SECRET_SEARCH_PATH{{.+}}{{macos|x86_64}}.swiftmodule From 691633b09701cc5056f507b709b936a51f7d3540 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Tue, 21 Apr 2020 13:42:15 -0700 Subject: [PATCH 3/3] Appease Python linter --- utils/swift_build_sdk_interfaces.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/swift_build_sdk_interfaces.py b/utils/swift_build_sdk_interfaces.py index 112d66a974926..4798cc375adbe 100755 --- a/utils/swift_build_sdk_interfaces.py +++ b/utils/swift_build_sdk_interfaces.py @@ -240,6 +240,7 @@ def log_output_to_file(content, module_name, interface_base, label, log_path): def looks_like_iosmac(interface_base): return 'ios-macabi' in interface_base + def process_module(module_file): global args, shared_output_lock try: