blob: ddfe666ce3fc6ce1c7dad5cb8f8da8ec383242be [file] [log] [blame]
Dan Willemsen1e704462016-08-21 15:17:17 -07001// Copyright 2017 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
15package build
16
17import (
Dan Willemsen1e704462016-08-21 15:17:17 -070018 "path/filepath"
19)
20
21func runSoongBootstrap(ctx Context, config Config) {
Dan Willemsend9f6fa22016-08-21 15:17:17 -070022 ctx.BeginTrace("bootstrap soong")
23 defer ctx.EndTrace()
24
Dan Willemsen269a8c72017-05-03 17:15:47 -070025 cmd := Command(ctx, config, "soong bootstrap", "./bootstrap.bash")
26 cmd.Environment.Set("BUILDDIR", config.SoongOutDir())
27 cmd.Sandbox = soongSandbox
Dan Willemsen1e704462016-08-21 15:17:17 -070028 cmd.Stdout = ctx.Stdout()
29 cmd.Stderr = ctx.Stderr()
Dan Willemsen269a8c72017-05-03 17:15:47 -070030 cmd.RunOrFatal()
Dan Willemsen1e704462016-08-21 15:17:17 -070031}
32
33func runSoong(ctx Context, config Config) {
Dan Willemsend9f6fa22016-08-21 15:17:17 -070034 ctx.BeginTrace("soong")
35 defer ctx.EndTrace()
36
Dan Willemsen269a8c72017-05-03 17:15:47 -070037 cmd := Command(ctx, config, "soong",
38 filepath.Join(config.SoongOutDir(), "soong"), "-w", "dupbuild=err")
Dan Willemsen1e704462016-08-21 15:17:17 -070039 if config.IsVerbose() {
40 cmd.Args = append(cmd.Args, "-v")
41 }
Dan Willemsen269a8c72017-05-03 17:15:47 -070042 cmd.Environment.Set("SKIP_NINJA", "true")
43 cmd.Sandbox = soongSandbox
Dan Willemsen223e3ae2017-02-06 20:55:59 -080044 cmd.Stdin = ctx.Stdin()
Dan Willemsen1e704462016-08-21 15:17:17 -070045 cmd.Stdout = ctx.Stdout()
46 cmd.Stderr = ctx.Stderr()
Dan Willemsen269a8c72017-05-03 17:15:47 -070047 cmd.RunOrFatal()
Dan Willemsen1e704462016-08-21 15:17:17 -070048}