11// RUN: %empty-directory(%t)
22// RUN: %empty-directory(%t/module-cache)
33// RUN: %empty-directory(%t/Modules)
4+ // RUN: %empty-directory(%t/ExtraCModules)
45
56// RUN: split-file %s %t
67
78// Build Module D
89// RUN: %target-swift-frontend -emit-module %t/D.swift -emit-module-path %t/Modules/D.swiftmodule/%target-swiftmodule-name -module-name D -enable-library-evolution -emit-module-interface-path %t/Modules/D.swiftmodule/%target-swiftinterface-name
910
1011// Build Module C
11- // RUN: %target-swift-frontend -emit-module %t/C.swift -emit-module-path %t/Modules/C.swiftmodule/%target-swiftmodule-name -module-name C -enable-library-evolution -emit-module-interface-path %t/Modules/C.swiftmodule/%target-swiftinterface-name -I %t/Modules/
12+ // RUN: %target-swift-frontend -emit-module %t/C.swift -emit-module-path %t/Modules/C.swiftmodule/%target-swiftmodule-name -module-name C -enable-library-evolution -emit-module-interface-path %t/Modules/C.swiftmodule/%target-swiftinterface-name -I %t/Modules -I %t/ExtraCModules
1213
1314// Build Module B
14- // RUN: %target-swift-frontend -emit-module %t/B.swift -emit-module-path %t/Modules/B.swiftmodule/%target-swiftmodule-name -module-name B -enable-library-evolution -emit-module-interface-path %t/Modules/B.swiftmodule/%target-swiftinterface-name -I %t/Modules/
15+ // RUN: %target-swift-frontend -emit-module %t/B.swift -emit-module-path %t/Modules/B.swiftmodule/%target-swiftmodule-name -module-name B -enable-library-evolution -emit-module-interface-path %t/Modules/B.swiftmodule/%target-swiftinterface-name -I %t/Modules -I %t/ExtraCModules
1516
1617// Build Module A
17- // RUN: %target-swift-frontend -emit-module %t/A.swift -emit-module-path %t/Modules/A.swiftmodule/%target-swiftmodule-name -module-name A -enable-library-evolution -emit-module-interface-path %t/Modules/A.swiftmodule/%target-swiftinterface-name -I %t/Modules/
18+ // RUN: %target-swift-frontend -emit-module %t/A.swift -emit-module-path %t/Modules/A.swiftmodule/%target-swiftmodule-name -module-name A -enable-library-evolution -emit-module-interface-path %t/Modules/A.swiftmodule/%target-swiftinterface-name -I %t/Modules -I %t/ExtraCModules
1819
1920// Initial Scan Client module
20- // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -serialize-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_initial.json -I %t/Modules -I %S/../Inputs/CHeaders -module-name Client
21+ // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -serialize-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_initial.json -I %t/Modules -I %t/ExtraCModules -I % S/../Inputs/CHeaders -module-name Client
2122
2223// Clean re-scan
23- // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_clean_rescan.json -I %t/Modules -I %S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/clean_incremental_scan_output.txt
24+ // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_clean_rescan.json -I %t/Modules -I %t/ExtraCModules -I % S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/clean_incremental_scan_output.txt
2425// RUN: cat %t/clean_incremental_scan_output.txt | %FileCheck %s -check-prefix=CLEAN-INCREMENTAL-SCAN-CHECK
2526
2627// Touch C and re-scan
2728// RUN: touch %t/Modules/C.swiftmodule/%target-swiftinterface-name
28- // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_stale_C_rescan.json -I %t/Modules -I %S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/stale_C_incremental_scan_output.txt
29+ // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_stale_C_rescan.json -I %t/Modules -I %t/ExtraCModules -I % S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/stale_C_incremental_scan_output.txt
2930// RUN: cat %t/stale_C_incremental_scan_output.txt | %FileCheck %s -check-prefix=STALE-C-INCREMENTAL-SCAN-CHECK
3031
3132// Clean re-scan
32- // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_clean_rescan_2.json -I %t/Modules -I %S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/clean_incremental_scan_output_2.txt
33+ // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_clean_rescan_2.json -I %t/Modules -I %t/ExtraCModules -I % S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/clean_incremental_scan_output_2.txt
3334// RUN: cat %t/clean_incremental_scan_output_2.txt | %FileCheck %s -check-prefix=CLEAN-INCREMENTAL-SCAN-CHECK
3435
3536// Replace a module dependency in A, ensure re-scan detects it
3637// RUN: echo "import X" > %t/A.swift
37- // RUN: %target-swift-frontend -emit-module %t/A.swift -emit-module-path %t/Modules/A.swiftmodule/%target-swiftmodule-name -module-name A -enable-library-evolution -emit-module-interface-path %t/Modules/A.swiftmodule/%target-swiftinterface-name -I %t/Modules/ -I %S/../Inputs/CHeaders
38+ // RUN: %target-swift-frontend -emit-module %t/A.swift -emit-module-path %t/Modules/A.swiftmodule/%target-swiftmodule-name -module-name A -enable-library-evolution -emit-module-interface-path %t/Modules/A.swiftmodule/%target-swiftinterface-name -I %t/Modules -I %t/ExtraCModules -I %S/../Inputs/CHeaders
3839
3940// Re-scan to ensure A gets scanned again and the new dependency is picked up.
40- // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_new_A_rescan.json -I %t/Modules -I %S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/new_A_incremental_scan_output.txt
41+ // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_new_A_rescan.json -I %t/Modules -I %t/ExtraCModules -I % S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/new_A_incremental_scan_output.txt
4142// RUN: cat %t/new_A_incremental_scan_output.txt | %FileCheck %s -check-prefix=NEW-A-INCREMENTAL-SCAN-CHECK
4243// RUN: %validate-json %t/deps_new_A_rescan.json | %FileCheck %s --check-prefix=NEW-A-DEPS-CHECK
4344
44- // Touch a header in Clang module X and re-scan
45- // RUN: touch %S/../Inputs/CHeaders/X .h
46- // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_stale_X_rescan .json -I %t/Modules -I %S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/stale_X_incremental_scan_output .txt
47- // RUN: cat %t/stale_X_incremental_scan_output .txt | %FileCheck %s -check-prefix=STALE-X -INCREMENTAL-SCAN-CHECK
45+ // Touch a header in Clang module Z and re-scan
46+ // RUN: touch %t/ExtraCModules/Z .h
47+ // RUN: %target-swift-frontend -scan-dependencies -scanner-module-validation -module-load-mode prefer-interface -Rdependency-scan-cache -load-dependency-scan-cache -dependency-scan-cache-path %t/cache.moddepcache -module-cache-path %t/module-cache %t/Client.swift -o %t/deps_stale_Z_rescan .json -I %t/Modules -I %t/ExtraCModules -I % S/../Inputs/CHeaders -module-name Client -serialize-dependency-scan-cache -validate-prior-dependency-scan-cache &> %t/stale_Z_incremental_scan_output .txt
48+ // RUN: cat %t/stale_Z_incremental_scan_output .txt | %FileCheck %s -check-prefix=STALE-Z -INCREMENTAL-SCAN-CHECK
4849
4950// CLEAN-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Re-using serialized module scanning dependency cache from: {{.*}}cache.moddepcache
5051// CLEAN-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Serializing module scanning dependency cache to: {{.*}}cache.moddepcache
6162// NEW-A-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Dependency info for module 'A' invalidated due to a modified input since last scan: {{.*}}A.swiftmodule{{.*}}swiftinterface
6263// NEW-A-DEPS-CHECK: "clang": "X"
6364
64- // STALE-X-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Re-using serialized module scanning dependency cache from: {{.*}}cache.moddepcache
65- // STALE-X-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Dependency info for module 'X' invalidated due to a modified input since last scan: {{.*}}X.h
66- // STALE-X-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Dependency info for module 'A' invalidated due to an out-of-date dependency.
67- // STALE-X-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Serializing module scanning dependency cache to: {{.*}}cache.moddepcache
65+ // STALE-Z-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Re-using serialized module scanning dependency cache from: {{.*}}cache.moddepcache
66+ // STALE-Z-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Dependency info for module 'Z' invalidated due to a modified input since last scan: {{.*}}Z.h
67+ // STALE-Z-INCREMENTAL-SCAN-CHECK: remark: Incremental module scan: Serializing module scanning dependency cache to: {{.*}}cache.moddepcache
68+
69+ //--- ExtraCModules/Z.h
70+ void funcZ ( void) ;
71+
72+ //--- ExtraCModules/module.modulemap
73+ module Z {
74+ header " Z.h "
75+ export *
76+ }
6877
6978//--- A.swift
7079import B
@@ -80,3 +89,4 @@ public func foo() {}
8089
8190//--- Client.swift
8291import A
92+ import Z
0 commit comments