@@ -6,75 +6,12 @@ original Objective-C headers. This semantic information can then be
6
6
used by the Swift compiler when importing the corresponding Objective-C
7
7
module to provide a better mapping of Objective-C APIs into Swift.
8
8
9
- API notes are organized into a set of ` .apinotes ` files. Each
10
- ` .apinotes ` file contains annotations for a single Objective-C module,
11
- written in YAML (FIXME: to be) described below. These YAML sources
12
- must be manually compiled into a binary representation (` .apinotesc ` )
13
- that the Swift compiler will lazily load when it builds code, also
9
+ API notes are organized into a set of ` .apinotes ` files. Each ` .apinotes ` file
10
+ contains annotations for a single Objective-C module, written in YAML (FIXME:
11
+ to be) described in the Clang repository. These YAML sources are lazily loaded
12
+ by the Swift compiler when it imports the corresponding framework, also
14
13
described below.
15
14
16
- # API Notes YAML Format
17
-
18
- TBD...
19
-
20
- # Compiling API notes
21
-
22
- The Swift compiler lazily loads API notes from compiled API notes
23
- files (` .apinotesc ` files) and uses these annotations to affect the
24
- Swift signatures of imported Objective-C APIs. Compiled API notes
25
- files reside in the Swift module directory, i.e., the same directory
26
- where the ` .swiftmodule ` file would reside for the Swift overlay of
27
- that module. For system modules, the path depends on the platform
28
- and architecture.
29
-
30
- Platform | Path
31
- :------------- | :-------------
32
- macOS | ` $SWIFT_EXEC/lib/swift/macosx/ `
33
- iOS (32-bit) | ` $SWIFT_EXEC/lib/swift/iphoneos/32 `
34
- iOS (64-bit) | ` $SWIFT_EXEC/lib/swift/iphoneos `
35
- iOS Simulator (32-bit) | ` $SWIFT_EXEC/lib/swift/iphonesimulator/32 `
36
- iOS Simulator (64-bit) | ` $SWIFT_EXEC/lib/swift/iphonesimulator `
37
-
38
- where ` $SWIFT_EXEC/bin/swift ` is the path to the Swift compiler
39
- executable.
40
-
41
- When updating API notes for a system module, recompile the API notes
42
- and place the result in the appropriate directories listed above. The
43
- Swift compiler itself need not be recompiled except in rare cases
44
- where the changes affect how the SDK overlays are built. To recompile
45
- API notes for a given module ` $MODULE ` and place them into their
46
-
47
- ### macOS
48
- ```
49
- xcrun swift -apinotes -yaml-to-binary -target x86_64-apple-macosx10.10 -o $SWIFT_EXEC/lib/swift/macosx/$MODULE.apinotesc $MODULE.apinotes
50
- ```
51
-
52
- ### iOS (32-bit)
53
- ```
54
- xcrun swift -apinotes -yaml-to-binary -target armv7-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/32/$MODULE.apinotesc $MODULE.apinotes
55
- ```
56
-
57
- ### iOS (64-bit)
58
- ```
59
- xcrun swift -apinotes -yaml-to-binary -target arm64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/$MODULE.apinotesc $MODULE.apinotes
60
- ```
61
-
62
- ### iOS Simulator (32-bit)
63
- ```
64
- xcrun swift -apinotes -yaml-to-binary -target i386-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/32/$MODULE.apinotesc $MODULE.apinotes
65
- ```
66
-
67
- ### iOS Simulator (64-bit)
68
- ```
69
- xcrun swift -apinotes -yaml-to-binary -target x86_64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/$MODULE.apinotesc $MODULE.apinotes
70
- ```
71
-
72
15
To add API notes for a system module ` $MODULE ` that does not have them yet,
73
16
create a new source file ` $MODULE.apinotes ` and update CMakeLists.txt.
74
17
Updated API notes will be found by the build system during the next build.
75
-
76
- Note that Swift provides decompilation of binary API notes files via
77
- the ` -apinotes -binary-to-yaml ` option, which allows one to inspect
78
- the information the compiler is using internally. The order of the
79
- entities in the original YAML input is not preserved, so all entities
80
- in the resulting YAML output are sorted alphabetically.
0 commit comments