Allow multiple --skip-products and --products arguments to multiproduct_kati
Concatenate multiple comma separated lists passed to --skip-products and --products. Test: manual Change-Id: Ie5e9310e1ebcb9c7fa88e9c8b45fb29f64f9cce7
This commit is contained in:
parent
1a74be780b
commit
f2f3d31549
1 changed files with 25 additions and 8 deletions
|
@ -50,12 +50,30 @@ var onlySoong = flag.Bool("only-soong", false, "Only run product config and Soon
|
||||||
|
|
||||||
var buildVariant = flag.String("variant", "eng", "build variant to use")
|
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")
|
|
||||||
|
|
||||||
var shardCount = flag.Int("shard-count", 1, "split the products into multiple shards (to spread the build onto multiple machines, etc)")
|
var shardCount = flag.Int("shard-count", 1, "split the products into multiple shards (to spread the build onto multiple machines, etc)")
|
||||||
var shard = flag.Int("shard", 1, "1-indexed shard to execute")
|
var shard = flag.Int("shard", 1, "1-indexed shard to execute")
|
||||||
|
|
||||||
|
var skipProducts multipleStringArg
|
||||||
|
var includeProducts multipleStringArg
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.Var(&skipProducts, "skip-products", "comma-separated list of products to skip (known failures, etc)")
|
||||||
|
flag.Var(&includeProducts, "products", "comma-separated list of products to build")
|
||||||
|
}
|
||||||
|
|
||||||
|
// multipleStringArg is a flag.Value that takes comma separated lists and converts them to a
|
||||||
|
// []string. The argument can be passed multiple times to append more values.
|
||||||
|
type multipleStringArg []string
|
||||||
|
|
||||||
|
func (m *multipleStringArg) String() string {
|
||||||
|
return strings.Join(*m, `, `)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *multipleStringArg) Set(s string) error {
|
||||||
|
*m = append(*m, strings.Split(s, ",")...)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
const errorLeadingLines = 20
|
const errorLeadingLines = 20
|
||||||
const errorTrailingLines = 20
|
const errorTrailingLines = 20
|
||||||
|
|
||||||
|
@ -250,9 +268,9 @@ func main() {
|
||||||
var productsList []string
|
var productsList []string
|
||||||
allProducts := strings.Fields(vars["all_named_products"])
|
allProducts := strings.Fields(vars["all_named_products"])
|
||||||
|
|
||||||
if *includeProducts != "" {
|
if len(includeProducts) > 0 {
|
||||||
missingProducts := []string{}
|
var missingProducts []string
|
||||||
for _, product := range strings.Split(*includeProducts, ",") {
|
for _, product := range includeProducts {
|
||||||
if inList(product, allProducts) {
|
if inList(product, allProducts) {
|
||||||
productsList = append(productsList, product)
|
productsList = append(productsList, product)
|
||||||
} else {
|
} else {
|
||||||
|
@ -267,9 +285,8 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
finalProductsList := make([]string, 0, len(productsList))
|
finalProductsList := make([]string, 0, len(productsList))
|
||||||
skipList := strings.Split(*skipProducts, ",")
|
|
||||||
skipProduct := func(p string) bool {
|
skipProduct := func(p string) bool {
|
||||||
for _, s := range skipList {
|
for _, s := range skipProducts {
|
||||||
if p == s {
|
if p == s {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue