multiproduct_kati support for a custom list of products

am: b61e3f79ec

Change-Id: I2b1095c0756ea18f4949bf1ff17e25bc8858e4df
This commit is contained in:
Jeff Gaston 2017-11-16 21:12:33 +00:00 committed by android-build-merger
commit 8f11041096

View file

@ -56,6 +56,7 @@ var onlySoong = flag.Bool("only-soong", false, "Only run product config and Soon
var buildVariant = flag.String("variant", "eng", "build variant to use")
var skipProducts = flag.String("skip-products", "", "comma-separated list of products to skip (known failures, etc)")
var includeProducts = flag.String("products", "", "comma-separated list of products to build")
const errorLeadingLines = 20
const errorTrailingLines = 20
@ -158,6 +159,15 @@ func (s *Status) Finished() int {
return s.failed
}
func inList(str string, list []string) bool {
for _, other := range list {
if str == other {
return true
}
}
return false
}
func main() {
log := logger.New(os.Stderr)
defer log.Cleanup()
@ -222,7 +232,24 @@ func main() {
if err != nil {
log.Fatal(err)
}
productsList := strings.Fields(vars["all_named_products"])
var productsList []string
allProducts := strings.Fields(vars["all_named_products"])
if *includeProducts != "" {
missingProducts := []string{}
for _, product := range strings.Split(*includeProducts, ",") {
if inList(product, allProducts) {
productsList = append(productsList, product)
} else {
missingProducts = append(missingProducts, product)
}
}
if len(missingProducts) > 0 {
log.Fatalf("Products don't exist: %s\n", missingProducts)
}
} else {
productsList = allProducts
}
products := make([]string, 0, len(productsList))
skipList := strings.Split(*skipProducts, ",")