Skip to content

Commit 7d4f62f

Browse files
Merge pull request #72682 from cachemeifyoucan/eng/PR-add-test-for-125421391
[Caching] Add a testcase for clang-module-export-as
2 parents 734da62 + 1066fb4 commit 7d4f62f

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

test/CAS/clang-module-export-as.swift

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// REQUIRES: objc_interop
2+
// RUN: %empty-directory(%t)
3+
// RUN: split-file %s %t
4+
5+
// RUN: %target-swift-frontend -emit-module -module-name A_Internal -o %t/A_Internal.swiftmodule -swift-version 5 \
6+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
7+
// RUN: -emit-module-interface-path %t/A_Internal.swiftinterface -enable-library-evolution -I %t %t/A_Internal.swift
8+
9+
// RUN: %target-swift-frontend -emit-module -module-name A -o %t/A.swiftmodule -swift-version 5 \
10+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
11+
// RUN: -emit-module-interface-path %t/A.swiftinterface -enable-library-evolution -I %t %t/A.swift
12+
13+
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache %t/main.swift \
14+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
15+
// RUN: -o %t/deps.json -I %t -cache-compile-job -cas-path %t/cas -swift-version 5
16+
17+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
18+
// RUN: %swift_frontend_plain @%t/shim.cmd
19+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:AC > %t/clangAC.cmd
20+
// RUN: %swift_frontend_plain @%t/clangAC.cmd
21+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/clangA.cmd
22+
// RUN: %swift_frontend_plain @%t/clangA.cmd
23+
24+
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
25+
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
26+
27+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
28+
29+
// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule \
30+
// RUN: -cache-compile-job -cas-path %t/cas \
31+
// RUN: -disable-implicit-swift-modules -swift-version 5 -enable-cross-import-overlays \
32+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
33+
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
34+
// RUN: %t/main.swift @%t/MyApp.cmd
35+
36+
//--- main.swift
37+
import A
38+
39+
extension Base {
40+
func test(input: String) {
41+
Base.testA(1)
42+
}
43+
}
44+
45+
//--- A.swift
46+
@_exported import A
47+
@_implementationOnly import A_Internal
48+
public extension Base {
49+
static func testA(_ num: Int) {}
50+
fileprivate func testA(_ p: AI) {}
51+
}
52+
53+
//--- A_Internal.swift
54+
public struct AI {}
55+
56+
//--- a.h
57+
#include "ac.h"
58+
59+
//--- ac.h
60+
@interface Base
61+
- (void)test;
62+
@end
63+
64+
//--- module.modulemap
65+
module A {
66+
header "a.h"
67+
export *
68+
}
69+
70+
module AC {
71+
header "ac.h"
72+
export_as A
73+
export *
74+
}

0 commit comments

Comments
 (0)