Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5602d330 authored by Lukács T. Berki's avatar Lukács T. Berki Committed by Gerrit Code Review
Browse files

Merge "Rename BuildDir and NinjaBuildDir."

parents 7e4c05fc 9f6c24a8
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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
}
+1 −1
Original line number Diff line number Diff line
@@ -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{
+16 −16
Original line number Diff line number Diff line
@@ -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,10 +283,10 @@ 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,
			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)
+1 −1
Original line number Diff line number Diff line
@@ -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
Loading