github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/blueprint/bootstrap/minibp/main.go (about) 1 // Copyright 2014 Google Inc. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package main 16 17 import ( 18 "flag" 19 "path/filepath" 20 21 "github.com/google/blueprint" 22 "github.com/google/blueprint/bootstrap" 23 ) 24 25 var runAsPrimaryBuilder bool 26 var buildPrimaryBuilder bool 27 28 func init() { 29 flag.BoolVar(&runAsPrimaryBuilder, "p", false, "run as a primary builder") 30 } 31 32 type Config struct { 33 generatingPrimaryBuilder bool 34 } 35 36 func (c Config) GeneratingPrimaryBuilder() bool { 37 return c.generatingPrimaryBuilder 38 } 39 40 func (c Config) RemoveAbandonedFilesUnder() []string { 41 return []string{filepath.Join(bootstrap.BuildDir, ".bootstrap")} 42 } 43 44 func main() { 45 flag.Parse() 46 47 ctx := blueprint.NewContext() 48 if !runAsPrimaryBuilder { 49 ctx.SetIgnoreUnknownModuleTypes(true) 50 } 51 52 config := Config{ 53 generatingPrimaryBuilder: !runAsPrimaryBuilder, 54 } 55 56 bootstrap.Main(ctx, config) 57 }