multiproduct_kati support for a custom list of products

Test: multiproduct_kati --products="aosp_arm,aosp_arm64"
Bug: 67478260
Change-Id: Icf7b8b0c30a2dc8e093ab109172675ff74f43adc
This commit is contained in:
Jeff Gaston 2017-10-25 15:02:45 -07:00
parent 20823f95e6
commit b61e3f79ec
1 changed files with 28 additions and 1 deletions

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, ",")