-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InstallAPI] Add *umbrella-header options (#86587)
Umbrella headers are a concept for Darwin-based libraries. They allow framework authors to control the order in which their headers should be parsed and allow clients to access available headers by including a single header. InstallAPI will attempt to find the umbrella based on the name of the framework. Users can also specify this explicitly by using command line options specifying the umbrella header by file path. There can be an umbrella header per access level.
- Loading branch information
1 parent
9669aba
commit 6ad1cf3
Showing
11 changed files
with
206 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
clang/test/InstallAPI/Inputs/Umbrella/Umbrella.framework/Headers/AAA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#ifndef PUBLIC_UMBRELLA_HEADER_FIRST | ||
#error "Public umbrella header was not included first!" | ||
#endif |
1 change: 1 addition & 0 deletions
1
clang/test/InstallAPI/Inputs/Umbrella/Umbrella.framework/Headers/SpecialUmbrella.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define PUBLIC_UMBRELLA_HEADER_FIRST |
3 changes: 3 additions & 0 deletions
3
clang/test/InstallAPI/Inputs/Umbrella/Umbrella.framework/PrivateHeaders/AAA_Private.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#ifndef PRIVATE_UMBRELLA_HEADER_FIRST | ||
#error "Private umbrella header was not included first!" | ||
#endif |
1 change: 1 addition & 0 deletions
1
...est/InstallAPI/Inputs/Umbrella/Umbrella.framework/PrivateHeaders/SpecialPrivateUmbrella.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define PRIVATE_UMBRELLA_HEADER_FIRST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// UNSUPPORTED: system-windows | ||
|
||
; RUN: rm -rf %t | ||
; RUN: split-file %s %t | ||
; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json | ||
; RUN: mkdir %t/Frameworks/ | ||
; RUN: cp -r %S/Inputs/Umbrella/Umbrella.framework %t/Frameworks/ | ||
|
||
// Only validate path based input that rely on regex matching on unix based file systems. | ||
; RUN: clang-installapi --target=arm64-apple-macosx13 \ | ||
; RUN: -install_name /System/Library/Frameworks/Umbrella2.framework/Versions/A/Umbrella \ | ||
; RUN: -ObjC -F%t/Frameworks/ %t/inputs.json \ | ||
; RUN: --public-umbrella-header=%t/Frameworks/Umbrella.framework/Headers/SpecialUmbrella.h \ | ||
; RUN: -private-umbrella-header \ | ||
; RUN: %t/Frameworks/Umbrella.framework/PrivateHeaders/SpecialPrivateUmbrella.h \ | ||
; RUN: -o %t/output.tbd 2>&1 | FileCheck -allow-empty %s | ||
|
||
; CHECK-NOT: error | ||
; CHECK-NOT: warning | ||
|
||
;--- inputs.json.in | ||
{ | ||
"headers": [ { | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/Headers/AAA.h", | ||
"type" : "public" | ||
}, | ||
{ | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/Headers/SpecialUmbrella.h", | ||
"type" : "public" | ||
}, | ||
{ | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/PrivateHeaders/AAA_Private.h", | ||
"type" : "private" | ||
}, | ||
{ | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/PrivateHeaders/SpecialPrivateUmbrella.h", | ||
"type" : "private" | ||
}], | ||
"version": "3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
; RUN: rm -rf %t | ||
; RUN: split-file %s %t | ||
; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json | ||
; RUN: cp -r %S/Inputs/Umbrella/Umbrella.framework %t/Frameworks/ | ||
|
||
// Check base filename matches. | ||
; RUN: clang-installapi --target=arm64-apple-macosx13 \ | ||
; RUN: -install_name /System/Library/Frameworks/Umbrella.framework/Versions/A/Umbrella \ | ||
; RUN: -ObjC -F%t/Frameworks/ %t/inputs.json \ | ||
; RUN: --public-umbrella-header=SpecialUmbrella.h \ | ||
; RUN: --private-umbrella-header=SpecialPrivateUmbrella.h \ | ||
; RUN: -o %t/output.tbd 2>&1 | FileCheck -allow-empty %s | ||
|
||
// Try missing umbrella header argument. | ||
; RUN: not clang-installapi --target=arm64-apple-macosx13 \ | ||
; RUN: -install_name /System/Library/Frameworks/Umbrella.framework/Versions/A/Umbrella \ | ||
; RUN: -ObjC -F%t/Frameworks/ %t/inputs.json \ | ||
; RUN: --public-umbrella-header=Ignore.h \ | ||
; RUN: -o %t/output.tbd 2>&1 | FileCheck %s -check-prefix=ERR | ||
|
||
; ERR: error: public umbrella header file not found in input: 'Ignore.h' | ||
|
||
; CHECK-NOT: error | ||
; CHECK-NOT: warning | ||
|
||
;--- Frameworks/Umbrella.framework/Headers/Ignore.h | ||
#error "This header should be ignored" | ||
|
||
;--- inputs.json.in | ||
{ | ||
"headers": [ { | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/Headers/AAA.h", | ||
"type" : "public" | ||
}, | ||
{ | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/Headers/SpecialUmbrella.h", | ||
"type" : "public" | ||
}, | ||
{ | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/PrivateHeaders/AAA_Private.h", | ||
"type" : "private" | ||
}, | ||
{ | ||
"path" : "DSTROOT/Frameworks/Umbrella.framework/PrivateHeaders/SpecialPrivateUmbrella.h", | ||
"type" : "private" | ||
}], | ||
"version": "3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters