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

Commit f7e36d80 authored by Lukacs T. Berki's avatar Lukacs T. Berki
Browse files

Remove Srcdir() from BootstrapConfig.

It was always ".".

Test: Presubmits.
Change-Id: I5381002b3f2986122f1b335a88119cead0a86d75
parent f9008075
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -79,10 +79,6 @@ func (c Config) DebugCompilation() bool {
	return false // Never compile Go code in the main build for debugging
}

func (c Config) SrcDir() string {
	return c.srcDir
}

// A DeviceConfig object represents the configuration for a particular device
// being built. For now there will only be one of these, but in the future there
// may be multiple devices being built.
@@ -126,7 +122,6 @@ type config struct {

	deviceConfig *deviceConfig

	srcDir         string // the path of the root source directory
	buildDir       string // the path of the build output directory
	moduleListFile string // the path to the file which lists blueprint files to parse.

@@ -402,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.srcDir, c.buildDir, c.moduleListFile, c.env)
	newConfig, err := NewConfig(c.buildDir, c.moduleListFile, c.env)
	if err != nil {
		return Config{}, err
	}
@@ -413,14 +408,13 @@ 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(srcDir, buildDir string, moduleListFile string, availableEnv map[string]string) (Config, error) {
func NewConfig(buildDir string, moduleListFile string, availableEnv map[string]string) (Config, error) {
	// Make a config with default options.
	config := &config{
		ProductVariablesFileName: filepath.Join(buildDir, productVariablesFileName),

		env: availableEnv,

		srcDir:            srcDir,
		buildDir:          buildDir,
		multilibConflicts: make(map[ArchType]bool),

@@ -439,7 +433,7 @@ func NewConfig(srcDir, buildDir string, moduleListFile string, availableEnv map[
		return Config{}, err
	}

	absSrcDir, err := filepath.Abs(srcDir)
	absSrcDir, err := filepath.Abs(".")
	if err != nil {
		return Config{}, err
	}
@@ -597,7 +591,7 @@ func (c *config) PrebuiltOS() string {

// GoRoot returns the path to the root directory of the Go toolchain.
func (c *config) GoRoot() string {
	return fmt.Sprintf("%s/prebuilts/go/%s", c.srcDir, c.PrebuiltOS())
	return fmt.Sprintf("prebuilts/go/%s", c.PrebuiltOS())
}

// PrebuiltBuildTool returns the path to a tool in the prebuilts directory containing
+4 −4
Original line number Diff line number Diff line
@@ -622,7 +622,7 @@ func expandOneSrcPath(ctx ModuleWithDepsPathContext, sPath string, expandedExclu
// It intended for use in globs that only list files that exist, so it allows '$' in
// filenames.
func pathsForModuleSrcFromFullPath(ctx EarlyModulePathContext, paths []string, incDirs bool) Paths {
	prefix := filepath.Join(ctx.Config().srcDir, ctx.ModuleDir()) + "/"
	prefix := ctx.ModuleDir() + "/"
	if prefix == "./" {
		prefix = ""
	}
@@ -658,7 +658,7 @@ func PathsWithOptionalDefaultForModuleSrc(ctx ModuleMissingDepsPathContext, inpu
	}
	// Use Glob so that if the default doesn't exist, a dependency is added so that when it
	// is created, we're run again.
	path := filepath.Join(ctx.Config().srcDir, ctx.ModuleDir(), def)
	path := filepath.Join(ctx.ModuleDir(), def)
	return Glob(ctx, path, nil)
}

@@ -986,7 +986,7 @@ func (p SourcePath) withRel(rel string) SourcePath {
// code that is embedding ninja variables in paths
func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) {
	p, err := validateSafePath(pathComponents...)
	ret := SourcePath{basePath{p, ""}, ctx.Config().srcDir}
	ret := SourcePath{basePath{p, ""}, "."}
	if err != nil {
		return ret, err
	}
@@ -1002,7 +1002,7 @@ func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, e
// pathForSource creates a SourcePath from pathComponents, but does not check that it exists.
func pathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) {
	p, err := validatePath(pathComponents...)
	ret := SourcePath{basePath{p, ""}, ctx.Config().srcDir}
	ret := SourcePath{basePath{p, ""}, "."}
	if err != nil {
		return ret, err
	}
+5 −7
Original line number Diff line number Diff line
@@ -107,8 +107,8 @@ func newContext(configuration android.Config, prepareBuildActions bool) *android
	return ctx
}

func newConfig(srcDir, outDir string, availableEnv map[string]string) android.Config {
	configuration, err := android.NewConfig(srcDir, outDir, cmdlineArgs.ModuleListFile, availableEnv)
func newConfig(outDir string, availableEnv map[string]string) android.Config {
	configuration, err := android.NewConfig(outDir, cmdlineArgs.ModuleListFile, availableEnv)
	if err != nil {
		fmt.Fprintf(os.Stderr, "%s", err)
		os.Exit(1)
@@ -273,9 +273,7 @@ func main() {

	availableEnv := parseAvailableEnv()

	// The top-level Blueprints file is passed as the first argument.
	srcDir := filepath.Dir(flag.Arg(0))
	configuration := newConfig(srcDir, outDir, availableEnv)
	configuration := newConfig(outDir, availableEnv)
	extraNinjaDeps := []string{
		configuration.ProductVariablesFileName,
		usedEnvFile,
@@ -469,7 +467,7 @@ func runBp2Build(configuration android.Config, extraNinjaDeps []string) {
	// configurations or variables, since those will generate different BUILD
	// files based on how the user has configured their tree.
	bp2buildCtx.SetModuleListFile(cmdlineArgs.ModuleListFile)
	modulePaths, err := bp2buildCtx.ListModulePaths(configuration.SrcDir())
	modulePaths, err := bp2buildCtx.ListModulePaths(".")
	if err != nil {
		panic(err)
	}
@@ -526,7 +524,7 @@ func runBp2Build(configuration android.Config, extraNinjaDeps []string) {
	excludes = append(excludes, getTemporaryExcludes()...)

	symlinkForestDeps := bp2build.PlantSymlinkForest(
		topDir, workspaceRoot, generatedRoot, configuration.SrcDir(), excludes)
		topDir, workspaceRoot, generatedRoot, ".", excludes)

	// Only report metrics when in bp2build mode. The metrics aren't relevant
	// for queryview, since that's a total repo-wide conversion and there's a
+0 −6
Original line number Diff line number Diff line
@@ -71,16 +71,11 @@ 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 {
	srcDir           string
	buildDir         string
	ninjaBuildDir    string
	debugCompilation bool
}

func (c BlueprintConfig) SrcDir() string {
	return "."
}

func (c BlueprintConfig) BuildDir() string {
	return c.buildDir
}
@@ -194,7 +189,6 @@ func bootstrapBlueprint(ctx Context, config Config) {
	blueprintCtx := blueprint.NewContext()
	blueprintCtx.SetIgnoreUnknownModuleTypes(true)
	blueprintConfig := BlueprintConfig{
		srcDir:           os.Getenv("TOP"),
		buildDir:         config.SoongOutDir(),
		ninjaBuildDir:    config.OutDir(),
		debugCompilation: os.Getenv("SOONG_DELVE") != "",