[bazel] Android build: Remove hard dependency on a GPU backend.
Today, building e.g. //tests:codec_tests for Android without a GPU backend fails. Example:
$ bazel build //tests:codec_tests --config=for_android_arm64_with_rbe
...
ERROR: /usr/local/google/home/lovisolo/skia/BUILD.bazel:50:16: Compiling src/image/SkImage_AndroidFactories.cpp failed: (Exit 1): clang.sh failed: error executing command toolchain/android_trampolines/clang.sh -gcc-toolchain external/ndk_linux_amd64/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -target aarch64-none-linux-android -fpic -isystem ... (remaining 212 arguments skipped)
In file included from src/image/SkImage_AndroidFactories.cpp:12:
./include/android/SkImageAndroid.h:13:10: fatal error: 'include/gpu/GrTypes.h' file not found
#include "include/gpu/GrTypes.h"
^~~~~~~~~~~~~~~~~~~~~~~
If I comment out the "include/gpu/GrTypes.h" import from SkImageAndroid.h and try again, I get the following errors:
$ bazel build //tests:codec_tests --config=for_android_arm64_with_rbe
...
ERROR: /usr/local/google/home/lovisolo/skia/BUILD.bazel:50:16: Compiling src/image/SkImage_AndroidFactories.cpp failed: (Exit 1): clang.sh failed: error executing command toolchain/android_trampolines/clang.sh -gcc-toolchain external/ndk_linux_amd64/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -target aarch64-none-linux-android -fpic -isystem ... (remaining 212 arguments skipped)
In file included from src/image/SkImage_AndroidFactories.cpp:12:
./include/android/SkImageAndroid.h:36:9: error: unknown type name 'GrSurfaceOrigin'
GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
^
./include/android/SkImageAndroid.h:36:41: error: use of undeclared identifier 'kTopLeft_GrSurfaceOrigin'
GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
^
./include/android/SkImageAndroid.h:51:9: error: unknown type name 'GrSurfaceOrigin'
GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
^
./include/android/SkImageAndroid.h:51:41: error: use of undeclared identifier 'kTopLeft_GrSurfaceOrigin'
GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
^
src/image/SkImage_AndroidFactories.cpp:25:10: fatal error: 'include/gpu/GpuTypes.h' file not found
#include "include/gpu/GpuTypes.h"
^~~~~~~~~~~~~~~~~~~~~~~~
File SkImage_AndroidFactories.cpp seems to always require a GPU backend: https://skia.googlesource.com/skia/+/da9f6bcaf45bf2b191e13106cb00a850803258be/src/image/SkImage_AndroidFactories.cpp.
This CL excludes source and header files related to SkImage that require a GPU backend when no GPU backend is specified.
I tested this CL by building the following targets with --config=for_android_arm64_with_rbe:
- //tests:codec_tests
- //tests:cpu_only_tests
- //tests:discardable_memory_tests
- //tests:debugger_tests
- //tests:pathops_tests
- //tests:pdf_tests
Bug: skia:14227
Change-Id: If6c1f0490c26f64702863c028f067a08c5fbcf52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/696637
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
2 files changed