Files
swift-mirror/test/ScanDependencies/clang-target-variant.swift
Artem Chikin e96a690cc7 [Explicit Module Builds] Add '-clang-target-variant' flag
https://github.com/swiftlang/swift/pull/37774 added '-clang-target' which allows us to specify a target triple that only differs from '-target' by the OS version, when we want to provide a different OS version for API availability and type-checking, in order to set a common/unified target triple for the entire Clang module dependency graph, for presenting a unified API surface to the Swift client, serving as a maximum type-checking epoch.

This change adds an equivalent flag for the '-target-variant' configuration, as a mechanism to ensure that the entire module dependency graph presents a consistent os version.
2025-03-11 15:48:06 -07:00

24 lines
922 B
Swift

// REQUIRES: objc_interop
// REQUIRES: OS=macosx
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/module-cache)
// RUN: %target-swift-frontend -scan-dependencies -enable-objc-interop -module-load-mode prefer-interface -module-cache-path %t.module-cache %s -o %t.deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -target arm64e-apple-ios16.4-macabi -clang-target arm64e-apple-ios17.0-macabi -target-variant arm64e-apple-macosx14.4 -clang-target-variant arm64e-apple-macosx15.0
// RUN: %validate-json %t.deps.json | %FileCheck %s
// Ensure the flag affects Clang dependencies in the expected way
// CHECK: "clang": "X"
// CHECK: "modulePath": "{{.*}}X-{{.*}}.pcm"
// CHECK: "-darwin-target-variant-triple"
// CHECK-NEXT: "-Xcc"
// CHECK-NEXT: "arm64e-apple-macosx15.0"
// Ensure the flag is propagated to Swift dependencies
// CHECK: "-clang-target-variant"
// CHECK-NEXT: "arm64e-apple-macosx15.0"
import X