Skip to content

[5.9][ScanDependencies] Fix JSON generation under certain circunstances. #67265

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 1 commit into from
Jul 14, 2023
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
11 changes: 7 additions & 4 deletions lib/DependencyScan/ScanDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,11 @@ static void writeJSON(llvm::raw_ostream &out,
bool hasOverlayDependencies =
swiftTextualDeps->swift_overlay_module_dependencies &&
swiftTextualDeps->swift_overlay_module_dependencies->count > 0;
bool commaAfterBridgingHeaderPath = hasOverlayDependencies;
bool commaAfterExtraPcmArgs =
hasBridgingHeaderPath || commaAfterBridgingHeaderPath;
bool commaAfterFramework =
swiftTextualDeps->extra_pcm_args->count != 0 || hasBridgingHeaderPath;
swiftTextualDeps->extra_pcm_args->count != 0 || commaAfterExtraPcmArgs;

writeJSONSingleField(out, "isFramework", swiftTextualDeps->is_framework,
5, commaAfterFramework);
Expand All @@ -871,7 +874,7 @@ static void writeJSON(llvm::raw_ostream &out,
out << "\n";
}
out.indent(5 * 2);
out << (hasBridgingHeaderPath ? "],\n" : "]\n");
out << (commaAfterExtraPcmArgs ? "],\n" : "]\n");
}
/// Bridging header and its source file dependencies, if any.
if (hasBridgingHeaderPath) {
Expand All @@ -887,12 +890,12 @@ static void writeJSON(llvm::raw_ostream &out,
swiftTextualDeps->bridging_module_dependencies, 6,
/*trailingComma=*/false);
out.indent(5 * 2);
out << (hasOverlayDependencies ? "},\n" : "}\n");
out << (commaAfterBridgingHeaderPath ? "},\n" : "}\n");
}
if (hasOverlayDependencies) {
writeDependencies(out, swiftTextualDeps->swift_overlay_module_dependencies,
"swiftOverlayDependencies", 5,
/*trailingComma=*/true);
/*trailingComma=*/false);
}
} else if (swiftPlaceholderDeps) {
out << "\"swiftPlaceholder\": {\n";
Expand Down
4 changes: 2 additions & 2 deletions test/Frontend/module-alias-scan-deps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/// Scanned dependencies should contain real name AppleLogging
// RUN: %target-swift-frontend -scan-dependencies %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t > %t/scandump.output
// RUN: %FileCheck %s -check-prefix=CHECK-REAL-NAME -input-file %t/scandump.output
// RUN: %validate-json %t/scandump.output | %FileCheck %s -check-prefix=CHECK-REAL-NAME
// CHECK-REAL-NAME-NOT: "swiftPrebuiltExternal": "XLogging"
// CHECK-REAL-NAME-NOT: "compiledModulePath":{{.*}}XLogging.swiftmodule",
// CHECK-REAL-NAME: "swiftPrebuiltExternal": "AppleLogging"
Expand All @@ -25,7 +25,7 @@

/// Scanned dependencies should contain real name AppleLoggingIF
// RUN: %target-swift-frontend -scan-dependencies %t/FileLib.swift -module-alias XLogging=AppleLoggingIF -I %t > %t/scandumpIF.output
// RUN: %FileCheck %s -check-prefix=CHECK-REAL-NAME-IF -input-file %t/scandumpIF.output
// RUN: %validate-json %t/scandumpIF.output | %FileCheck %s -check-prefix=CHECK-REAL-NAME-IF
// CHECK-REAL-NAME-IF-NOT: "swift": "XLogging"
// CHECK-REAL-NAME-IF-NOT: "moduleInterfacePath":{{.*}}XLogging.swiftinterface
// CHECK-REAL-NAME-IF: "swift": "AppleLoggingIF"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// RUN: %target-swift-frontend -typecheck -strict-implicit-module-context %s -I %S/Inputs/macro-only-module -Xcc -DTANGERINE=1 -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import

// RUN: %target-swift-frontend -scan-dependencies -strict-implicit-module-context %s -o %t/deps.json -I %S/Inputs/macro-only-module -Xcc -DTANGERINE=1 -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck %s < %t/deps.json

import ImportsMacroSpecificClangModule
Expand Down
1 change: 1 addition & 0 deletions test/ModuleInterface/clang-session-transitive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// RUN: %target-build-swift -module-name TestModule -module-link-name TestModule %S/Inputs/TestModule.swift -enable-library-evolution -emit-module-interface -o %t/TestModule.swiftmodule -swift-version 5 -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import

// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I%t -validate-clang-modules-once -clang-build-session-file %t/Build.session -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck %s < %t/deps.json

import TestModule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// RUN: %target-swift-emit-module-interface(%t/ExtensionAvailable.swiftinterface) %S/Inputs/extension-available.swift -module-name ExtensionAvailable -I%t -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import

// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I%t -application-extension -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck %s < %t/deps.json

import ExtensionAvailable
Expand Down
2 changes: 1 addition & 1 deletion test/ModuleInterface/infer-arch-from-file.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
import arm64

// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t -target arm64-apple-macos11.0
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// CHECK-NOT: arm64e-apple-macos11.0
4 changes: 2 additions & 2 deletions test/ScanDependencies/batch_module_scan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json

// Check the contents of the JSON output
// RUN: %FileCheck %s -check-prefix=CHECK-PCM < %t/outputs/F.pcm.json
// RUN: %FileCheck %s -check-prefix=CHECK-SWIFT < %t/outputs/F.swiftmodule.json
// RUN: %validate-json %t/outputs/F.pcm.json | %FileCheck %s -check-prefix=CHECK-PCM
// RUN: %validate-json %t/outputs/F.swiftmodule.json | %FileCheck %s -check-prefix=CHECK-SWIFT

// CHECK-PCM: {
// CHECK-PCM-NEXT: "mainModuleName": "F",
Expand Down
4 changes: 2 additions & 2 deletions test/ScanDependencies/batch_module_scan_arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json

// Check the contents of the JSON output
// RUN: %FileCheck %s -check-prefix=CHECK-TEN < %t/outputs/H.10.9.pcm.json
// RUN: %FileCheck %s -check-prefix=CHECK-ELEVEN < %t/outputs/H.11.0.pcm.json
// RUN: %validate-json %t/outputs/H.10.9.pcm.json | %FileCheck %s -check-prefix=CHECK-TEN
// RUN: %validate-json %t/outputs/H.11.0.pcm.json | %FileCheck %s -check-prefix=CHECK-ELEVEN

// CHECK-TEN: "clang": "I"
// CHECK-ELEVEN-NOT: "clang": "I"
3 changes: 2 additions & 1 deletion test/ScanDependencies/batch_module_scan_versioned.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
// RUN: %target-swift-frontend -scan-dependencies -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -target %target-cpu-apple-macosx11.0 -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json

// Check the contents of the JSON output
// RUN: %FileCheck %s -check-prefix=CHECK-PCM109 < %t/outputs/G_109.pcm.json
// RUN: %validate-json %t/outputs/G_109.pcm.json | %FileCheck %s -check-prefix=CHECK-PCM109
// RUN: %validate-json %t/outputs/G_110.pcm.json &>/dev/null
// RUN: %FileCheck %s -check-prefix=CHECK-PCM110 < %t/outputs/G_110.pcm.json

// CHECK-PCM109: {
Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/batch_prescan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// RUN: %target-swift-frontend -scan-dependencies -import-prescan -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json

// Check the contents of the JSON output
// RUN: %FileCheck %s -check-prefix=CHECK-SWIFT < %t/outputs/F.swiftmodule.json
// RUN: %validate-json %t/outputs/F.swiftmodule.json | %FileCheck %s -check-prefix=CHECK-SWIFT

// CHECK-SWIFT: {
// CHECK-SWIFT-NEXT:"imports": [
Expand Down
4 changes: 2 additions & 2 deletions test/ScanDependencies/bin_mod_import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import EWrapper
// RUN: %target-swift-frontend -compile-module-from-interface %S/Inputs/Swift/EWrapper.swiftinterface -o %t/EWrapper.swiftmodule -I %t
// Step 3: scan dependency should give us the binary module and a textual swift dependency from it
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// Step 4: Ensure that round-trip serialization does not affect result
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization %s -o %t/deps.json -I %t
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// CHECK: "modulePath": "{{.*}}EWrapper.swiftmodule"
// CHECK-NEXT: "directDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/binary_framework_dependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// Run the scan
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -F %t/Frameworks/ -sdk %t
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

import Foo

Expand Down
4 changes: 2 additions & 2 deletions test/ScanDependencies/binary_module_only.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import Foo

// Step 3: scan dependencies, pointed only at the binary module file should detect it as a swiftBinaryModule kind of dependency
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t/binaryModuleOnly -emit-dependencies -emit-dependencies-path %t/deps.d -sdk %t -prebuilt-module-cache-path %t/ResourceDir/%target-sdk-name/prebuilt-modules
// RUN: %FileCheck %s -check-prefix=BINARY_MODULE_ONLY < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=BINARY_MODULE_ONLY

// Step 4: Ensure that round-trip serialization does not affect result
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization %s -o %t/deps.json -I %t/binaryModuleOnly -emit-dependencies -emit-dependencies-path %t/deps.d -sdk %t -prebuilt-module-cache-path %t/ResourceDir/%target-sdk-name/prebuilt-modules
// RUN: %FileCheck %s -check-prefix=BINARY_MODULE_ONLY < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=BINARY_MODULE_ONLY
2 changes: 1 addition & 1 deletion test/ScanDependencies/blocklist-path-pass-down.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Run the scan
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -F %t/Frameworks/ -sdk %t -blocklist-file %t/blocklist.yml
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

import E

Expand Down
4 changes: 2 additions & 2 deletions test/ScanDependencies/can_import_placeholder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
// RUN: echo "}]" >> %/t/inputs/map.json

// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -placeholder-dependency-module-map-file %t/inputs/map.json -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// Ensure that round-trip serialization does not affect result
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization -module-cache-path %t/clang-module-cache %s -placeholder-dependency-module-map-file %t/inputs/map.json -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// REQUIRES: executable_test
// REQUIRES: objc_interop
Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/clang-target.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// RUN: find %t.module-cache -name "X-*.pcm" | count 1
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t.module-cache %s -o %t.deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -target %target-cpu-apple-macosx10.14 -clang-target %target-cpu-apple-macosx10.14

// RUN: %FileCheck %s < %t.deps.json
// RUN: %validate-json %t.deps.json | %FileCheck %s

// CHECK: "-clang-target"
// CHECK-NEXT: "{{.*}}-apple-macosx10.14"
Expand Down
8 changes: 4 additions & 4 deletions test/ScanDependencies/compiled_swift_modules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ import Foo

// Step 2: scan dependency should give us the binary module adjacent to the interface file.
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t -emit-dependencies -emit-dependencies-path %t/deps.d
// RUN: %FileCheck %s -check-prefix=HAS_COMPILED < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=HAS_COMPILED

// Step 3: remove the adjacent module.
// RUN: rm %t/Foo.swiftmodule/%target-swiftmodule-name

// Step 4: scan dependency should give us the interface file.
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t -emit-dependencies -emit-dependencies-path %t/deps.d
// RUN: %FileCheck %s -check-prefix=HAS_NO_COMPILED < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=HAS_NO_COMPILED

// Step 4: build prebuilt module cache using the interface.
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/ResourceDir/%target-sdk-name/prebuilt-modules/Foo.swiftmodule/%target-swiftmodule-name -module-name Foo -disable-interface-lock %t/Foo.swiftmodule/%target-swiftinterface-name

// Step 5: scan dependency now should give us the prebuilt module cache
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t -emit-dependencies -emit-dependencies-path %t/deps.d -sdk %t -prebuilt-module-cache-path %t/ResourceDir/%target-sdk-name/prebuilt-modules
// RUN: %FileCheck %s -check-prefix=HAS_COMPILED < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=HAS_COMPILED

// Step 6: update the interface file from where the prebuilt module cache was built.
// RUN: touch %t/Foo.swiftmodule/%target-swiftinterface-name

// Step 7: scan dependency should give us the prebuilt module file even though it's out-of-date.
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t -emit-dependencies -emit-dependencies-path %t/deps.d -sdk %t -prebuilt-module-cache-path %t/ResourceDir/%target-sdk-name/prebuilt-modules
// RUN: %FileCheck %s -check-prefix=HAS_COMPILED < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=HAS_COMPILED
2 changes: 1 addition & 1 deletion test/ScanDependencies/embed_tbd_module_dependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: mkdir -p %t/clang-module-cache

// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -swift-version 4 -embed-tbd-for-module E
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// CHECK: "mainModuleName": "deps"
// CHECK-NEXT: "modules": [
Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/escaped.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -scan-dependencies %s -I %S\\Inputs -o - | %FileCheck %s
// RUN: %target-swift-frontend -scan-dependencies %s -I %S\\Inputs -o - | %validate-json | %FileCheck %s

// We want to explicitly use the Windows path separator
// REQUIRES: OS=windows-msvc
Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/explicit-swift-dependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
// Check the contents of the JSON output
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// REQUIRES: executable_test
// REQUIRES: objc_interop
Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/include-sdk-in-command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -sdk %t/mysecretsdk.sdk

// Check the contents of the JSON output
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

func foo() { print(1) }

Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/local_cache_consistency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Run the scanner once, ensuring CoreFoundation dependencies are as expected
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -swift-version 4
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

import CoreFoundation

Expand Down
8 changes: 4 additions & 4 deletions test/ScanDependencies/module_deps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
// Check the contents of the JSON output
// RUN: %FileCheck -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck -check-prefix CHECK_NO_CLANG_TARGET %s

// Check the contents of the JSON output
// RUN: %FileCheck %s -check-prefix CHECK-NO-SEARCH-PATHS < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix CHECK-NO-SEARCH-PATHS

// Check the make-style dependencies file
// RUN: %FileCheck %s -check-prefix CHECK-MAKE-DEPS < %t/deps.d
Expand All @@ -22,12 +22,12 @@

// Ensure that round-trip serialization does not affect result
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
// RUN: %FileCheck -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck -check-prefix CHECK_NO_CLANG_TARGET %s

// Ensure that scanning with `-clang-target` makes sure that Swift modules' respective PCM-dependency-build-argument sets do not contain target triples.
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps_clang_target.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -clang-target %target-cpu-apple-macosx10.14
// Check the contents of the JSON output
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json
// RUN: %validate-json %t/deps_clang_target.json | %FileCheck -check-prefix CHECK_CLANG_TARGET %s

// REQUIRES: executable_test
// REQUIRES: objc_interop
Expand Down
1 change: 1 addition & 0 deletions test/ScanDependencies/module_deps_cache_reuse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// RUN: %target-swift-frontend -scan-dependencies -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 2>&1 | %FileCheck %s -check-prefix CHECK-REMARK-LOAD

// Check the contents of the JSON output
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck %s < %t/deps.json

// REQUIRES: executable_test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %empty-directory(%t.module-cache)
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t.module-cache %s -o %t.deps.json -I %S/Inputs/CHeaders

// RUN: %FileCheck %s < %t.deps.json
// RUN: %validate-json %t.deps.json | %FileCheck %s
// CHECK: "clang": "X_Private"
import X.Private

4 changes: 2 additions & 2 deletions test/ScanDependencies/module_deps_cross_import_overlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// RUN: mkdir -p %t/clang-module-cache
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
// Check the contents of the JSON output
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// Ensure that round-trip serialization does not affect result
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
// RUN: %FileCheck %s < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s

// REQUIRES: executable_test
// REQUIRES: objc_interop
Expand Down
Loading