Skip to content

[ScanDependencies] Fix JSON generation under certain circunstances. #67246

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 12, 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
9 changes: 6 additions & 3 deletions lib/DependencyScan/ScanDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,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;

if (swiftTextualDeps->cas_fs_root_id.length != 0) {
writeJSONSingleField(out, "casFSRootID",
Expand Down Expand Up @@ -1090,7 +1093,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 Down Expand Up @@ -1126,7 +1129,7 @@ static void writeJSON(llvm::raw_ostream &out,
out.indent(6 * 2);
out << "]\n";
out.indent(5 * 2);
out << (hasOverlayDependencies ? "},\n" : "}\n");
out << (commaAfterBridgingHeaderPath ? "},\n" : "}\n");
}
if (hasOverlayDependencies) {
writeDependencies(out, swiftTextualDeps->swift_overlay_module_dependencies,
Expand Down
2 changes: 1 addition & 1 deletion test/CAS/binary_module_deps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %S/../ScanDependencies/Inputs/Swift/E.swiftinterface -o %t/E.swiftmodule -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -swift-version 4
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %S/../ScanDependencies/Inputs/Swift/A.swiftinterface -o %t/A.swiftmodule -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -swift-version 4
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %t -swift-version 4 -cache-compile-job -cas-path %t/cas
// RUN: %FileCheck %s -DTEMP=%t < %t/deps.json
// RUN: %validate-json %t/deps.json | %FileCheck %s -DTEMP=%t

/// Test binary module key: binary module key is the CASID of itself.
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey > %t/A.key.casid
Expand Down
1 change: 1 addition & 0 deletions test/CAS/cas-explicit-module-map.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %t/A.swift -o %t/A.swiftmodule -swift-version 5
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %t/B.swift -o %t/B.swiftmodule -I %t -swift-version 5
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %t/Test.swift -o %t/deps.json -I %t -swift-version 5 -cache-compile-job -cas-path %t/cas
// RUN: %validate-json %t/deps.json &>/dev/null

// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey | tr -d '\n' > %t/A.key
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:B moduleCacheKey | tr -d '\n' > %t/B.key
Expand Down
3 changes: 3 additions & 0 deletions test/CAS/module_deps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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

// Check the contents of the JSON output
Expand All @@ -15,11 +16,13 @@
// RUN: %FileCheck %s -check-prefix CHECK-MAKE-DEPS < %t/deps.d

// 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/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job -cas-path %t/cas
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json

// 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/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -clang-target %target-cpu-apple-macosx10.14 -cache-compile-job -cas-path %t/cas
// Check the contents of the JSON output
// RUN: %validate-json %t/deps_clang_target.json &>/dev/null
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json

/// check cas-fs content
Expand Down
1 change: 1 addition & 0 deletions test/CAS/module_deps_clang_extras.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// RUN: %t/Test.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas -clang-include-tree \
// RUN: -Xcc -fmodule-map-file=%t/module.modulemap -Xcc -ivfsoverlay -Xcc %t/empty.yaml \
// RUN: -Xcc -I%t/empty.hmap
// RUN: %validate-json %t/deps.json &>/dev/null

// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps casFSRootID > %t/fs.casid
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/fs.casid | %FileCheck %s -DDIR=%basename_t -check-prefix FS_ROOT
Expand Down
3 changes: 3 additions & 0 deletions test/CAS/module_deps_include_tree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job -cas-path %t/cas -clang-include-tree
// Check the contents of the JSON output
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json

// Check the contents of the JSON output
Expand All @@ -15,11 +16,13 @@
// RUN: %FileCheck %s -check-prefix CHECK-MAKE-DEPS < %t/deps.d

// 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/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job -cas-path %t/cas -clang-include-tree
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json

// 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/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -clang-target %target-cpu-apple-macosx10.14 -cache-compile-job -cas-path %t/cas -clang-include-tree
// Check the contents of the JSON output
// RUN: %validate-json %t/deps_clang_target.json &>/dev/null
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json

/// check cas-fs content
Expand Down
2 changes: 2 additions & 0 deletions test/CAS/plugin_cas.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// RUN: -cas-plugin-option first-prefix=myfirst- -cas-plugin-option second-prefix=mysecond- \
// RUN: -cas-plugin-option upstream-path=%t/cas-upstream
// Check the contents of the JSON output
// RUN: %validate-json %t/deps.json &>/dev/null
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json

// Check the contents of the JSON output
Expand All @@ -31,6 +32,7 @@
// RUN: -cas-plugin-option first-prefix=myfirst- -cas-plugin-option second-prefix=mysecond- \
// RUN: -cas-plugin-option upstream-path=%t/cas-upstream
// Check the contents of the JSON output
// RUN: %validate-json %t/deps_clang_target.json &>/dev/null
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json

import C
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
Loading