Merge "Rename BuildDir and NinjaBuildDir."

This commit is contained in:
Lukács T. Berki 2021-08-27 13:39:11 +00:00 committed by Gerrit Code Review
commit 5602d33025
18 changed files with 91 additions and 91 deletions

View file

@ -106,7 +106,7 @@ type bazelPaths struct {
bazelPath string
outputBase string
workspaceDir string
buildDir string
soongOutDir string
metricsDir string
}
@ -254,7 +254,7 @@ func NewBazelContext(c *config) (BazelContext, error) {
func bazelPathsFromConfig(c *config) (*bazelPaths, error) {
p := bazelPaths{
buildDir: c.buildDir,
soongOutDir: c.soongOutDir,
}
missingEnvVars := []string{}
if len(c.Getenv("BAZEL_HOME")) > 1 {
@ -382,7 +382,7 @@ func (r *builtinBazelRunner) issueBazelCommand(paths *bazelPaths, runName bazel.
bazelCmd.Env = append(os.Environ(),
"HOME="+paths.homeDir,
pwdPrefix(),
"BUILD_DIR="+absolutePath(paths.buildDir),
"BUILD_DIR="+absolutePath(paths.soongOutDir),
// Make OUT_DIR absolute here so tools/bazel.sh uses the correct
// OUT_DIR at <root>/out, instead of <root>/out/soong/workspace/out.
"OUT_DIR="+absolutePath(paths.outDir()),
@ -599,24 +599,24 @@ def format(target):
// Returns a path containing build-related metadata required for interfacing
// with Bazel. Example: out/soong/bazel.
func (p *bazelPaths) intermediatesDir() string {
return filepath.Join(p.buildDir, "bazel")
return filepath.Join(p.soongOutDir, "bazel")
}
// Returns the path where the contents of the @soong_injection repository live.
// It is used by Soong to tell Bazel things it cannot over the command line.
func (p *bazelPaths) injectedFilesDir() string {
return filepath.Join(p.buildDir, bazel.SoongInjectionDirName)
return filepath.Join(p.soongOutDir, bazel.SoongInjectionDirName)
}
// Returns the path of the synthetic Bazel workspace that contains a symlink
// forest composed the whole source tree and BUILD files generated by bp2build.
func (p *bazelPaths) syntheticWorkspaceDir() string {
return filepath.Join(p.buildDir, "workspace")
return filepath.Join(p.soongOutDir, "workspace")
}
// Returns the path to the top level out dir ($OUT_DIR).
func (p *bazelPaths) outDir() string {
return filepath.Dir(p.buildDir)
return filepath.Dir(p.soongOutDir)
}
// Issues commands to Bazel to receive results for all cquery requests

View file

@ -101,7 +101,7 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
func testBazelContext(t *testing.T, bazelCommandResults map[bazelCommand]string) (*bazelContext, string) {
t.Helper()
p := bazelPaths{
buildDir: t.TempDir(),
soongOutDir: t.TempDir(),
outputBase: "outputbase",
workspaceDir: "workspace_dir",
}
@ -114,5 +114,5 @@ func testBazelContext(t *testing.T, bazelCommandResults map[bazelCommand]string)
bazelRunner: runner,
paths: &p,
requests: map[cqueryKey]bool{},
}, p.buildDir
}, p.soongOutDir
}

View file

@ -414,7 +414,7 @@ func PathForBazelOut(ctx PathContext, paths ...string) BazelOutPath {
}
outputPath := OutputPath{basePath{"", ""},
ctx.Config().buildDir,
ctx.Config().soongOutDir,
ctx.Config().BazelContext.OutputBase()}
return BazelOutPath{

View file

@ -67,12 +67,12 @@ type Config struct {
}
// BuildDir returns the build output directory for the configuration.
func (c Config) BuildDir() string {
return c.buildDir
func (c Config) SoongOutDir() string {
return c.soongOutDir
}
func (c Config) NinjaBuildDir() string {
return c.buildDir
func (c Config) OutDir() string {
return c.soongOutDir
}
func (c Config) DebugCompilation() bool {
@ -122,7 +122,7 @@ type config struct {
deviceConfig *deviceConfig
buildDir string // the path of the build output directory
soongOutDir string // the path of the build output directory
moduleListFile string // the path to the file which lists blueprint files to parse.
env map[string]string
@ -283,11 +283,11 @@ func saveToBazelConfigFile(config *productVariables, outDir string) error {
// NullConfig returns a mostly empty Config for use by standalone tools like dexpreopt_gen that
// use the android package.
func NullConfig(buildDir string) Config {
func NullConfig(soongOutDir string) Config {
return Config{
config: &config{
buildDir: buildDir,
fs: pathtools.OsFs,
soongOutDir: soongOutDir,
fs: pathtools.OsFs,
},
}
}
@ -319,7 +319,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
ShippingApiLevel: stringPtr("30"),
},
buildDir: buildDir,
soongOutDir: buildDir,
captureBuild: true,
env: envCopy,
@ -397,7 +397,7 @@ func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[st
// multiple runs in the same program execution is carried over (such as Bazel
// context or environment deps).
func ConfigForAdditionalRun(c Config) (Config, error) {
newConfig, err := NewConfig(c.buildDir, c.moduleListFile, c.env)
newConfig, err := NewConfig(c.soongOutDir, c.moduleListFile, c.env)
if err != nil {
return Config{}, err
}
@ -408,14 +408,14 @@ func ConfigForAdditionalRun(c Config) (Config, error) {
// NewConfig creates a new Config object. The srcDir argument specifies the path
// to the root source directory. It also loads the config file, if found.
func NewConfig(buildDir string, moduleListFile string, availableEnv map[string]string) (Config, error) {
func NewConfig(soongOutDir string, moduleListFile string, availableEnv map[string]string) (Config, error) {
// Make a config with default options.
config := &config{
ProductVariablesFileName: filepath.Join(buildDir, productVariablesFileName),
ProductVariablesFileName: filepath.Join(soongOutDir, productVariablesFileName),
env: availableEnv,
buildDir: buildDir,
soongOutDir: soongOutDir,
multilibConflicts: make(map[ArchType]bool),
moduleListFile: moduleListFile,
@ -428,7 +428,7 @@ func NewConfig(buildDir string, moduleListFile string, availableEnv map[string]s
// Soundness check of the build and source directories. This won't catch strange
// configurations with symlinks, but at least checks the obvious case.
absBuildDir, err := filepath.Abs(buildDir)
absBuildDir, err := filepath.Abs(soongOutDir)
if err != nil {
return Config{}, err
}
@ -448,7 +448,7 @@ func NewConfig(buildDir string, moduleListFile string, availableEnv map[string]s
return Config{}, err
}
KatiEnabledMarkerFile := filepath.Join(buildDir, ".soong.kati_enabled")
KatiEnabledMarkerFile := filepath.Join(soongOutDir, ".soong.kati_enabled")
if _, err := os.Stat(absolutePath(KatiEnabledMarkerFile)); err == nil {
config.katiEnabled = true
}
@ -556,7 +556,7 @@ var _ bootstrap.ConfigStopBefore = (*config)(nil)
// BlueprintToolLocation returns the directory containing build system tools
// from Blueprint, like soong_zip and merge_zips.
func (c *config) BlueprintToolLocation() string {
return filepath.Join(c.buildDir, "host", c.PrebuiltOS(), "bin")
return filepath.Join(c.soongOutDir, "host", c.PrebuiltOS(), "bin")
}
var _ bootstrap.ConfigBlueprintToolLocation = (*config)(nil)

View file

@ -834,7 +834,7 @@ func (f *fixture) outputDebugState() {
func (r *TestResult) NormalizePathForTesting(path Path) string {
pathContext := PathContextForTesting(r.Config)
pathAsString := path.String()
if rel, isRel := MaybeRel(pathContext, r.Config.BuildDir(), pathAsString); isRel {
if rel, isRel := MaybeRel(pathContext, r.Config.SoongOutDir(), pathAsString); isRel {
return rel
}
return pathAsString

View file

@ -186,13 +186,13 @@ type Path interface {
// A standard build has the following structure:
// ../top/
// out/ - make install files go here.
// out/soong - this is the buildDir passed to NewTestConfig()
// out/soong - this is the soongOutDir passed to NewTestConfig()
// ... - the source files
//
// This function converts a path so that it appears relative to the ../top/ directory, i.e.
// * Make install paths, which have the pattern "buildDir/../<path>" are converted into the top
// * Make install paths, which have the pattern "soongOutDir/../<path>" are converted into the top
// relative path "out/<path>"
// * Soong install paths and other writable paths, which have the pattern "buildDir/<path>" are
// * Soong install paths and other writable paths, which have the pattern "soongOutDir/<path>" are
// converted into the top relative path "out/soong/<path>".
// * Source paths are already relative to the top.
// * Phony paths are not relative to anything.
@ -211,7 +211,7 @@ type WritablePath interface {
Path
// return the path to the build directory.
getBuildDir() string
getSoongOutDir() string
// the writablePath method doesn't directly do anything,
// but it allows a struct to distinguish between whether or not it implements the WritablePath interface
@ -992,7 +992,7 @@ func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, e
}
// absolute path already checked by validateSafePath
if strings.HasPrefix(ret.String(), ctx.Config().buildDir) {
if strings.HasPrefix(ret.String(), ctx.Config().soongOutDir) {
return ret, fmt.Errorf("source path %q is in output", ret.String())
}
@ -1008,7 +1008,7 @@ func pathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error
}
// absolute path already checked by validatePath
if strings.HasPrefix(ret.String(), ctx.Config().buildDir) {
if strings.HasPrefix(ret.String(), ctx.Config().soongOutDir) {
return ret, fmt.Errorf("source path %q is in output", ret.String())
}
@ -1151,7 +1151,7 @@ type OutputPath struct {
basePath
// The soong build directory, i.e. Config.BuildDir()
buildDir string
soongOutDir string
fullPath string
}
@ -1167,8 +1167,8 @@ func (p OutputPath) WithoutRel() OutputPath {
return p
}
func (p OutputPath) getBuildDir() string {
return p.buildDir
func (p OutputPath) getSoongOutDir() string {
return p.soongOutDir
}
func (p OutputPath) RelativeToTop() Path {
@ -1176,8 +1176,8 @@ func (p OutputPath) RelativeToTop() Path {
}
func (p OutputPath) outputPathRelativeToTop() OutputPath {
p.fullPath = StringPathRelativeToTop(p.buildDir, p.fullPath)
p.buildDir = OutSoongDir
p.fullPath = StringPathRelativeToTop(p.soongOutDir, p.fullPath)
p.soongOutDir = OutSoongDir
return p
}
@ -1218,12 +1218,12 @@ func PathForOutput(ctx PathContext, pathComponents ...string) OutputPath {
if err != nil {
reportPathError(ctx, err)
}
fullPath := filepath.Join(ctx.Config().buildDir, path)
fullPath := filepath.Join(ctx.Config().soongOutDir, path)
path = fullPath[len(fullPath)-len(path):]
return OutputPath{basePath{path, ""}, ctx.Config().buildDir, fullPath}
return OutputPath{basePath{path, ""}, ctx.Config().soongOutDir, fullPath}
}
// PathsForOutput returns Paths rooted from buildDir
// PathsForOutput returns Paths rooted from soongOutDir
func PathsForOutput(ctx PathContext, paths []string) WritablePaths {
ret := make(WritablePaths, len(paths))
for i, path := range paths {
@ -1545,7 +1545,7 @@ type InstallPath struct {
basePath
// The soong build directory, i.e. Config.BuildDir()
buildDir string
soongOutDir string
// partitionDir is the part of the InstallPath that is automatically determined according to the context.
// For example, it is host/<os>-<arch> for host modules, and target/product/<device>/<partition> for device modules.
@ -1565,12 +1565,12 @@ func ensureTestOnly() {
func (p InstallPath) RelativeToTop() Path {
ensureTestOnly()
p.buildDir = OutSoongDir
p.soongOutDir = OutSoongDir
return p
}
func (p InstallPath) getBuildDir() string {
return p.buildDir
func (p InstallPath) getSoongOutDir() string {
return p.soongOutDir
}
func (p InstallPath) ReplaceExtension(ctx PathContext, ext string) OutputPath {
@ -1585,9 +1585,9 @@ func (p InstallPath) writablePath() {}
func (p InstallPath) String() string {
if p.makePath {
// Make path starts with out/ instead of out/soong.
return filepath.Join(p.buildDir, "../", p.path)
return filepath.Join(p.soongOutDir, "../", p.path)
} else {
return filepath.Join(p.buildDir, p.path)
return filepath.Join(p.soongOutDir, p.path)
}
}
@ -1596,9 +1596,9 @@ func (p InstallPath) String() string {
// The ./soong is dropped if the install path is for Make.
func (p InstallPath) PartitionDir() string {
if p.makePath {
return filepath.Join(p.buildDir, "../", p.partitionDir)
return filepath.Join(p.soongOutDir, "../", p.partitionDir)
} else {
return filepath.Join(p.buildDir, p.partitionDir)
return filepath.Join(p.soongOutDir, p.partitionDir)
}
}
@ -1694,7 +1694,7 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string,
base := InstallPath{
basePath: basePath{partionPath, ""},
buildDir: ctx.Config().buildDir,
soongOutDir: ctx.Config().soongOutDir,
partitionDir: partionPath,
makePath: false,
}
@ -1705,7 +1705,7 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string,
func pathForNdkOrSdkInstall(ctx PathContext, prefix string, paths []string) InstallPath {
base := InstallPath{
basePath: basePath{prefix, ""},
buildDir: ctx.Config().buildDir,
soongOutDir: ctx.Config().soongOutDir,
partitionDir: prefix,
makePath: false,
}
@ -1851,7 +1851,7 @@ type PhonyPath struct {
func (p PhonyPath) writablePath() {}
func (p PhonyPath) getBuildDir() string {
func (p PhonyPath) getSoongOutDir() string {
// A phone path cannot contain any / so cannot be relative to the build directory.
return ""
}

View file

@ -54,10 +54,10 @@ type SingletonContext interface {
RequireNinjaVersion(major, minor, micro int)
// SetNinjaBuildDir sets the value of the top-level "builddir" Ninja variable
// SetOutDir sets the value of the top-level "builddir" Ninja variable
// that controls where Ninja stores its build log files. This value can be
// set at most one time for a single build, later calls are ignored.
SetNinjaBuildDir(pctx PackageContext, value string)
SetOutDir(pctx PackageContext, value string)
// Eval takes a string with embedded ninja variables, and returns a string
// with all of the variables recursively expanded. Any variables references
@ -180,8 +180,8 @@ func (s *singletonContextAdaptor) Phony(name string, deps ...Path) {
addPhony(s.Config(), name, deps...)
}
func (s *singletonContextAdaptor) SetNinjaBuildDir(pctx PackageContext, value string) {
s.SingletonContext.SetNinjaBuildDir(pctx.PackageContext, value)
func (s *singletonContextAdaptor) SetOutDir(pctx PackageContext, value string) {
s.SingletonContext.SetOutDir(pctx.PackageContext, value)
}
func (s *singletonContextAdaptor) Eval(pctx PackageContext, ninjaStr string) (string, error) {

View file

@ -77,14 +77,14 @@ func AssertPathsRelativeToTopEquals(t *testing.T, message string, expected []str
// StringPathRelativeToTop on the actual string path.
func AssertStringPathRelativeToTopEquals(t *testing.T, message string, config Config, expected string, actual string) {
t.Helper()
AssertStringEquals(t, message, expected, StringPathRelativeToTop(config.buildDir, actual))
AssertStringEquals(t, message, expected, StringPathRelativeToTop(config.soongOutDir, actual))
}
// AssertStringPathsRelativeToTopEquals checks if the expected value is equal to the result of
// calling StringPathsRelativeToTop on the actual string paths.
func AssertStringPathsRelativeToTopEquals(t *testing.T, message string, config Config, expected []string, actual []string) {
t.Helper()
AssertDeepEquals(t, message, expected, StringPathsRelativeToTop(config.buildDir, actual))
AssertDeepEquals(t, message, expected, StringPathsRelativeToTop(config.soongOutDir, actual))
}
// AssertErrorMessageEquals checks if the error is not nil and has the expected message. If it does

View file

@ -664,15 +664,15 @@ func newBaseTestingComponent(config Config, provider testBuildProvider) baseTest
// containing at most one instance of the temporary build directory at the start of the path while
// this assumes that there can be any number at any position.
func normalizeStringRelativeToTop(config Config, s string) string {
// The buildDir usually looks something like: /tmp/testFoo2345/001
// The soongOutDir usually looks something like: /tmp/testFoo2345/001
//
// Replace any usage of the buildDir with out/soong, e.g. replace "/tmp/testFoo2345/001" with
// Replace any usage of the soongOutDir with out/soong, e.g. replace "/tmp/testFoo2345/001" with
// "out/soong".
outSoongDir := filepath.Clean(config.buildDir)
outSoongDir := filepath.Clean(config.soongOutDir)
re := regexp.MustCompile(`\Q` + outSoongDir + `\E\b`)
s = re.ReplaceAllString(s, "out/soong")
// Replace any usage of the buildDir/.. with out, e.g. replace "/tmp/testFoo2345" with
// Replace any usage of the soongOutDir/.. with out, e.g. replace "/tmp/testFoo2345" with
// "out". This must come after the previous replacement otherwise this would replace
// "/tmp/testFoo2345/001" with "out/001" instead of "out/soong".
outDir := filepath.Dir(outSoongDir)
@ -991,7 +991,7 @@ func NormalizePathForTesting(path Path) string {
}
p := path.String()
if w, ok := path.(WritablePath); ok {
rel, err := filepath.Rel(w.getBuildDir(), p)
rel, err := filepath.Rel(w.getSoongOutDir(), p)
if err != nil {
panic(err)
}

View file

@ -34,12 +34,12 @@ func DocsSingleton() Singleton {
type docsSingleton struct{}
func primaryBuilderPath(ctx SingletonContext) Path {
buildDir := absolutePath(ctx.Config().BuildDir())
soongOutDir := absolutePath(ctx.Config().SoongOutDir())
binary := absolutePath(os.Args[0])
primaryBuilder, err := filepath.Rel(buildDir, binary)
primaryBuilder, err := filepath.Rel(soongOutDir, binary)
if err != nil {
ctx.Errorf("path to primary builder %q is not in build dir %q (%q)",
os.Args[0], ctx.Config().BuildDir(), err)
os.Args[0], ctx.Config().SoongOutDir(), err)
}
return PathForOutput(ctx, primaryBuilder)

View file

@ -4930,7 +4930,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
}
}
if !foundLibfooJar {
t.Errorf("Rule for libfoo.jar missing in dex_bootjars singleton outputs %q", android.StringPathsRelativeToTop(ctx.Config().BuildDir(), s.AllOutputs()))
t.Errorf("Rule for libfoo.jar missing in dex_bootjars singleton outputs %q", android.StringPathsRelativeToTop(ctx.Config().SoongOutDir(), s.AllOutputs()))
}
}

View file

@ -146,7 +146,7 @@ func runMixedModeBuild(configuration android.Config, firstCtx *android.Context,
ninjaDeps := bootstrap.RunBlueprint(secondArgs, secondCtx.Context, secondConfig)
ninjaDeps = append(ninjaDeps, extraNinjaDeps...)
globListFiles := writeBuildGlobsNinjaFile(secondCtx.SrcDir(), configuration.BuildDir(), secondCtx.Globs, configuration)
globListFiles := writeBuildGlobsNinjaFile(secondCtx.SrcDir(), configuration.SoongOutDir(), secondCtx.Globs, configuration)
ninjaDeps = append(ninjaDeps, globListFiles...)
err = deptools.WriteDepFile(shared.JoinPath(topDir, secondArgs.DepFile), secondArgs.OutFile, ninjaDeps)
@ -177,7 +177,7 @@ func runSoongDocs(configuration android.Config) {
}
func writeMetrics(configuration android.Config) {
metricsFile := filepath.Join(configuration.BuildDir(), "soong_build_metrics.pb")
metricsFile := filepath.Join(configuration.SoongOutDir(), "soong_build_metrics.pb")
err := android.WriteMetrics(configuration, metricsFile)
if err != nil {
fmt.Fprintf(os.Stderr, "error writing soong_build metrics %s: %s", metricsFile, err)
@ -194,7 +194,7 @@ func writeJsonModuleGraph(configuration android.Config, ctx *android.Context, pa
defer f.Close()
ctx.Context.PrintJSONGraph(f)
writeFakeNinjaFile(extraNinjaDeps, configuration.BuildDir())
writeFakeNinjaFile(extraNinjaDeps, configuration.SoongOutDir())
}
func writeBuildGlobsNinjaFile(srcDir, buildDir string, globs func() pathtools.MultipleGlobResults, config interface{}) []string {
@ -233,7 +233,7 @@ func doChosenActivity(configuration android.Config, extraNinjaDeps []string) str
ninjaDeps := bootstrap.RunBlueprint(blueprintArgs, ctx.Context, configuration)
ninjaDeps = append(ninjaDeps, extraNinjaDeps...)
globListFiles := writeBuildGlobsNinjaFile(ctx.SrcDir(), configuration.BuildDir(), ctx.Globs, configuration)
globListFiles := writeBuildGlobsNinjaFile(ctx.SrcDir(), configuration.SoongOutDir(), ctx.Globs, configuration)
ninjaDeps = append(ninjaDeps, globListFiles...)
err := deptools.WriteDepFile(shared.JoinPath(topDir, blueprintArgs.DepFile), blueprintArgs.OutFile, ninjaDeps)
@ -307,7 +307,7 @@ func main() {
if shared.IsDebugging() {
// Add a non-existent file to the dependencies so that soong_build will rerun when the debugger is
// enabled even if it completed successfully.
extraNinjaDeps = append(extraNinjaDeps, filepath.Join(configuration.BuildDir(), "always_rerun_for_delve"))
extraNinjaDeps = append(extraNinjaDeps, filepath.Join(configuration.SoongOutDir(), "always_rerun_for_delve"))
}
if docFile != "" {
@ -356,12 +356,12 @@ func writeUsedEnvironmentFile(configuration android.Config, finalOutputFile stri
// These files are: build.ninja and build.ninja.d. Since Kati hasn't been
// ran as well, and `nothing` is defined in a .mk file, there isn't a ninja
// target called `nothing`, so we manually create it here.
func writeFakeNinjaFile(extraNinjaDeps []string, buildDir string) {
func writeFakeNinjaFile(extraNinjaDeps []string, soongOutDir string) {
extraNinjaDepsString := strings.Join(extraNinjaDeps, " \\\n ")
ninjaFileName := "build.ninja"
ninjaFile := shared.JoinPath(topDir, buildDir, ninjaFileName)
ninjaFileD := shared.JoinPath(topDir, buildDir, ninjaFileName+".d")
ninjaFile := shared.JoinPath(topDir, soongOutDir, ninjaFileName)
ninjaFileD := shared.JoinPath(topDir, soongOutDir, ninjaFileName+".d")
// A workaround to create the 'nothing' ninja target so `m nothing` works,
// since bp2build runs without Kati, and the 'nothing' target is declared in
// a Makefile.
@ -505,7 +505,7 @@ func runBp2Build(configuration android.Config, extraNinjaDeps []string) {
ninjaDeps := bootstrap.RunBlueprint(blueprintArgs, bp2buildCtx.Context, configuration)
ninjaDeps = append(ninjaDeps, extraNinjaDeps...)
globListFiles := writeBuildGlobsNinjaFile(bp2buildCtx.SrcDir(), configuration.BuildDir(), bp2buildCtx.Globs, configuration)
globListFiles := writeBuildGlobsNinjaFile(bp2buildCtx.SrcDir(), configuration.SoongOutDir(), bp2buildCtx.Globs, configuration)
ninjaDeps = append(ninjaDeps, globListFiles...)
// Run the code-generation phase to convert BazelTargetModules to BUILD files
@ -513,8 +513,8 @@ func runBp2Build(configuration android.Config, extraNinjaDeps []string) {
codegenContext := bp2build.NewCodegenContext(configuration, *bp2buildCtx, bp2build.Bp2Build)
metrics := bp2build.Codegen(codegenContext)
generatedRoot := shared.JoinPath(configuration.BuildDir(), "bp2build")
workspaceRoot := shared.JoinPath(configuration.BuildDir(), "workspace")
generatedRoot := shared.JoinPath(configuration.SoongOutDir(), "bp2build")
workspaceRoot := shared.JoinPath(configuration.SoongOutDir(), "workspace")
excludes := []string{
"bazel-bin",

View file

@ -159,7 +159,7 @@ func init() {
}
func constructPath(ctx android.PathContext, path string) android.Path {
buildDirPrefix := ctx.Config().BuildDir() + "/"
buildDirPrefix := ctx.Config().SoongOutDir() + "/"
if path == "" {
return nil
} else if strings.HasPrefix(path, buildDirPrefix) {

View file

@ -1737,7 +1737,7 @@ func TestPackageNameOverride(t *testing.T) {
foo := result.ModuleForTests("foo", "android_common")
outSoongDir := result.Config.BuildDir()
outSoongDir := result.Config.SoongOutDir()
outputs := foo.AllOutputs()
outputMap := make(map[string]bool)

View file

@ -791,7 +791,7 @@ func (j *Module) collectJavacFlags(
// Manually specify build directory in case it is not under the repo root.
// (javac doesn't seem to expand into symbolic links when searching for patch-module targets, so
// just adding a symlink under the root doesn't help.)
patchPaths := []string{".", ctx.Config().BuildDir()}
patchPaths := []string{".", ctx.Config().SoongOutDir()}
// b/150878007
//

View file

@ -1183,7 +1183,7 @@ func checkPatchModuleFlag(t *testing.T, ctx *android.TestContext, moduleName str
break
}
}
if expected != android.StringPathRelativeToTop(ctx.Config().BuildDir(), got) {
if expected != android.StringPathRelativeToTop(ctx.Config().SoongOutDir(), got) {
t.Errorf("Unexpected patch-module flag for module %q - expected %q, but got %q", moduleName, expected, got)
}
}

View file

@ -36,7 +36,7 @@ func testProjectJson(t *testing.T, bp string) []byte {
// The JSON file is generated via WriteFileToOutputDir. Therefore, it
// won't appear in the Output of the TestingSingleton. Manually verify
// it exists.
content, err := ioutil.ReadFile(filepath.Join(result.Config.BuildDir(), rustProjectJsonFileName))
content, err := ioutil.ReadFile(filepath.Join(result.Config.SoongOutDir(), rustProjectJsonFileName))
if err != nil {
t.Errorf("rust-project.json has not been generated")
}

View file

@ -71,17 +71,17 @@ func writeEnvironmentFile(ctx Context, envFile string, envDeps map[string]string
// A tiny struct used to tell Blueprint that it's in bootstrap mode. It would
// probably be nicer to use a flag in bootstrap.Args instead.
type BlueprintConfig struct {
buildDir string
ninjaBuildDir string
soongOutDir string
outDir string
debugCompilation bool
}
func (c BlueprintConfig) BuildDir() string {
return c.buildDir
func (c BlueprintConfig) SoongOutDir() string {
return c.soongOutDir
}
func (c BlueprintConfig) NinjaBuildDir() string {
return c.ninjaBuildDir
func (c BlueprintConfig) OutDir() string {
return c.outDir
}
func (c BlueprintConfig) DebugCompilation() bool {
@ -189,8 +189,8 @@ func bootstrapBlueprint(ctx Context, config Config) {
blueprintCtx := blueprint.NewContext()
blueprintCtx.SetIgnoreUnknownModuleTypes(true)
blueprintConfig := BlueprintConfig{
buildDir: config.SoongOutDir(),
ninjaBuildDir: config.OutDir(),
soongOutDir: config.SoongOutDir(),
outDir: config.OutDir(),
debugCompilation: os.Getenv("SOONG_DELVE") != "",
}