Skip to content

Commit

Permalink
android: add a SwiftAndroidNDK.h header for the Android module
Browse files Browse the repository at this point in the history
  • Loading branch information
hyp committed Mar 15, 2024
1 parent 0bf9207 commit 1050e59
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/ClangImporter/ClangIncludePaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ ClangInvocationFileMapping swift::getClangInvocationFileMapping(
// Android uses the android-specific module map that overlays the NDK.
// FIXME: Drop Glibc mapping for android as well.
result.redirectedFiles.append(
getLibcFileMapping(ctx, "android.modulemap", std::nullopt, vfs));
getLibcFileMapping(ctx, "android.modulemap",
StringRef("SwiftAndroidNDK.h"), vfs));
}
// Both libc module maps have the C standard library headers all together in a
// SwiftLibc module. That leads to module cycles with the clang _Builtin_
Expand Down
6 changes: 5 additions & 1 deletion stdlib/public/Platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ foreach(sdk ${SWIFT_SDKS})
"android.modulemap"
DESTINATION "lib/swift/${arch_subdir}"
COMPONENT sdk-overlay)
swift_install_in_component(FILES
"SwiftAndroidNDK.h"
DESTINATION "lib/swift/${arch_subdir}"
COMPONENT sdk-overlay)
endif()

if(SWIFT_BUILD_STATIC_STDLIB)
Expand Down Expand Up @@ -353,4 +357,4 @@ if(WINDOWS IN_LIST SWIFT_SDKS)
winsdk.modulemap
DESTINATION "share"
COMPONENT sdk-overlay)
endif()
endif()
89 changes: 89 additions & 0 deletions stdlib/public/Platform/SwiftAndroidNDK.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#ifndef SWIFT_ANDROID_NDK_MODULE
#define SWIFT_ANDROID_NDK_MODULE

#include "complex.h"
#include "ctype.h"
#include "errno.h"
#include "fenv.h"
#include "inttypes.h"
#include "limits.h"
#include "locale.h"
#include "malloc.h"
#include "math.h"
#include "pty.h"
#include "setjmp.h"
#include "signal.h"
#include "stdatomic.h"
#include "stdint.h"
#include "stdio.h"
#include "stdio_ext.h"
#include "stdlib.h"
#include "string.h"
#include "time.h"
#include "utmp.h"

#include "alloca.h"
#include "ar.h"
#include "cpio.h"
#include "dirent.h"
#include "dlfcn.h"
#include "err.h"
#include "errno.h"
#include "execinfo.h"
#include "fcntl.h"
#include "fenv.h"
#include "fnmatch.h"
#include "fts.h"
#include "ftw.h"
#include "getopt.h"
#include "glob.h"
#include "grp.h"
#include "iconv.h"
#include "ifaddrs.h"
#include "jni.h"
#include "langinfo.h"
#include "libgen.h"
#include "link.h"
#include "mntent.h"
#include "netdb.h"
#include "nl_types.h"
#include "paths.h"
#include "poll.h"
#include "pthread.h"
#include "pwd.h"
#include "regex.h"
#include "resolv.h"
#include "sched.h"
#include "search.h"
#include "semaphore.h"
#include "spawn.h"
#include "strings.h"
#include "syscall.h"
#include "sysexits.h"
#include "syslog.h"
#include "tar.h"
#include "termio.h"
#include "termios.h"
#include "threads.h"
#include "uchar.h"
#include "uconfig_local.h"
#include "ucontext.h"
#include "unistd.h"
#include "utime.h"
#include "utmp.h"
#include "utmpx.h"
#include "wait.h"
#include "wchar.h"
#include "xlocale.h"

#include "android/api-level.h"
#include "android/asset_manager_jni.h"
#include "android/asset_manager.h"
#include "android/ndk-version.h"
#include "android/log.h"
#include "android/trace.h"
#include "android/versioning.h"

#include "zlib.h"

#endif // SWIFT_ANDROID_NDK_MODULE

0 comments on commit 1050e59

Please sign in to comment.