blob: 2af3616b1ed00efa1e47bfec432e148fbf8a491d [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())
Dan Willemsen05f17762017-07-24 15:58:20 -070027 cmd.Environment.Set("NINJA_BUILDDIR", config.OutDir())
Dan Willemsene0879fc2017-08-04 15:06:27 -070028 cmd.Environment.Set("NO_DEPRECATION_WARNING", "true")
Dan Willemsen269a8c72017-05-03 17:15:47 -070029 cmd.Sandbox = soongSandbox
Dan Willemsen1e704462016-08-21 15:17:17 -070030 cmd.Stdout = ctx.Stdout()
31 cmd.Stderr = ctx.Stderr()
Dan Willemsen269a8c72017-05-03 17:15:47 -070032 cmd.RunOrFatal()
Dan Willemsen1e704462016-08-21 15:17:17 -070033}
34
35func runSoong(ctx Context, config Config) {
Dan Willemsend9f6fa22016-08-21 15:17:17 -070036 ctx.BeginTrace("soong")
37 defer ctx.EndTrace()
38
Dan Willemsen269a8c72017-05-03 17:15:47 -070039 cmd := Command(ctx, config, "soong",
40 filepath.Join(config.SoongOutDir(), "soong"), "-w", "dupbuild=err")
Dan Willemsen1e704462016-08-21 15:17:17 -070041 if config.IsVerbose() {
42 cmd.Args = append(cmd.Args, "-v")
43 }
Dan Willemsen269a8c72017-05-03 17:15:47 -070044 cmd.Environment.Set("SKIP_NINJA", "true")
Dan Willemsene0879fc2017-08-04 15:06:27 -070045 cmd.Environment.Set("NO_DEPRECATION_WARNING", "true")
Dan Willemsen269a8c72017-05-03 17:15:47 -070046 cmd.Sandbox = soongSandbox
Dan Willemsen223e3ae2017-02-06 20:55:59 -080047 cmd.Stdin = ctx.Stdin()
Dan Willemsen1e704462016-08-21 15:17:17 -070048 cmd.Stdout = ctx.Stdout()
49 cmd.Stderr = ctx.Stderr()
Dan Willemsen269a8c72017-05-03 17:15:47 -070050 cmd.RunOrFatal()
Dan Willemsen1e704462016-08-21 15:17:17 -070051}