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 bootstrap 16 17 var ( 18 // These variables are the only configuration needed by the boostrap 19 // modules. They are always set to the variable name enclosed in "@@" so 20 // that their values can be easily replaced in the generated Ninja file. 21 srcDir = pctx.StaticVariable("srcDir", "@@SrcDir@@") 22 buildDir = pctx.StaticVariable("buildDir", "@@BuildDir@@") 23 goRoot = pctx.StaticVariable("goRoot", "@@GoRoot@@") 24 compileCmd = pctx.StaticVariable("compileCmd", "@@GoCompile@@") 25 linkCmd = pctx.StaticVariable("linkCmd", "@@GoLink@@") 26 bootstrapCmd = pctx.StaticVariable("bootstrapCmd", "@@Bootstrap@@") 27 bootstrapManifest = pctx.StaticVariable("bootstrapManifest", 28 "@@BootstrapManifest@@") 29 ) 30 31 type ConfigInterface interface { 32 // GeneratingBootstrapper should return true if this build invocation is 33 // creating a build.ninja.in file to be used in a build bootstrapping 34 // sequence. 35 GeneratingBootstrapper() bool 36 // GeneratingPrimaryBuilder should return true if this build invocation is 37 // creating a build.ninja.in file to be used to build the primary builder 38 GeneratingPrimaryBuilder() bool 39 } 40 41 type ConfigRemoveAbandonedFiles interface { 42 // RemoveAbandonedFiles should return true if files listed in the 43 // .ninja_log but not the output build.ninja file should be deleted. 44 RemoveAbandonedFiles() bool 45 } 46 47 type Stage int 48 49 const ( 50 StageBootstrap Stage = iota 51 StagePrimary 52 StageMain 53 ) 54 55 type Config struct { 56 stage Stage 57 58 topLevelBlueprintsFile string 59 60 runGoTests bool 61 } 62