Add config.AndroidFirstDeviceTarget.
Targets[Android][0] is not always the first, preferred target. Add a new
field to config to provide the correct target and begin to use it.
Test: m nothing
Test: build/soong/scripts/build-ndk-prebuilts.sh
Fixes: 156980228
Change-Id: Ib56f52424ebf47f3eee6ac62b9fd9eca2919d63a
diff --git a/java/app.go b/java/app.go
index 13d08b9..13953ad 100755
--- a/java/app.go
+++ b/java/app.go
@@ -641,7 +641,7 @@
// Work with the team to come up with a new format that handles multilib modules properly
// and change this.
if len(ctx.Config().Targets[android.Android]) == 1 ||
- ctx.Config().Targets[android.Android][0].Arch.ArchType == jni.target.Arch.ArchType {
+ ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType == jni.target.Arch.ArchType {
a.jniCoverageOutputs = append(a.jniCoverageOutputs, jni.coverageFile.Path())
}
}
@@ -1392,7 +1392,7 @@
}
archProps := reflect.ValueOf(a.archVariants).Elem().FieldByName("Arch")
- archType := ctx.Config().Targets[android.Android][0].Arch.ArchType
+ archType := ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType
MergePropertiesFromVariant(ctx, &a.properties, archProps, archType.Name)
}