Skip to content

Commit 6482159

Browse files
committed
[android] fix path and cmake local build target tracking for posix_filesystem.apinotes
This apinote file needs to be accessible in the locally built Android SDK as it's being built with build.ps1, so that swift-foundation can be built with that file present. This change ensures that the file is copied over into the local build directory for that Android SDK, in addition to being included in the installed component This change also places the component into lib/swift/apinotes, as that's where the clang importer already looks for API notes (cherry-picked from c036270)
1 parent 2ba9032 commit 6482159

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

stdlib/public/Platform/CMakeLists.txt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,23 @@ if("ANDROID" IN_LIST SWIFT_SDKS)
473473
endif()
474474
endforeach()
475475

476+
set(android_posix_filesystem_apinotes_source "posix_filesystem.apinotes")
477+
set(apinotes_subdir "${SWIFTLIB_DIR}/apinotes")
478+
add_custom_command_target(
479+
copy_android_posix_filesystem_apinotes_resource
480+
COMMAND
481+
"${CMAKE_COMMAND}" "-E" "make_directory" ${apinotes_subdir}
482+
COMMAND
483+
"${CMAKE_COMMAND}" "-E" "copy_if_different"
484+
"${CMAKE_CURRENT_SOURCE_DIR}/${android_posix_filesystem_apinotes_source}" ${apinotes_subdir}
485+
OUTPUT ${apinotes_subdir}/${android_posix_filesystem_apinotes_source}
486+
COMMENT "Copying Android posix_filesystem API notes to resource directories")
487+
add_dependencies(sdk-overlay ${copy_android_posix_filesystem_apinotes_resource})
488+
list(APPEND android_modulemap_target_list ${copy_android_posix_filesystem_apinotes_resource})
476489
swift_install_in_component(FILES
477-
posix_filesystem.apinotes
478-
DESTINATION "share"
479-
COMPONENT sdk-overlay)
490+
"${android_posix_filesystem_apinotes_source}"
491+
DESTINATION "lib/swift/apinotes"
492+
COMPONENT sdk-overlay)
480493
endif()
481494
add_custom_target(android_modulemap DEPENDS ${android_modulemap_target_list})
482495
set_property(TARGET android_modulemap PROPERTY FOLDER "Miscellaneous")

0 commit comments

Comments
 (0)