Skip ndkApiMutator on disabled modules
Builds with no device architectures configured will disable all
device modules, don't run the mutator on them. Avoids panics
in Config.PlatformSdkVersionInt() (because the sdk version is not
set in soong.variables) and in normalizeNdkApiLevel (no arch
mutator was run on the module so arch is "").
Bug: 37315968
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: Iac124e00403eee9f2c1072788e2f51914b0112a5
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index f5499dd..8f424d8 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -216,8 +216,10 @@
func ndkApiMutator(mctx android.BottomUpMutatorContext) {
if m, ok := mctx.Module().(*Module); ok {
- if compiler, ok := m.compiler.(*stubDecorator); ok {
- generateStubApiVariants(mctx, compiler)
+ if m.Enabled() {
+ if compiler, ok := m.compiler.(*stubDecorator); ok {
+ generateStubApiVariants(mctx, compiler)
+ }
}
}
}