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

Commit fc06a599 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge changes from topic "soong-cc-install"

* changes:
  Move cc module installation into Soong
  Temporarily add method to get java binary tool
parents 92594212 acfcc1f6
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -564,11 +564,18 @@ func (c *config) SetAllowMissingDependencies() {
// BlueprintToolLocation returns the directory containing build system tools
// from Blueprint, like soong_zip and merge_zips.
func (c *config) HostToolDir() string {
	if c.KatiEnabled() {
		return filepath.Join(c.outDir, "host", c.PrebuiltOS(), "bin")
	} else {
		return filepath.Join(c.soongOutDir, "host", c.PrebuiltOS(), "bin")
	}
}

func (c *config) HostToolPath(ctx PathContext, tool string) Path {
	path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool)
	if ctx.Config().KatiEnabled() {
		path = path.ToMakePath()
	}
	return path
}

@@ -578,6 +585,9 @@ func (c *config) HostJNIToolPath(ctx PathContext, lib string) Path {
		ext = ".dylib"
	}
	path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "lib64", false, lib+ext)
	if ctx.Config().KatiEnabled() {
		path = path.ToMakePath()
	}
	return path
}

@@ -585,6 +595,11 @@ func (c *config) HostJavaToolPath(ctx PathContext, path string) Path {
	return PathForOutput(ctx, "host", c.PrebuiltOS(), "framework", path)
}

func (c *config) HostJavaBinToolPath(ctx PathContext, tool string) Path {
	path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool)
	return path
}

// PrebuiltOS returns the name of the host OS used in prebuilts directories.
func (c *config) PrebuiltOS() string {
	switch runtime.GOOS {
+10 −0
Original line number Diff line number Diff line
@@ -177,6 +177,16 @@ func (p PackageContext) HostBinToolVariable(name, path string) blueprint.Variabl
	})
}

// HostJavaBinToolVariable returns a Variable whose value is the path to a host java tool
// in the bin directory for host java targets. It may only be called during a Go
// package's initialization - either from the init() function or as part of a
// package-scoped variable's initialization.
func (p PackageContext) HostJavaBinToolVariable(name, path string) blueprint.Variable {
	return p.VariableFunc(name, func(ctx PackageVarContext) string {
		return ctx.Config().HostJavaBinToolPath(ctx, path).String()
	})
}

// HostJNIToolVariable returns a Variable whose value is the path to a host tool
// in the lib directory for host targets. It may only be called during a Go
// package's initialization - either from the init() function or as part of a
+3 −0
Original line number Diff line number Diff line
@@ -465,6 +465,9 @@ func (p OutputPaths) Strings() []string {
// PathForGoBinary returns the path to the installed location of a bootstrap_go_binary module.
func PathForGoBinary(ctx PathContext, goBinary bootstrap.GoBinaryTool) Path {
	goBinaryInstallDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false)
	if ctx.Config().KatiEnabled() {
		goBinaryInstallDir = goBinaryInstallDir.ToMakePath()
	}
	rel := Rel(ctx, goBinaryInstallDir.String(), goBinary.InstallPath())
	return goBinaryInstallDir.Join(ctx, rel)
}
+8 −0
Original line number Diff line number Diff line
@@ -839,6 +839,14 @@ func sboxPathForToolRel(ctx BuilderContext, path Path) string {
		// The tool is in the Soong output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
		return filepath.Join(sboxToolsSubDir, "out", relOutSoong)
	}
	if ctx.Config().KatiEnabled() {
		toolDir = toolDir.ToMakePath()
		relOut, isRelOut, _ := maybeRelErr(toolDir.String(), path.String())
		if isRelOut {
			// The tool is in the Make output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
			return filepath.Join(sboxToolsSubDir, "out", relOut)
		}
	}
	// The tool is in the source directory, it will be copied to __SBOX_OUT_DIR__/tools/src
	return filepath.Join(sboxToolsSubDir, "src", path.String())
}
+0 −5
Original line number Diff line number Diff line
@@ -450,11 +450,6 @@ func (installer *baseInstaller) AndroidMkEntries(ctx AndroidMkContext, entries *
	if installer.path == (android.InstallPath{}) {
		return
	}
	// Soong installation is only supported for host modules. Have Make
	// installation trigger Soong installation.
	if ctx.Target().Os.Class == android.Host {
		entries.OutputFile = android.OptionalPathForPath(installer.path)
	}

	entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
		path, file := filepath.Split(installer.path.ToMakePath().String())
Loading