Skip to content

Commit 73cce97

Browse files
committed
[CMake] Remove the CMakeLists file from apinotes/.
Also, move the ObjectiveC overlay into its own directory, so that we can use the directory name as an indicator of what overlays exist. This is in preparation for DevPubs providing the contents of the apinotes/ directory. The downside here is that adding new apinotes files doesn't automatically trigger a rebuild; I intend to mitigate that somewhat by at least triggering one when the revision number of the DevPubs repo changes. Swift SVN r21078
1 parent 77ea35a commit 73cce97

File tree

6 files changed

+21
-78
lines changed

6 files changed

+21
-78
lines changed

CMakeLists.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -830,26 +830,21 @@ macro(add_swift_library_single target name)
830830
set(SWIFTLIB_SINGLE_API_NOTES)
831831
if (SWIFTLIB_SINGLE_API_NOTES_NON_OVERLAY)
832832
# Adopt all of the non-overlay API notes.
833-
list(APPEND SWIFTLIB_SINGLE_API_NOTES
834-
${SWIFT_API_NOTES_NON_OVERLAY_MODULES})
833+
foreach(next_notes_input ${SWIFT_API_NOTES_INPUTS})
834+
if (NOT IS_DIRECTORY "${SWIFT_SOURCE_DIR}/stdlib/objc/${next_notes_input}")
835+
list(APPEND SWIFTLIB_SINGLE_API_NOTES "${next_notes_input}")
836+
endif()
837+
endforeach()
835838
endif()
836839

837840
# Remove the "swift" prefix from the name to determine the module
838841
# name.
839842
string(REPLACE swift "" module_name ${name})
840-
list(FIND SWIFT_API_NOTES_OVERLAY_MODULES ${module_name} overlay_index)
843+
list(FIND SWIFT_API_NOTES_INPUTS ${module_name} overlay_index)
841844
if (${overlay_index} GREATER -1)
842845
set(SWIFTLIB_SINGLE_API_NOTES ${module_name})
843846
endif()
844847

845-
# Make sure that this module name isn't listed in the "non-overlay"
846-
# list. This is a sanity check.
847-
list(FIND SWIFT_API_NOTES_NON_OVERLAY_MODULES ${module_name}
848-
non_overlay_index)
849-
if (${non_overlay_index} GREATER -1)
850-
message(SEND_ERROR "${module_name} module has an SDK overlay, so it should be listed in SWIFT_API_NOTES_OVERLAY_MODULES rather than SWIFT_API_NOTES_NON_OVERLAY_MODULES")
851-
endif()
852-
853848
# FIXME: don't actually depend on the libraries in SWIFTLIB_SINGLE_DEPENDS,
854849
# just any swiftmodule files that are associated with them.
855850
handle_swift_sources(SWIFTLIB_SINGLE_SOURCES
@@ -1599,8 +1594,13 @@ include_directories(BEFORE
15991594
${CMAKE_CURRENT_SOURCE_DIR}/include
16001595
)
16011596

1597+
file(GLOB SWIFT_API_NOTES_INPUT_FILES "${SWIFT_API_NOTES_PATH}/*.apinotes")
1598+
foreach(file ${SWIFT_API_NOTES_INPUT_FILES})
1599+
get_filename_component(name "${file}" NAME_WE)
1600+
list(APPEND SWIFT_API_NOTES_INPUTS ${name})
1601+
endforeach()
1602+
16021603
# Add all of the subdirectories, where we actually do work.
1603-
add_subdirectory(apinotes)
16041604
if (SWIFT_BUILD_TOOLS)
16051605
add_subdirectory(include)
16061606
add_subdirectory(lib)

apinotes/CMakeLists.txt

Lines changed: 0 additions & 42 deletions
This file was deleted.

apinotes/README.txt

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,9 @@ API notes for a given module $MODULE and place them into their
6363
xcrun swift -apinotes -yaml-to-binary -target x64_64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/$MODULE.apinotesc $MODULE.apinotes
6464

6565
To add API notes for a system module $MODULE that does not have them yet,
66-
create a new source file $MODULE.apinotes. Then, add this module name
67-
to the appropriate list in CMakeLists.txt:
68-
69-
SWIFT_API_NOTES_OVERLAY_MODULES, when $MODULE already has a Swift
70-
overlay. One can check whether a Swift overlay exists for a given
71-
module by looking for libswift$MODULE.dylib within the appropriate
72-
platform-specific directory:
73-
74-
OSX $SWIFT_EXEC/lib/swift/macosx
75-
iOS $SWIFT_EXEC/lib/swift/iphoneos
76-
iOS Simulator $SWIFT_EXEC/lib/swift/iphonesimulator
77-
78-
SWIFT_API_NOTES_NON_OVERLAY_MODULES, when $MODULE does not have a
79-
Swift overlay.
80-
81-
Updated or newly-added API notes will be found by the compiler during
82-
the next compiler execution.
66+
create a new source file $MODULE.apinotes. Newly-added API notes will require
67+
re-running CMake. Updated API notes will be found by the build system during
68+
the next build.
8369

8470
Note that Swift provides decompilation of binary API notes files via
8571
the "-apinotes -binary-to-yaml" option, which allows one to inspect

stdlib/objc/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
list(APPEND SWIFT_EXTRA_FLAGS
33
"-autolink-force-load")
44

5-
# Build the swiftObjC dylib.
6-
set(SHARED_LIBRARY ON)
7-
8-
add_swift_library(swiftObjectiveC INSTALL TARGET_LIBRARY
9-
ObjectiveC.swift
10-
DEPENDS swiftCore swiftDarwin)
11-
125
add_subdirectory(Darwin)
136
add_subdirectory(Dispatch)
147
add_subdirectory(CoreGraphics)
158
add_subdirectory(Foundation)
9+
add_subdirectory(ObjectiveC)
1610
add_subdirectory(SpriteKit)
1711

1812
if (SWIFT_SDKS)

stdlib/objc/ObjectiveC/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set(SHARED_LIBRARY ON)
2+
3+
add_swift_library(swiftObjectiveC INSTALL TARGET_LIBRARY
4+
ObjectiveC.swift
5+
DEPENDS swiftCore swiftDarwin)

0 commit comments

Comments
 (0)