Add sdk_genrule
Some users want to repackage the results of an sdk module.
Genrules have 3 variants: linux, android, and common_os. The common_os
one produces a snapshot zip file that users want. In order to get
access to it, we need a genrule in the same variant, so create
an sdk_genrule for that.
The sdk_genrule shouldn't have linux/android variants either, because
those other variants would get errors when trying to depend on the
sdk modules because the snapshot zip doesn't exist in those other
variants. The code in arch.go needs to be tweaked to allow a common_os
variant without the other variants.
Bug: 315962165
Test: m dist out/dist/art_release.zip
Change-Id: Idc9b3cae7a525d71aed6bafa0f8724a89f75a94b
diff --git a/android/arch.go b/android/arch.go
index 7436660..c39db02 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -446,8 +446,10 @@
}
}
+ createCommonOSVariant := base.commonProperties.CreateCommonOSVariant
+
// If there are no supported OSes then disable the module.
- if len(moduleOSList) == 0 {
+ if len(moduleOSList) == 0 && !createCommonOSVariant {
base.Disable()
return
}
@@ -458,7 +460,6 @@
osNames[i] = os.String()
}
- createCommonOSVariant := base.commonProperties.CreateCommonOSVariant
if createCommonOSVariant {
// A CommonOS variant was requested so add it to the list of OS variants to
// create. It needs to be added to the end because it needs to depend on the