-
Notifications
You must be signed in to change notification settings - Fork 409
Add support for Android versions 5-11. #1023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"description": "support different Android NDK, API, and Android versions using Docker build args.", | ||
"type": "added" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# don't copy any of the python artifacts to the docker context | ||
__pycache__/ | ||
.pytest_cache/ | ||
*.py[cod] | ||
*$py.class | ||
**/*.egg-info/ | ||
*.egg | ||
.tox | ||
|
||
# also skip our test suite | ||
android/tests/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,27 +10,51 @@ RUN /cmake.sh | |
COPY xargo.sh / | ||
RUN /xargo.sh | ||
|
||
COPY qemu.sh / | ||
RUN /qemu.sh aarch64 | ||
|
||
ARG ANDROID_NDK=r25b | ||
ARG ANDROID_SDK=28 | ||
ARG ANDROID_VERSION=9.0.0_r1 | ||
ARG ANDROID_SYSTEM_NONE=0 | ||
ARG ANDROID_SYSTEM_COMPLETE=0 | ||
ARG PYTHON_TMPDIR=/tmp/android | ||
|
||
COPY validate-android-args.sh / | ||
RUN /validate-android-args.sh arm64 | ||
|
||
COPY android-ndk.sh / | ||
RUN /android-ndk.sh arm64 28 | ||
RUN /android-ndk.sh arm64 | ||
ENV PATH=$PATH:/android-ndk/bin | ||
|
||
COPY android-system.sh / | ||
RUN mkdir -p $PYTHON_TMPDIR | ||
COPY android $PYTHON_TMPDIR | ||
RUN /android-system.sh arm64 | ||
|
||
COPY qemu.sh / | ||
RUN /qemu.sh aarch64 | ||
|
||
ENV CROSS_SYSROOT=/android-ndk/sysroot | ||
RUN cp $CROSS_SYSROOT/usr/lib/aarch64-linux-android/28/libz.so /system/lib/ | ||
COPY android-symlink.sh / | ||
RUN /android-symlink.sh aarch64 aarch64-linux-android | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic for creating symlinks and also copying over files to ensure they're in the right locations has gotten more complex, so it's been moved to a dedicated script. |
||
|
||
COPY android-runner / | ||
|
||
# Libz is distributed in the android ndk, but for some unknown reason it is not | ||
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT | ||
ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ | ||
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER="/android-runner aarch64" \ | ||
AR_aarch64_linux_android=aarch64-linux-android-ar \ | ||
AS_aarch64_linux_android=aarch64-linux-android-as \ | ||
CC_aarch64_linux_android=aarch64-linux-android-gcc \ | ||
CXX_aarch64_linux_android=aarch64-linux-android-g++ \ | ||
LD_aarch64_linux_android=aarch64-linux-android-ld \ | ||
NM_aarch64_linux_android=aarch64-linux-android-nm \ | ||
OBJCOPY_aarch64_linux_android=aarch64-linux-android-objcopy \ | ||
OBJDUMP_aarch64_linux_android=aarch64-linux-android-objdump \ | ||
RANLIB_aarch64_linux_android=aarch64-linux-android-ranlib \ | ||
READELF_aarch64_linux_android=aarch64-linux-android-readelf \ | ||
SIZE_aarch64_linux_android=aarch64-linux-android-size \ | ||
STRINGS_aarch64_linux_android=aarch64-linux-android-strings \ | ||
STRIP_aarch64_linux_android=aarch64-linux-android-strip \ | ||
Emilgardis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android="--sysroot=$CROSS_SYSROOT" \ | ||
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include"/ \ | ||
RUST_TEST_THREADS=1 \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to ensure any Python bytecode, eggs, distribution data, or anything else isn't copied over, as well as the test suite, since we need to copy over an entire Python module and run it in separate steps, so we want to minimize the image size.