diff --git a/lib/ClangImporter/ClangIncludePaths.cpp b/lib/ClangImporter/ClangIncludePaths.cpp index 172cc5d952fda..c8ed4079f570c 100644 --- a/lib/ClangImporter/ClangIncludePaths.cpp +++ b/lib/ClangImporter/ClangIncludePaths.cpp @@ -418,29 +418,6 @@ GetPlatformAuxiliaryFile(StringRef Platform, StringRef File, return ""; } -SmallVector, 2> -GetAndroidFileMappings( - ASTContext &Context, const std::string &sysroot, - const llvm::IntrusiveRefCntPtr &VFS) { - const llvm::Triple &Triple = Context.LangOpts.Target; - const SearchPathOptions &SearchPathOpts = Context.SearchPathOpts; - SmallVector, 2> Mappings; - std::string AuxiliaryFile; - - if (!Triple.isAndroid()) return Mappings; - - llvm::SmallString<261> NDKInjection{sysroot}; - llvm::sys::path::append(NDKInjection, "posix_filesystem.apinotes"); - - AuxiliaryFile = - GetPlatformAuxiliaryFile("android", "posix_filesystem.apinotes", - SearchPathOpts); - if (!AuxiliaryFile.empty()) - Mappings.emplace_back(std::string(NDKInjection), AuxiliaryFile); - - return Mappings; -} - SmallVector, 2> GetWindowsFileMappings( ASTContext &Context, const llvm::IntrusiveRefCntPtr &driverVFS, @@ -612,9 +589,5 @@ ClangInvocationFileMapping swift::getClangInvocationFileMapping( result.redirectedFiles.append(GetWindowsFileMappings( ctx, vfs, result.requiresBuiltinHeadersInSystemModules)); - - result.redirectedFiles.append(GetAndroidFileMappings(ctx, sysroot.str().str(), - vfs)); - return result; } diff --git a/stdlib/public/Platform/CMakeLists.txt b/stdlib/public/Platform/CMakeLists.txt index 996e072ee1a31..928b5d9cb6302 100644 --- a/stdlib/public/Platform/CMakeLists.txt +++ b/stdlib/public/Platform/CMakeLists.txt @@ -474,10 +474,23 @@ if("ANDROID" IN_LIST SWIFT_SDKS) endif() endforeach() + set(android_posix_filesystem_apinotes_source "posix_filesystem.apinotes") + set(apinotes_subdir "${SWIFTLIB_DIR}/apinotes") + add_custom_command_target( + copy_android_posix_filesystem_apinotes_resource + COMMAND + "${CMAKE_COMMAND}" "-E" "make_directory" ${apinotes_subdir} + COMMAND + "${CMAKE_COMMAND}" "-E" "copy_if_different" + "${CMAKE_CURRENT_SOURCE_DIR}/${android_posix_filesystem_apinotes_source}" ${apinotes_subdir} + OUTPUT ${apinotes_subdir}/${android_posix_filesystem_apinotes_source} + COMMENT "Copying Android posix_filesystem API notes to resource directories") + add_dependencies(sdk-overlay ${copy_android_posix_filesystem_apinotes_resource}) + list(APPEND android_modulemap_target_list ${copy_android_posix_filesystem_apinotes_resource}) swift_install_in_component(FILES - posix_filesystem.apinotes - DESTINATION "share" - COMPONENT sdk-overlay) + "${android_posix_filesystem_apinotes_source}" + DESTINATION "lib/swift/apinotes" + COMPONENT sdk-overlay) endif() add_custom_target(android_modulemap DEPENDS ${android_modulemap_target_list}) set_property(TARGET android_modulemap PROPERTY FOLDER "Miscellaneous")