Repository navigation
[ci] Add Kokoro configuration for Android CMake cross-compilation - #2357
Conversation
This commit adds a new Dockerfile that inherits from the base CMake Dockerfile and installs Android NDK. Kokoro jobs are added to use this Docker image to test cross compilation towards Android.
GMNGeoffrey
left a comment
There was a problem hiding this comment.
To get a presubmit run of this, we need to set up a new Kokoro job. Let me do that
| set -x | ||
| set -e | ||
|
|
||
| # Ensure correct authorization. | ||
| gcloud auth configure-docker | ||
|
|
||
| # Determine which image tag to update. Updates :latest by default. | ||
| TAG="latest" | ||
| if [[ "$#" -ne 0 ]]; then | ||
| if [[ "$@" == "--update-prod" ]]; then | ||
| TAG="prod" | ||
| else | ||
| echo "Invalid commandline arguments. Accepts --update-prod or no arguments." | ||
| exit 1 | ||
| fi | ||
| fi | ||
| echo "Updating ${TAG}" | ||
|
|
||
|
|
||
| # Build and push the cmake image. | ||
| docker build --tag "gcr.io/iree-oss/cmake-android:${TAG}" build_tools/docker/cmake/ | ||
| docker push "gcr.io/iree-oss/cmake-android:${TAG}" |
There was a problem hiding this comment.
So we should probably refactor so we only need one script. This should just be:
update_gcr cmake_android
(not this PR). @phoenix-meadowlark could you take a look at that?
There was a problem hiding this comment.
Something like
./build_tools/docker/update_gcr.sh --image=bazel --update-prodWhere image ∈ {bazel, bazel-bindings, bazel-tensorflow, cmake, cmake-android, rbe} maps to a bunch of conditional statements? (Switch statements with drop through would work if we had chain dependencies, but we have bazel -> bazel-bindings and bazel -> bazel-tensorflow).
There was a problem hiding this comment.
Yes. Except per the organization point below, I think the images should be called linux/bazel/core, linux/bazel/bindings, android/cmake, etc.
Check out getopt for shell command line flag parsing.
There was a problem hiding this comment.
We should probably also rename all of our images then. E.g. gcr.io/iree-oss/linux/bazel/core and so on :)
|
So file organization question: We've been organizing things by platform/build_system/component. Like "linux/bazel/bindings". That's the format for the directory structure, build badges, etc. Implicitly "gcp_ubuntu" here is a stand-in for linux (it's what Kokoro calls the runner cluster type, so internally that directory name is load-bearing), but when cross-compiling this doesn't fit as nicely, since we're still running the build on gcp_ubuntu, just with a different toolchain. Should this be in and "android/cmake" directory instead of "cmake/android"? That feels a little silly since it has the most in common with the other cmake build, but it isn't really referencing it. We really just need a DAG filesystem :-P But having cmake/android next to cmake/core is going to be confusing I think. More generally, I kind of want to move the kokoro directory out of the top-level and into build_tools. If I'm doing that anyway, I'll have to deal with all the annoying pointers between things. Maybe we should reorganize like "cluster/platform/build_system/component": And I think the docker containers and build scripts should follow the same pattern minus the leading "cluster", since that's just a Kokoro thing. The gcr paths should be folders (slash-separated) instead of dash-separated. @phoenix-meadowlark Thoughts? The immediate question is whether this should be "android/cmake" instead of "cmake/android" |
|
Oh also should this be |
That all sounds good to me. Are there any other platforms that we could build for in |
|
I don't have a particular opinion towards this, so either way works for me. :) @GMNGeoffrey let me know when you think I should land this. It's clear on my side now. |
We could have cross-compiling on windows too. Another option is to do "cluster/build_system/target_platform/component". Actually maybe the only reason I had target platform first was because I was conflating it with Kokoro cluster type. |
Are we going to target other android CPU architectures, do you think? e.g. android_x86 or android_arm32? In that case it might be better to add the CPU architecture to the name as well. These things are kind of a pain to rename. Yet another naming option is to break cpu architecture out as a separate directory component from OS ( |
I don't think we want to target |
|
We'll need android x86/64 ASAP (even if codegen is not great) as that's the fastest way to run the emulator and what any dependent project will be using for CI testing or local emulator development. |
|
Ah good point. Sorry missed that. :) |
|
So, should I put the newly added configurations under |
Yes please put it there :-) |
Okay, there you go in 5c53b21. I put |
GMNGeoffrey
left a comment
There was a problem hiding this comment.
I've got a presubmit build set up that we can manually trigger on this PR. Currently we need to push the docker image to GCR first though.
Pushed to Edit: I also just manually triggered the presubmit since the last one was before the image was available. |
…ee-org#2357) This commit adds a new Dockerfile that inherits from the base CMake Dockerfile and installs Android NDK. Kokoro build configurations are added to use this Docker image to test cross compilation towards Android.
This moves the entire `kokoro` directory under `build_tools` and restructures the directories to consistently indicate features of the build. Some previous discussion in #2357 The structure is `kokoro_cluster/build_system/os/target_architecture[/iree_component]`. Subsequent PRs will move build scripts into these directories and make docker image and build status badges follow the same naming conventions. The old Kokoro directory structure with configs is preserved to allow the existing job configs to still find the build configs they point at. Once PRs are rebased past this commit on main, I will update the job configs to point at the new locations and then delete the old directory.
This commit adds a new Dockerfile that inherits from the base
CMake Dockerfile and installs Android NDK. Kokoro build
configurations are added to use this Docker image to test cross
compilation towards Android.