bazelbuild/rules_android

Starlark AarFileExtractor causing action bloat due to all of the transitioned outputs being included

Bencodes opened this issue · 0 comments

The Starlark rules are causing action bloat as a result of the transitioned outputs for each fat_apk_cpu for ValidateAAR and AarFileExtractor being included in the final build.

The same amount of actions are being created between the native and Starlark rules:

# Native impl:
❯ ./bazelw aquery "mnemonic('AarFileExtractor', deps(//apps/foo:bin))" | grep "Mnemonic: AarFileExtractor" | wc -l
     744
     
# Starlark impl:
➜ ./bazelw aquery "mnemonic('AarFileExtractor', deps(//apps/foo:bin))" | grep "Mnemonic: AarFileExtractor" | wc -l
     744

However the final executed actions differ where the Starlark implementation seems to be extracting and validating each AndroidManifest.xml for the provided --fat_apk_cpu=armeabi-v7a,arm64-v8a,x86,x86_64 architecture:

# Native impl:
➜ cat bazel_last_execution_log.json | grep '"mnemonic": "' | sort | uniq -c | sort -n
 182   "mnemonic": "AarEmbeddedJarsExtractor",
 182   "mnemonic": "AarEmbeddedProguardExtractor",
 182   "mnemonic": "AarFileExtractor",
 182   "mnemonic": "AarJarsMerger",
 182   "mnemonic": "AarResourcesExtractor",
 728   "mnemonic": "AarNativeLibsFilter",

# Starlark impl:
➜ cat bazel_last_execution_log.json | grep '"mnemonic": "' | sort | uniq -c | sort -n
 182   "mnemonic": "AarEmbeddedJarsExtractor",
 182   "mnemonic": "AarEmbeddedProguardExtractor",
 182   "mnemonic": "AarJarsMerger",
 182   "mnemonic": "AarResourcesExtractor",
 728   "mnemonic": "AarFileExtractor",
 728   "mnemonic": "AarNativeLibsFilter",
 728   "mnemonic": "ValidateAAR",