Merge changes from topic "soong_prebuilts_misc_common"
* changes: Fix finding src directory for aidl Support multiple outputs in genrules with depfile: true Support installable prebuilt jars
This commit is contained in:
@@ -260,13 +260,13 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
// recall that Sprintf replaces percent sign expressions, whereas dollar signs expressions remain as written,
|
// recall that Sprintf replaces percent sign expressions, whereas dollar signs expressions remain as written,
|
||||||
// to be replaced later by ninja_strings.go
|
// to be replaced later by ninja_strings.go
|
||||||
sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q $out", sandboxPath, buildDir, rawCommand)
|
sandboxCommand := fmt.Sprintf("$sboxCmd --sandbox-path %s --output-root %s -c %q $allouts", sandboxPath, buildDir, rawCommand)
|
||||||
|
|
||||||
ruleParams := blueprint.RuleParams{
|
ruleParams := blueprint.RuleParams{
|
||||||
Command: sandboxCommand,
|
Command: sandboxCommand,
|
||||||
CommandDeps: []string{"$sboxCmd"},
|
CommandDeps: []string{"$sboxCmd"},
|
||||||
}
|
}
|
||||||
var args []string
|
args := []string{"allouts"}
|
||||||
if g.properties.Depfile {
|
if g.properties.Depfile {
|
||||||
ruleParams.Deps = blueprint.DepsGCC
|
ruleParams.Deps = blueprint.DepsGCC
|
||||||
args = append(args, "depfile")
|
args = append(args, "depfile")
|
||||||
@@ -281,6 +281,10 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask) {
|
func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask) {
|
||||||
desc := "generate"
|
desc := "generate"
|
||||||
|
if len(task.out) == 0 {
|
||||||
|
ctx.ModuleErrorf("must have at least one output file")
|
||||||
|
return
|
||||||
|
}
|
||||||
if len(task.out) == 1 {
|
if len(task.out) == 1 {
|
||||||
desc += " " + task.out[0].Base()
|
desc += " " + task.out[0].Base()
|
||||||
}
|
}
|
||||||
@@ -288,9 +292,13 @@ func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask
|
|||||||
params := android.ModuleBuildParams{
|
params := android.ModuleBuildParams{
|
||||||
Rule: g.rule,
|
Rule: g.rule,
|
||||||
Description: "generate",
|
Description: "generate",
|
||||||
Outputs: task.out,
|
Output: task.out[0],
|
||||||
|
ImplicitOutputs: task.out[1:],
|
||||||
Inputs: task.in,
|
Inputs: task.in,
|
||||||
Implicits: g.deps,
|
Implicits: g.deps,
|
||||||
|
Args: map[string]string{
|
||||||
|
"allouts": strings.Join(task.out.Strings(), " "),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if g.properties.Depfile {
|
if g.properties.Depfile {
|
||||||
depfile := android.GenPathWithExt(ctx, "", task.out[0], task.out[0].Ext()+".d")
|
depfile := android.GenPathWithExt(ctx, "", task.out[0], task.out[0].Ext()+".d")
|
||||||
|
@@ -74,7 +74,7 @@ func (prebuilt *Import) AndroidMk() android.AndroidMkData {
|
|||||||
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
||||||
Extra: []android.AndroidMkExtraFunc{
|
Extra: []android.AndroidMkExtraFunc{
|
||||||
func(w io.Writer, outputFile android.Path) {
|
func(w io.Writer, outputFile android.Path) {
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !proptools.Bool(prebuilt.properties.Installable))
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String())
|
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String())
|
||||||
fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.properties.Sdk_version)
|
fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.properties.Sdk_version)
|
||||||
},
|
},
|
||||||
|
@@ -374,7 +374,7 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt
|
|||||||
flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I"))
|
flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I"))
|
||||||
flags = append(flags, android.JoinWithPrefix(localAidlIncludes.Strings(), "-I"))
|
flags = append(flags, android.JoinWithPrefix(localAidlIncludes.Strings(), "-I"))
|
||||||
flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String())
|
flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String())
|
||||||
if src := android.ExistentPathForSource(ctx, "", "src"); src.Valid() {
|
if src := android.ExistentPathForSource(ctx, "", ctx.ModuleDir(), "src"); src.Valid() {
|
||||||
flags = append(flags, "-I"+src.String())
|
flags = append(flags, "-I"+src.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,6 +920,8 @@ type ImportProperties struct {
|
|||||||
Jars []string
|
Jars []string
|
||||||
|
|
||||||
Sdk_version string
|
Sdk_version string
|
||||||
|
|
||||||
|
Installable *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Import struct {
|
type Import struct {
|
||||||
|
@@ -613,13 +613,13 @@ func TestGeneratedSources(t *testing.T) {
|
|||||||
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
|
javac := ctx.ModuleForTests("foo", "android_common").Rule("javac")
|
||||||
genrule := ctx.ModuleForTests("gen", "").Rule("generator")
|
genrule := ctx.ModuleForTests("gen", "").Rule("generator")
|
||||||
|
|
||||||
if len(genrule.Outputs) != 1 || filepath.Base(genrule.Outputs[0].String()) != "gen.java" {
|
if filepath.Base(genrule.Output.String()) != "gen.java" {
|
||||||
t.Fatalf(`gen output file %v is not [".../gen.java"]`, genrule.Outputs.Strings())
|
t.Fatalf(`gen output file %v is not ".../gen.java"`, genrule.Output.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(javac.Inputs) != 3 ||
|
if len(javac.Inputs) != 3 ||
|
||||||
javac.Inputs[0].String() != "a.java" ||
|
javac.Inputs[0].String() != "a.java" ||
|
||||||
javac.Inputs[1].String() != genrule.Outputs[0].String() ||
|
javac.Inputs[1].String() != genrule.Output.String() ||
|
||||||
javac.Inputs[2].String() != "b.java" {
|
javac.Inputs[2].String() != "b.java" {
|
||||||
t.Errorf(`foo inputs %v != ["a.java", ".../gen.java", "b.java"]`, javac.Inputs)
|
t.Errorf(`foo inputs %v != ["a.java", ".../gen.java", "b.java"]`, javac.Inputs)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user