Pass pctx and ctx to NewRuleBuilder
Enable the RuleBuilder and RuleBuilderCommand methods to access the BuilderContext by passing it to NewRuleBuilder instead of RuleBuilder.Build. Test: genrule_test.go Test: rule_builder_test.go Test: m checkbuild Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
This commit is contained in:
@@ -163,7 +163,7 @@ func (p *PackagingBase) CopyDepsToZip(ctx ModuleContext, zipOut OutputPath) (ent
|
|||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
builder := NewRuleBuilder()
|
builder := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
dir := PathForModuleOut(ctx, ".zip").OutputPath
|
dir := PathForModuleOut(ctx, ".zip").OutputPath
|
||||||
builder.Command().Text("rm").Flag("-rf").Text(dir.String())
|
builder.Command().Text("rm").Flag("-rf").Text(dir.String())
|
||||||
@@ -190,13 +190,13 @@ func (p *PackagingBase) CopyDepsToZip(ctx ModuleContext, zipOut OutputPath) (ent
|
|||||||
}
|
}
|
||||||
|
|
||||||
builder.Command().
|
builder.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", zipOut).
|
FlagWithOutput("-o ", zipOut).
|
||||||
FlagWithArg("-C ", dir.String()).
|
FlagWithArg("-C ", dir.String()).
|
||||||
Flag("-L 0"). // no compression because this will be unzipped soon
|
Flag("-L 0"). // no compression because this will be unzipped soon
|
||||||
FlagWithArg("-D ", dir.String())
|
FlagWithArg("-D ", dir.String())
|
||||||
builder.Command().Text("rm").Flag("-rf").Text(dir.String())
|
builder.Command().Text("rm").Flag("-rf").Text(dir.String())
|
||||||
|
|
||||||
builder.Build(pctx, ctx, "zip_deps", fmt.Sprintf("Zipping deps for %s", ctx.ModuleName()))
|
builder.Build("zip_deps", fmt.Sprintf("Zipping deps for %s", ctx.ModuleName()))
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
@@ -122,7 +122,7 @@ type ProtoProperties struct {
|
|||||||
} `android:"arch_variant"`
|
} `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProtoRule(ctx ModuleContext, rule *RuleBuilder, protoFile Path, flags ProtoFlags, deps Paths,
|
func ProtoRule(rule *RuleBuilder, protoFile Path, flags ProtoFlags, deps Paths,
|
||||||
outDir WritablePath, depFile WritablePath, outputs WritablePaths) {
|
outDir WritablePath, depFile WritablePath, outputs WritablePaths) {
|
||||||
|
|
||||||
var protoBase string
|
var protoBase string
|
||||||
@@ -134,7 +134,7 @@ func ProtoRule(ctx ModuleContext, rule *RuleBuilder, protoFile Path, flags Proto
|
|||||||
}
|
}
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "aprotoc").
|
BuiltTool("aprotoc").
|
||||||
FlagWithArg(flags.OutTypeFlag+"=", strings.Join(flags.OutParams, ",")+":"+outDir.String()).
|
FlagWithArg(flags.OutTypeFlag+"=", strings.Join(flags.OutParams, ",")+":"+outDir.String()).
|
||||||
FlagWithDepFile("--dependency_out=", depFile).
|
FlagWithDepFile("--dependency_out=", depFile).
|
||||||
FlagWithArg("-I ", protoBase).
|
FlagWithArg("-I ", protoBase).
|
||||||
@@ -144,5 +144,5 @@ func ProtoRule(ctx ModuleContext, rule *RuleBuilder, protoFile Path, flags Proto
|
|||||||
ImplicitOutputs(outputs)
|
ImplicitOutputs(outputs)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "dep_fixer").Flag(depFile.String())
|
BuiltTool("dep_fixer").Flag(depFile.String())
|
||||||
}
|
}
|
||||||
|
@@ -37,6 +37,9 @@ const sboxOutDir = sboxSandboxBaseDir + "/" + sboxOutSubDir
|
|||||||
// RuleBuilder provides an alternative to ModuleContext.Rule and ModuleContext.Build to add a command line to the build
|
// RuleBuilder provides an alternative to ModuleContext.Rule and ModuleContext.Build to add a command line to the build
|
||||||
// graph.
|
// graph.
|
||||||
type RuleBuilder struct {
|
type RuleBuilder struct {
|
||||||
|
pctx PackageContext
|
||||||
|
ctx BuilderContext
|
||||||
|
|
||||||
commands []*RuleBuilderCommand
|
commands []*RuleBuilderCommand
|
||||||
installs RuleBuilderInstalls
|
installs RuleBuilderInstalls
|
||||||
temporariesSet map[WritablePath]bool
|
temporariesSet map[WritablePath]bool
|
||||||
@@ -44,14 +47,16 @@ type RuleBuilder struct {
|
|||||||
sbox bool
|
sbox bool
|
||||||
highmem bool
|
highmem bool
|
||||||
remoteable RemoteRuleSupports
|
remoteable RemoteRuleSupports
|
||||||
sboxOutDir WritablePath
|
outDir WritablePath
|
||||||
sboxManifestPath WritablePath
|
sboxManifestPath WritablePath
|
||||||
missingDeps []string
|
missingDeps []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRuleBuilder returns a newly created RuleBuilder.
|
// NewRuleBuilder returns a newly created RuleBuilder.
|
||||||
func NewRuleBuilder() *RuleBuilder {
|
func NewRuleBuilder(pctx PackageContext, ctx BuilderContext) *RuleBuilder {
|
||||||
return &RuleBuilder{
|
return &RuleBuilder{
|
||||||
|
pctx: pctx,
|
||||||
|
ctx: ctx,
|
||||||
temporariesSet: make(map[WritablePath]bool),
|
temporariesSet: make(map[WritablePath]bool),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +135,7 @@ func (r *RuleBuilder) Sbox(outputDir WritablePath, manifestPath WritablePath) *R
|
|||||||
panic("Sbox() is not compatible with Restat()")
|
panic("Sbox() is not compatible with Restat()")
|
||||||
}
|
}
|
||||||
r.sbox = true
|
r.sbox = true
|
||||||
r.sboxOutDir = outputDir
|
r.outDir = outputDir
|
||||||
r.sboxManifestPath = manifestPath
|
r.sboxManifestPath = manifestPath
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
@@ -146,8 +151,7 @@ func (r *RuleBuilder) Install(from Path, to string) {
|
|||||||
// race with any call to Build.
|
// race with any call to Build.
|
||||||
func (r *RuleBuilder) Command() *RuleBuilderCommand {
|
func (r *RuleBuilder) Command() *RuleBuilderCommand {
|
||||||
command := &RuleBuilderCommand{
|
command := &RuleBuilderCommand{
|
||||||
sbox: r.sbox,
|
rule: r,
|
||||||
outDir: r.sboxOutDir,
|
|
||||||
}
|
}
|
||||||
r.commands = append(r.commands, command)
|
r.commands = append(r.commands, command)
|
||||||
return command
|
return command
|
||||||
@@ -395,19 +399,19 @@ type BuilderContext interface {
|
|||||||
var _ BuilderContext = ModuleContext(nil)
|
var _ BuilderContext = ModuleContext(nil)
|
||||||
var _ BuilderContext = SingletonContext(nil)
|
var _ BuilderContext = SingletonContext(nil)
|
||||||
|
|
||||||
func (r *RuleBuilder) depFileMergerCmd(ctx PathContext, depFiles WritablePaths) *RuleBuilderCommand {
|
func (r *RuleBuilder) depFileMergerCmd(depFiles WritablePaths) *RuleBuilderCommand {
|
||||||
return r.Command().
|
return r.Command().
|
||||||
BuiltTool(ctx, "dep_fixer").
|
BuiltTool("dep_fixer").
|
||||||
Inputs(depFiles.Paths())
|
Inputs(depFiles.Paths())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build adds the built command line to the build graph, with dependencies on Inputs and Tools, and output files for
|
// Build adds the built command line to the build graph, with dependencies on Inputs and Tools, and output files for
|
||||||
// Outputs.
|
// Outputs.
|
||||||
func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string, desc string) {
|
func (r *RuleBuilder) Build(name string, desc string) {
|
||||||
name = ninjaNameEscape(name)
|
name = ninjaNameEscape(name)
|
||||||
|
|
||||||
if len(r.missingDeps) > 0 {
|
if len(r.missingDeps) > 0 {
|
||||||
ctx.Build(pctx, BuildParams{
|
r.ctx.Build(pctx, BuildParams{
|
||||||
Rule: ErrorRule,
|
Rule: ErrorRule,
|
||||||
Outputs: r.Outputs(),
|
Outputs: r.Outputs(),
|
||||||
OrderOnly: r.OrderOnlys(),
|
OrderOnly: r.OrderOnlys(),
|
||||||
@@ -426,13 +430,13 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
|
|||||||
depFormat = blueprint.DepsGCC
|
depFormat = blueprint.DepsGCC
|
||||||
if len(depFiles) > 1 {
|
if len(depFiles) > 1 {
|
||||||
// Add a command locally that merges all depfiles together into the first depfile.
|
// Add a command locally that merges all depfiles together into the first depfile.
|
||||||
r.depFileMergerCmd(ctx, depFiles)
|
r.depFileMergerCmd(depFiles)
|
||||||
|
|
||||||
if r.sbox {
|
if r.sbox {
|
||||||
// Check for Rel() errors, as all depfiles should be in the output dir. Errors
|
// Check for Rel() errors, as all depfiles should be in the output dir. Errors
|
||||||
// will be reported to the ctx.
|
// will be reported to the ctx.
|
||||||
for _, path := range depFiles[1:] {
|
for _, path := range depFiles[1:] {
|
||||||
Rel(ctx, r.sboxOutDir.String(), path.String())
|
Rel(r.ctx, r.outDir.String(), path.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,7 +472,7 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
|
|||||||
// to the output directory.
|
// to the output directory.
|
||||||
sboxOutputs := make([]string, len(outputs))
|
sboxOutputs := make([]string, len(outputs))
|
||||||
for i, output := range outputs {
|
for i, output := range outputs {
|
||||||
rel := Rel(ctx, r.sboxOutDir.String(), output.String())
|
rel := Rel(r.ctx, r.outDir.String(), output.String())
|
||||||
sboxOutputs[i] = filepath.Join(sboxOutDir, rel)
|
sboxOutputs[i] = filepath.Join(sboxOutDir, rel)
|
||||||
command.CopyAfter = append(command.CopyAfter, &sbox_proto.Copy{
|
command.CopyAfter = append(command.CopyAfter, &sbox_proto.Copy{
|
||||||
From: proto.String(filepath.Join(sboxOutSubDir, rel)),
|
From: proto.String(filepath.Join(sboxOutSubDir, rel)),
|
||||||
@@ -483,23 +487,27 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
|
|||||||
|
|
||||||
// Verify that the manifest textproto is not inside the sbox output directory, otherwise
|
// Verify that the manifest textproto is not inside the sbox output directory, otherwise
|
||||||
// it will get deleted when the sbox rule clears its output directory.
|
// it will get deleted when the sbox rule clears its output directory.
|
||||||
_, manifestInOutDir := MaybeRel(ctx, r.sboxOutDir.String(), r.sboxManifestPath.String())
|
_, manifestInOutDir := MaybeRel(r.ctx, r.outDir.String(), r.sboxManifestPath.String())
|
||||||
if manifestInOutDir {
|
if manifestInOutDir {
|
||||||
ReportPathErrorf(ctx, "sbox rule %q manifestPath %q must not be in outputDir %q",
|
ReportPathErrorf(r.ctx, "sbox rule %q manifestPath %q must not be in outputDir %q",
|
||||||
name, r.sboxManifestPath.String(), r.sboxOutDir.String())
|
name, r.sboxManifestPath.String(), r.outDir.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a rule to write the manifest as a the textproto.
|
// Create a rule to write the manifest as a the textproto.
|
||||||
WriteFileRule(ctx, r.sboxManifestPath, proto.MarshalTextString(&manifest))
|
WriteFileRule(r.ctx, r.sboxManifestPath, proto.MarshalTextString(&manifest))
|
||||||
|
|
||||||
// Generate a new string to use as the command line of the sbox rule. This uses
|
// Generate a new string to use as the command line of the sbox rule. This uses
|
||||||
// a RuleBuilderCommand as a convenience method of building the command line, then
|
// a RuleBuilderCommand as a convenience method of building the command line, then
|
||||||
// converts it to a string to replace commandString.
|
// converts it to a string to replace commandString.
|
||||||
sboxCmd := &RuleBuilderCommand{}
|
sboxCmd := &RuleBuilderCommand{
|
||||||
sboxCmd.Text("rm -rf").Output(r.sboxOutDir)
|
rule: &RuleBuilder{
|
||||||
|
ctx: r.ctx,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
sboxCmd.Text("rm -rf").Output(r.outDir)
|
||||||
sboxCmd.Text("&&")
|
sboxCmd.Text("&&")
|
||||||
sboxCmd.BuiltTool(ctx, "sbox").
|
sboxCmd.BuiltTool("sbox").
|
||||||
Flag("--sandbox-path").Text(shared.TempDirForOutDir(PathForOutput(ctx).String())).
|
Flag("--sandbox-path").Text(shared.TempDirForOutDir(PathForOutput(r.ctx).String())).
|
||||||
Flag("--manifest").Input(r.sboxManifestPath)
|
Flag("--manifest").Input(r.sboxManifestPath)
|
||||||
|
|
||||||
// Replace the command string, and add the sbox tool and manifest textproto to the
|
// Replace the command string, and add the sbox tool and manifest textproto to the
|
||||||
@@ -528,19 +536,19 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pool blueprint.Pool
|
var pool blueprint.Pool
|
||||||
if ctx.Config().UseGoma() && r.remoteable.Goma {
|
if r.ctx.Config().UseGoma() && r.remoteable.Goma {
|
||||||
// When USE_GOMA=true is set and the rule is supported by goma, allow jobs to run outside the local pool.
|
// When USE_GOMA=true is set and the rule is supported by goma, allow jobs to run outside the local pool.
|
||||||
} else if ctx.Config().UseRBE() && r.remoteable.RBE {
|
} else if r.ctx.Config().UseRBE() && r.remoteable.RBE {
|
||||||
// When USE_RBE=true is set and the rule is supported by RBE, use the remotePool.
|
// When USE_RBE=true is set and the rule is supported by RBE, use the remotePool.
|
||||||
pool = remotePool
|
pool = remotePool
|
||||||
} else if r.highmem {
|
} else if r.highmem {
|
||||||
pool = highmemPool
|
pool = highmemPool
|
||||||
} else if ctx.Config().UseRemoteBuild() {
|
} else if r.ctx.Config().UseRemoteBuild() {
|
||||||
pool = localPool
|
pool = localPool
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Build(pctx, BuildParams{
|
r.ctx.Build(r.pctx, BuildParams{
|
||||||
Rule: ctx.Rule(pctx, name, blueprint.RuleParams{
|
Rule: r.ctx.Rule(pctx, name, blueprint.RuleParams{
|
||||||
Command: commandString,
|
Command: commandString,
|
||||||
CommandDeps: tools.Strings(),
|
CommandDeps: tools.Strings(),
|
||||||
Restat: r.restat,
|
Restat: r.restat,
|
||||||
@@ -564,6 +572,8 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
|
|||||||
// RuleBuilderCommand, so they can be used chained or unchained. All methods that add text implicitly add a single
|
// RuleBuilderCommand, so they can be used chained or unchained. All methods that add text implicitly add a single
|
||||||
// space as a separator from the previous method.
|
// space as a separator from the previous method.
|
||||||
type RuleBuilderCommand struct {
|
type RuleBuilderCommand struct {
|
||||||
|
rule *RuleBuilder
|
||||||
|
|
||||||
buf strings.Builder
|
buf strings.Builder
|
||||||
inputs Paths
|
inputs Paths
|
||||||
implicits Paths
|
implicits Paths
|
||||||
@@ -576,16 +586,11 @@ type RuleBuilderCommand struct {
|
|||||||
|
|
||||||
// spans [start,end) of the command that should not be ninja escaped
|
// spans [start,end) of the command that should not be ninja escaped
|
||||||
unescapedSpans [][2]int
|
unescapedSpans [][2]int
|
||||||
|
|
||||||
sbox bool
|
|
||||||
// outDir is the directory that will contain the output files of the rules. sbox will copy
|
|
||||||
// the output files from the sandbox directory to this directory when it finishes.
|
|
||||||
outDir WritablePath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RuleBuilderCommand) addInput(path Path) string {
|
func (c *RuleBuilderCommand) addInput(path Path) string {
|
||||||
if c.sbox {
|
if c.rule.sbox {
|
||||||
if rel, isRel, _ := maybeRelErr(c.outDir.String(), path.String()); isRel {
|
if rel, isRel, _ := maybeRelErr(c.rule.outDir.String(), path.String()); isRel {
|
||||||
return filepath.Join(sboxOutDir, rel)
|
return filepath.Join(sboxOutDir, rel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -594,8 +599,8 @@ func (c *RuleBuilderCommand) addInput(path Path) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *RuleBuilderCommand) addImplicit(path Path) string {
|
func (c *RuleBuilderCommand) addImplicit(path Path) string {
|
||||||
if c.sbox {
|
if c.rule.sbox {
|
||||||
if rel, isRel, _ := maybeRelErr(c.outDir.String(), path.String()); isRel {
|
if rel, isRel, _ := maybeRelErr(c.rule.outDir.String(), path.String()); isRel {
|
||||||
return filepath.Join(sboxOutDir, rel)
|
return filepath.Join(sboxOutDir, rel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -607,22 +612,19 @@ func (c *RuleBuilderCommand) addOrderOnly(path Path) {
|
|||||||
c.orderOnlys = append(c.orderOnlys, path)
|
c.orderOnlys = append(c.orderOnlys, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RuleBuilderCommand) outputStr(path WritablePath) string {
|
// PathForOutput takes an output path and returns the appropriate path to use on the command
|
||||||
if c.sbox {
|
// line. If sbox was enabled via a call to RuleBuilder.Sbox(), it returns a path with the
|
||||||
return SboxPathForOutput(path, c.outDir)
|
// placeholder prefix used for outputs in sbox. If sbox is not enabled it returns the
|
||||||
|
// original path.
|
||||||
|
func (c *RuleBuilderCommand) PathForOutput(path WritablePath) string {
|
||||||
|
if c.rule.sbox {
|
||||||
|
// Errors will be handled in RuleBuilder.Build where we have a context to report them
|
||||||
|
rel, _, _ := maybeRelErr(c.rule.outDir.String(), path.String())
|
||||||
|
return filepath.Join(sboxOutDir, rel)
|
||||||
}
|
}
|
||||||
return path.String()
|
return path.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SboxPathForOutput takes an output path and the out directory passed to RuleBuilder.Sbox(),
|
|
||||||
// and returns the corresponding path for the output in the sbox sandbox. This can be used
|
|
||||||
// on the RuleBuilder command line to reference the output.
|
|
||||||
func SboxPathForOutput(path WritablePath, outDir WritablePath) string {
|
|
||||||
// Errors will be handled in RuleBuilder.Build where we have a context to report them
|
|
||||||
rel, _, _ := maybeRelErr(outDir.String(), path.String())
|
|
||||||
return filepath.Join(sboxOutDir, rel)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Text adds the specified raw text to the command line. The text should not contain input or output paths or the
|
// Text adds the specified raw text to the command line. The text should not contain input or output paths or the
|
||||||
// rule will not have them listed in its dependencies or outputs.
|
// rule will not have them listed in its dependencies or outputs.
|
||||||
func (c *RuleBuilderCommand) Text(text string) *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) Text(text string) *RuleBuilderCommand {
|
||||||
@@ -699,8 +701,8 @@ func (c *RuleBuilderCommand) Tool(path Path) *RuleBuilderCommand {
|
|||||||
//
|
//
|
||||||
// It is equivalent to:
|
// It is equivalent to:
|
||||||
// cmd.Tool(ctx.Config().HostToolPath(ctx, tool))
|
// cmd.Tool(ctx.Config().HostToolPath(ctx, tool))
|
||||||
func (c *RuleBuilderCommand) BuiltTool(ctx PathContext, tool string) *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) BuiltTool(tool string) *RuleBuilderCommand {
|
||||||
return c.Tool(ctx.Config().HostToolPath(ctx, tool))
|
return c.Tool(c.rule.ctx.Config().HostToolPath(c.rule.ctx, tool))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrebuiltBuildTool adds the specified tool path from prebuils/build-tools. The path will be also added to the
|
// PrebuiltBuildTool adds the specified tool path from prebuils/build-tools. The path will be also added to the
|
||||||
@@ -768,7 +770,7 @@ func (c *RuleBuilderCommand) OrderOnlys(paths Paths) *RuleBuilderCommand {
|
|||||||
// RuleBuilder.Outputs.
|
// RuleBuilder.Outputs.
|
||||||
func (c *RuleBuilderCommand) Output(path WritablePath) *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) Output(path WritablePath) *RuleBuilderCommand {
|
||||||
c.outputs = append(c.outputs, path)
|
c.outputs = append(c.outputs, path)
|
||||||
return c.Text(c.outputStr(path))
|
return c.Text(c.PathForOutput(path))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outputs adds the specified output paths to the command line, separated by spaces. The paths will also be added to
|
// Outputs adds the specified output paths to the command line, separated by spaces. The paths will also be added to
|
||||||
@@ -783,7 +785,7 @@ func (c *RuleBuilderCommand) Outputs(paths WritablePaths) *RuleBuilderCommand {
|
|||||||
// OutputDir adds the output directory to the command line. This is only available when used with RuleBuilder.Sbox,
|
// OutputDir adds the output directory to the command line. This is only available when used with RuleBuilder.Sbox,
|
||||||
// and will be the temporary output directory managed by sbox, not the final one.
|
// and will be the temporary output directory managed by sbox, not the final one.
|
||||||
func (c *RuleBuilderCommand) OutputDir() *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) OutputDir() *RuleBuilderCommand {
|
||||||
if !c.sbox {
|
if !c.rule.sbox {
|
||||||
panic("OutputDir only valid with Sbox")
|
panic("OutputDir only valid with Sbox")
|
||||||
}
|
}
|
||||||
return c.Text(sboxOutDir)
|
return c.Text(sboxOutDir)
|
||||||
@@ -794,7 +796,7 @@ func (c *RuleBuilderCommand) OutputDir() *RuleBuilderCommand {
|
|||||||
// commands in a single RuleBuilder then RuleBuilder.Build will add an extra command to merge the depfiles together.
|
// commands in a single RuleBuilder then RuleBuilder.Build will add an extra command to merge the depfiles together.
|
||||||
func (c *RuleBuilderCommand) DepFile(path WritablePath) *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) DepFile(path WritablePath) *RuleBuilderCommand {
|
||||||
c.depFiles = append(c.depFiles, path)
|
c.depFiles = append(c.depFiles, path)
|
||||||
return c.Text(c.outputStr(path))
|
return c.Text(c.PathForOutput(path))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImplicitOutput adds the specified output path to the dependencies returned by RuleBuilder.Outputs without modifying
|
// ImplicitOutput adds the specified output path to the dependencies returned by RuleBuilder.Outputs without modifying
|
||||||
@@ -885,14 +887,14 @@ func (c *RuleBuilderCommand) FlagForEachInput(flag string, paths Paths) *RuleBui
|
|||||||
// will also be added to the outputs returned by RuleBuilder.Outputs.
|
// will also be added to the outputs returned by RuleBuilder.Outputs.
|
||||||
func (c *RuleBuilderCommand) FlagWithOutput(flag string, path WritablePath) *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) FlagWithOutput(flag string, path WritablePath) *RuleBuilderCommand {
|
||||||
c.outputs = append(c.outputs, path)
|
c.outputs = append(c.outputs, path)
|
||||||
return c.Text(flag + c.outputStr(path))
|
return c.Text(flag + c.PathForOutput(path))
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlagWithDepFile adds the specified flag and depfile path to the command line, with no separator between them. The path
|
// FlagWithDepFile adds the specified flag and depfile path to the command line, with no separator between them. The path
|
||||||
// will also be added to the outputs returned by RuleBuilder.Outputs.
|
// will also be added to the outputs returned by RuleBuilder.Outputs.
|
||||||
func (c *RuleBuilderCommand) FlagWithDepFile(flag string, path WritablePath) *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) FlagWithDepFile(flag string, path WritablePath) *RuleBuilderCommand {
|
||||||
c.depFiles = append(c.depFiles, path)
|
c.depFiles = append(c.depFiles, path)
|
||||||
return c.Text(flag + c.outputStr(path))
|
return c.Text(flag + c.PathForOutput(path))
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlagWithRspFileInputList adds the specified flag and path to an rspfile to the command line, with no separator
|
// FlagWithRspFileInputList adds the specified flag and path to an rspfile to the command line, with no separator
|
||||||
@@ -987,3 +989,21 @@ func hashSrcFiles(srcFiles Paths) string {
|
|||||||
h.Write([]byte(srcFileList))
|
h.Write([]byte(srcFileList))
|
||||||
return fmt.Sprintf("%x", h.Sum(nil))
|
return fmt.Sprintf("%x", h.Sum(nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BuilderContextForTesting returns a BuilderContext for the given config that can be used for tests
|
||||||
|
// that need to call methods that take a BuilderContext.
|
||||||
|
func BuilderContextForTesting(config Config) BuilderContext {
|
||||||
|
pathCtx := PathContextForTesting(config)
|
||||||
|
return builderContextForTests{
|
||||||
|
PathContext: pathCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type builderContextForTests struct {
|
||||||
|
PathContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func (builderContextForTests) Rule(PackageContext, string, blueprint.RuleParams, ...string) blueprint.Rule {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (builderContextForTests) Build(PackageContext, BuildParams) {}
|
||||||
|
@@ -27,8 +27,8 @@ import (
|
|||||||
"android/soong/shared"
|
"android/soong/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
func pathContext() PathContext {
|
func builderContext() BuilderContext {
|
||||||
return PathContextForTesting(TestConfig("out", nil, "", map[string][]byte{
|
return BuilderContextForTesting(TestConfig("out", nil, "", map[string][]byte{
|
||||||
"ld": nil,
|
"ld": nil,
|
||||||
"a.o": nil,
|
"a.o": nil,
|
||||||
"b.o": nil,
|
"b.o": nil,
|
||||||
@@ -44,9 +44,9 @@ func pathContext() PathContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder() {
|
func ExampleRuleBuilder() {
|
||||||
rule := NewRuleBuilder()
|
ctx := builderContext()
|
||||||
|
|
||||||
ctx := pathContext()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Tool(PathForSource(ctx, "ld")).
|
Tool(PathForSource(ctx, "ld")).
|
||||||
@@ -55,7 +55,7 @@ func ExampleRuleBuilder() {
|
|||||||
rule.Command().Text("echo success")
|
rule.Command().Text("echo success")
|
||||||
|
|
||||||
// To add the command to the build graph:
|
// To add the command to the build graph:
|
||||||
// rule.Build(pctx, ctx, "link", "link")
|
// rule.Build("link", "link")
|
||||||
|
|
||||||
fmt.Printf("commands: %q\n", strings.Join(rule.Commands(), " && "))
|
fmt.Printf("commands: %q\n", strings.Join(rule.Commands(), " && "))
|
||||||
fmt.Printf("tools: %q\n", rule.Tools())
|
fmt.Printf("tools: %q\n", rule.Tools())
|
||||||
@@ -70,9 +70,9 @@ func ExampleRuleBuilder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_SymlinkOutputs() {
|
func ExampleRuleBuilder_SymlinkOutputs() {
|
||||||
rule := NewRuleBuilder()
|
ctx := builderContext()
|
||||||
|
|
||||||
ctx := pathContext()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Tool(PathForSource(ctx, "ln")).
|
Tool(PathForSource(ctx, "ln")).
|
||||||
@@ -96,9 +96,9 @@ func ExampleRuleBuilder_SymlinkOutputs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_Temporary() {
|
func ExampleRuleBuilder_Temporary() {
|
||||||
rule := NewRuleBuilder()
|
ctx := builderContext()
|
||||||
|
|
||||||
ctx := pathContext()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Tool(PathForSource(ctx, "cp")).
|
Tool(PathForSource(ctx, "cp")).
|
||||||
@@ -123,9 +123,9 @@ func ExampleRuleBuilder_Temporary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
||||||
rule := NewRuleBuilder()
|
ctx := builderContext()
|
||||||
|
|
||||||
ctx := pathContext()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Tool(PathForSource(ctx, "cp")).
|
Tool(PathForSource(ctx, "cp")).
|
||||||
@@ -151,9 +151,9 @@ func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_Installs() {
|
func ExampleRuleBuilder_Installs() {
|
||||||
rule := NewRuleBuilder()
|
ctx := builderContext()
|
||||||
|
|
||||||
ctx := pathContext()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
out := PathForOutput(ctx, "linked")
|
out := PathForOutput(ctx, "linked")
|
||||||
|
|
||||||
@@ -171,9 +171,9 @@ func ExampleRuleBuilder_Installs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand() {
|
func ExampleRuleBuilderCommand() {
|
||||||
rule := NewRuleBuilder()
|
ctx := builderContext()
|
||||||
|
|
||||||
ctx := pathContext()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
// chained
|
// chained
|
||||||
rule.Command().
|
rule.Command().
|
||||||
@@ -194,24 +194,24 @@ func ExampleRuleBuilderCommand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_Flag() {
|
func ExampleRuleBuilderCommand_Flag() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "ls")).Flag("-l"))
|
Tool(PathForSource(ctx, "ls")).Flag("-l"))
|
||||||
// Output:
|
// Output:
|
||||||
// ls -l
|
// ls -l
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_Flags() {
|
func ExampleRuleBuilderCommand_Flags() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "ls")).Flags([]string{"-l", "-a"}))
|
Tool(PathForSource(ctx, "ls")).Flags([]string{"-l", "-a"}))
|
||||||
// Output:
|
// Output:
|
||||||
// ls -l -a
|
// ls -l -a
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_FlagWithArg() {
|
func ExampleRuleBuilderCommand_FlagWithArg() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "ls")).
|
Tool(PathForSource(ctx, "ls")).
|
||||||
FlagWithArg("--sort=", "time"))
|
FlagWithArg("--sort=", "time"))
|
||||||
// Output:
|
// Output:
|
||||||
@@ -219,8 +219,8 @@ func ExampleRuleBuilderCommand_FlagWithArg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_FlagForEachArg() {
|
func ExampleRuleBuilderCommand_FlagForEachArg() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "ls")).
|
Tool(PathForSource(ctx, "ls")).
|
||||||
FlagForEachArg("--sort=", []string{"time", "size"}))
|
FlagForEachArg("--sort=", []string{"time", "size"}))
|
||||||
// Output:
|
// Output:
|
||||||
@@ -228,8 +228,8 @@ func ExampleRuleBuilderCommand_FlagForEachArg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_FlagForEachInput() {
|
func ExampleRuleBuilderCommand_FlagForEachInput() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "turbine")).
|
Tool(PathForSource(ctx, "turbine")).
|
||||||
FlagForEachInput("--classpath ", PathsForTesting("a.jar", "b.jar")))
|
FlagForEachInput("--classpath ", PathsForTesting("a.jar", "b.jar")))
|
||||||
// Output:
|
// Output:
|
||||||
@@ -237,8 +237,8 @@ func ExampleRuleBuilderCommand_FlagForEachInput() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_FlagWithInputList() {
|
func ExampleRuleBuilderCommand_FlagWithInputList() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "java")).
|
Tool(PathForSource(ctx, "java")).
|
||||||
FlagWithInputList("-classpath=", PathsForTesting("a.jar", "b.jar"), ":"))
|
FlagWithInputList("-classpath=", PathsForTesting("a.jar", "b.jar"), ":"))
|
||||||
// Output:
|
// Output:
|
||||||
@@ -246,8 +246,8 @@ func ExampleRuleBuilderCommand_FlagWithInputList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_FlagWithInput() {
|
func ExampleRuleBuilderCommand_FlagWithInput() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "java")).
|
Tool(PathForSource(ctx, "java")).
|
||||||
FlagWithInput("-classpath=", PathForSource(ctx, "a")))
|
FlagWithInput("-classpath=", PathForSource(ctx, "a")))
|
||||||
// Output:
|
// Output:
|
||||||
@@ -255,8 +255,8 @@ func ExampleRuleBuilderCommand_FlagWithInput() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_FlagWithList() {
|
func ExampleRuleBuilderCommand_FlagWithList() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "ls")).
|
Tool(PathForSource(ctx, "ls")).
|
||||||
FlagWithList("--sort=", []string{"time", "size"}, ","))
|
FlagWithList("--sort=", []string{"time", "size"}, ","))
|
||||||
// Output:
|
// Output:
|
||||||
@@ -264,8 +264,8 @@ func ExampleRuleBuilderCommand_FlagWithList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_FlagWithRspFileInputList() {
|
func ExampleRuleBuilderCommand_FlagWithRspFileInputList() {
|
||||||
ctx := pathContext()
|
ctx := builderContext()
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Tool(PathForSource(ctx, "javac")).
|
Tool(PathForSource(ctx, "javac")).
|
||||||
FlagWithRspFileInputList("@", PathsForTesting("a.java", "b.java")).
|
FlagWithRspFileInputList("@", PathsForTesting("a.java", "b.java")).
|
||||||
NinjaEscapedString())
|
NinjaEscapedString())
|
||||||
@@ -274,7 +274,8 @@ func ExampleRuleBuilderCommand_FlagWithRspFileInputList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_String() {
|
func ExampleRuleBuilderCommand_String() {
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
ctx := builderContext()
|
||||||
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Text("FOO=foo").
|
Text("FOO=foo").
|
||||||
Text("echo $FOO").
|
Text("echo $FOO").
|
||||||
String())
|
String())
|
||||||
@@ -283,7 +284,8 @@ func ExampleRuleBuilderCommand_String() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_NinjaEscapedString() {
|
func ExampleRuleBuilderCommand_NinjaEscapedString() {
|
||||||
fmt.Println(NewRuleBuilder().Command().
|
ctx := builderContext()
|
||||||
|
fmt.Println(NewRuleBuilder(pctx, ctx).Command().
|
||||||
Text("FOO=foo").
|
Text("FOO=foo").
|
||||||
Text("echo $FOO").
|
Text("echo $FOO").
|
||||||
NinjaEscapedString())
|
NinjaEscapedString())
|
||||||
@@ -305,7 +307,10 @@ func TestRuleBuilder(t *testing.T) {
|
|||||||
"input3": nil,
|
"input3": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := PathContextForTesting(TestConfig("out", nil, "", fs))
|
pathCtx := PathContextForTesting(TestConfig("out", nil, "", fs))
|
||||||
|
ctx := builderContextForTests{
|
||||||
|
PathContext: pathCtx,
|
||||||
|
}
|
||||||
|
|
||||||
addCommands := func(rule *RuleBuilder) {
|
addCommands := func(rule *RuleBuilder) {
|
||||||
cmd := rule.Command().
|
cmd := rule.Command().
|
||||||
@@ -355,7 +360,7 @@ func TestRuleBuilder(t *testing.T) {
|
|||||||
wantSymlinkOutputs := PathsForOutput(ctx, []string{"ImplicitSymlinkOutput", "SymlinkOutput"})
|
wantSymlinkOutputs := PathsForOutput(ctx, []string{"ImplicitSymlinkOutput", "SymlinkOutput"})
|
||||||
|
|
||||||
t.Run("normal", func(t *testing.T) {
|
t.Run("normal", func(t *testing.T) {
|
||||||
rule := NewRuleBuilder()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
addCommands(rule)
|
addCommands(rule)
|
||||||
|
|
||||||
wantCommands := []string{
|
wantCommands := []string{
|
||||||
@@ -389,13 +394,13 @@ func TestRuleBuilder(t *testing.T) {
|
|||||||
t.Errorf("\nwant rule.OrderOnlys() = %#v\n got %#v", w, g)
|
t.Errorf("\nwant rule.OrderOnlys() = %#v\n got %#v", w, g)
|
||||||
}
|
}
|
||||||
|
|
||||||
if g, w := rule.depFileMergerCmd(ctx, rule.DepFiles()).String(), wantDepMergerCommand; g != w {
|
if g, w := rule.depFileMergerCmd(rule.DepFiles()).String(), wantDepMergerCommand; g != w {
|
||||||
t.Errorf("\nwant rule.depFileMergerCmd() = %#v\n got %#v", w, g)
|
t.Errorf("\nwant rule.depFileMergerCmd() = %#v\n got %#v", w, g)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("sbox", func(t *testing.T) {
|
t.Run("sbox", func(t *testing.T) {
|
||||||
rule := NewRuleBuilder().Sbox(PathForOutput(ctx, ""),
|
rule := NewRuleBuilder(pctx, ctx).Sbox(PathForOutput(ctx, ""),
|
||||||
PathForOutput(ctx, "sbox.textproto"))
|
PathForOutput(ctx, "sbox.textproto"))
|
||||||
addCommands(rule)
|
addCommands(rule)
|
||||||
|
|
||||||
@@ -427,7 +432,7 @@ func TestRuleBuilder(t *testing.T) {
|
|||||||
t.Errorf("\nwant rule.OrderOnlys() = %#v\n got %#v", w, g)
|
t.Errorf("\nwant rule.OrderOnlys() = %#v\n got %#v", w, g)
|
||||||
}
|
}
|
||||||
|
|
||||||
if g, w := rule.depFileMergerCmd(ctx, rule.DepFiles()).String(), wantDepMergerCommand; g != w {
|
if g, w := rule.depFileMergerCmd(rule.DepFiles()).String(), wantDepMergerCommand; g != w {
|
||||||
t.Errorf("\nwant rule.depFileMergerCmd() = %#v\n got %#v", w, g)
|
t.Errorf("\nwant rule.depFileMergerCmd() = %#v\n got %#v", w, g)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -476,7 +481,7 @@ func (t *testRuleBuilderSingleton) GenerateBuildActions(ctx SingletonContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testRuleBuilder_Build(ctx BuilderContext, in Paths, out, outDep, outDir, manifestPath WritablePath, restat, sbox bool) {
|
func testRuleBuilder_Build(ctx BuilderContext, in Paths, out, outDep, outDir, manifestPath WritablePath, restat, sbox bool) {
|
||||||
rule := NewRuleBuilder()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
if sbox {
|
if sbox {
|
||||||
rule.Sbox(outDir, manifestPath)
|
rule.Sbox(outDir, manifestPath)
|
||||||
@@ -488,7 +493,7 @@ func testRuleBuilder_Build(ctx BuilderContext, in Paths, out, outDep, outDir, ma
|
|||||||
rule.Restat()
|
rule.Restat()
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "rule", "desc")
|
rule.Build("rule", "desc")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuleBuilder_Build(t *testing.T) {
|
func TestRuleBuilder_Build(t *testing.T) {
|
||||||
|
@@ -63,13 +63,13 @@ func robolectricTestSuite(ctx SingletonContext, files map[string]InstallPaths) W
|
|||||||
testCasesDir := pathForInstall(ctx, BuildOs, X86, "testcases", false).ToMakePath()
|
testCasesDir := pathForInstall(ctx, BuildOs, X86, "testcases", false).ToMakePath()
|
||||||
|
|
||||||
outputFile := PathForOutput(ctx, "packaging", "robolectric-tests.zip")
|
outputFile := PathForOutput(ctx, "packaging", "robolectric-tests.zip")
|
||||||
rule := NewRuleBuilder()
|
rule := NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().BuiltTool(ctx, "soong_zip").
|
rule.Command().BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", outputFile).
|
FlagWithOutput("-o ", outputFile).
|
||||||
FlagWithArg("-P ", "host/testcases").
|
FlagWithArg("-P ", "host/testcases").
|
||||||
FlagWithArg("-C ", testCasesDir.String()).
|
FlagWithArg("-C ", testCasesDir.String()).
|
||||||
FlagWithRspFileInputList("-r ", installedPaths.Paths())
|
FlagWithRspFileInputList("-r ", installedPaths.Paths())
|
||||||
rule.Build(pctx, ctx, "robolectric_tests_zip", "robolectric-tests.zip")
|
rule.Build("robolectric_tests_zip", "robolectric-tests.zip")
|
||||||
|
|
||||||
return outputFile
|
return outputFile
|
||||||
}
|
}
|
||||||
|
@@ -262,7 +262,7 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Output
|
|||||||
}
|
}
|
||||||
|
|
||||||
output := android.PathForModuleOut(ctx, "file_contexts")
|
output := android.PathForModuleOut(ctx, "file_contexts")
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
switch a.properties.ApexType {
|
switch a.properties.ApexType {
|
||||||
case imageApex:
|
case imageApex:
|
||||||
@@ -294,7 +294,7 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Output
|
|||||||
panic(fmt.Errorf("unsupported type %v", a.properties.ApexType))
|
panic(fmt.Errorf("unsupported type %v", a.properties.ApexType))
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "file_contexts."+a.Name(), "Generate file_contexts")
|
rule.Build("file_contexts."+a.Name(), "Generate file_contexts")
|
||||||
return output.OutputPath
|
return output.OutputPath
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,14 +329,14 @@ func (a *apexBundle) buildNoticeFiles(ctx android.ModuleContext, apexFileName st
|
|||||||
// included in the APEX without actually downloading and extracting it.
|
// included in the APEX without actually downloading and extracting it.
|
||||||
func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApex android.Path, imageDir android.Path) android.OutputPath {
|
func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApex android.Path, imageDir android.Path) android.OutputPath {
|
||||||
output := android.PathForModuleOut(ctx, "installed-files.txt")
|
output := android.PathForModuleOut(ctx, "installed-files.txt")
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Implicit(builtApex).
|
Implicit(builtApex).
|
||||||
Text("(cd " + imageDir.String() + " ; ").
|
Text("(cd " + imageDir.String() + " ; ").
|
||||||
Text("find . \\( -type f -o -type l \\) -printf \"%s %p\\n\") ").
|
Text("find . \\( -type f -o -type l \\) -printf \"%s %p\\n\") ").
|
||||||
Text(" | sort -nr > ").
|
Text(" | sort -nr > ").
|
||||||
Output(output)
|
Output(output)
|
||||||
rule.Build(pctx, ctx, "installed-files."+a.Name(), "Installed files")
|
rule.Build("installed-files."+a.Name(), "Installed files")
|
||||||
return output.OutputPath
|
return output.OutputPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ func (s *cflagArtifactsText) GenCFlagArtifactParts(ctx android.SingletonContext,
|
|||||||
|
|
||||||
cleanedName := strings.Replace(flag, "=", "_", -1)
|
cleanedName := strings.Replace(flag, "=", "_", -1)
|
||||||
filename, filepath := s.incrementFile(ctx, cleanedName, part)
|
filename, filepath := s.incrementFile(ctx, cleanedName, part)
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().Textf("rm -f %s", filepath.String())
|
rule.Command().Textf("rm -f %s", filepath.String())
|
||||||
|
|
||||||
if using {
|
if using {
|
||||||
@@ -84,7 +84,7 @@ func (s *cflagArtifactsText) GenCFlagArtifactParts(ctx android.SingletonContext,
|
|||||||
length := len(modules)
|
length := len(modules)
|
||||||
|
|
||||||
if length == 0 {
|
if length == 0 {
|
||||||
rule.Build(pctx, ctx, filename, "gen "+filename)
|
rule.Build(filename, "gen "+filename)
|
||||||
part++
|
part++
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,11 +98,11 @@ func (s *cflagArtifactsText) GenCFlagArtifactParts(ctx android.SingletonContext,
|
|||||||
strings.Join(proptools.ShellEscapeList(shard), " ")).
|
strings.Join(proptools.ShellEscapeList(shard), " ")).
|
||||||
FlagWithOutput(">> ", filepath).
|
FlagWithOutput(">> ", filepath).
|
||||||
Text("; done")
|
Text("; done")
|
||||||
rule.Build(pctx, ctx, filename, "gen "+filename)
|
rule.Build(filename, "gen "+filename)
|
||||||
|
|
||||||
if index+1 != len(moduleShards) {
|
if index+1 != len(moduleShards) {
|
||||||
filename, filepath = s.incrementFile(ctx, cleanedName, part+index+1)
|
filename, filepath = s.incrementFile(ctx, cleanedName, part+index+1)
|
||||||
rule = android.NewRuleBuilder()
|
rule = android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().Textf("rm -f %s", filepath.String())
|
rule.Command().Textf("rm -f %s", filepath.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,14 +121,14 @@ func (s *cflagArtifactsText) GenCFlagArtifacts(ctx android.SingletonContext) {
|
|||||||
for _, flag := range TrackedCFlags {
|
for _, flag := range TrackedCFlags {
|
||||||
// Generate build rule to combine related intermediary files into a
|
// Generate build rule to combine related intermediary files into a
|
||||||
// C Flag artifact
|
// C Flag artifact
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
filename := s.genFlagFilename(flag)
|
filename := s.genFlagFilename(flag)
|
||||||
outputpath := android.PathForOutput(ctx, "cflags", filename)
|
outputpath := android.PathForOutput(ctx, "cflags", filename)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Text("cat").
|
Text("cat").
|
||||||
Inputs(s.interOutputs[flag].Paths()).
|
Inputs(s.interOutputs[flag].Paths()).
|
||||||
FlagWithOutput("> ", outputpath)
|
FlagWithOutput("> ", outputpath)
|
||||||
rule.Build(pctx, ctx, filename, "gen "+filename)
|
rule.Build(filename, "gen "+filename)
|
||||||
s.outputs = append(s.outputs, outputpath)
|
s.outputs = append(s.outputs, outputpath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
cc/fuzz.go
24
cc/fuzz.go
@@ -246,25 +246,25 @@ func (fuzz *fuzzBinary) install(ctx ModuleContext, file android.Path) {
|
|||||||
fuzz.binaryDecorator.baseInstaller.install(ctx, file)
|
fuzz.binaryDecorator.baseInstaller.install(ctx, file)
|
||||||
|
|
||||||
fuzz.corpus = android.PathsForModuleSrc(ctx, fuzz.Properties.Corpus)
|
fuzz.corpus = android.PathsForModuleSrc(ctx, fuzz.Properties.Corpus)
|
||||||
builder := android.NewRuleBuilder()
|
builder := android.NewRuleBuilder(pctx, ctx)
|
||||||
intermediateDir := android.PathForModuleOut(ctx, "corpus")
|
intermediateDir := android.PathForModuleOut(ctx, "corpus")
|
||||||
for _, entry := range fuzz.corpus {
|
for _, entry := range fuzz.corpus {
|
||||||
builder.Command().Text("cp").
|
builder.Command().Text("cp").
|
||||||
Input(entry).
|
Input(entry).
|
||||||
Output(intermediateDir.Join(ctx, entry.Base()))
|
Output(intermediateDir.Join(ctx, entry.Base()))
|
||||||
}
|
}
|
||||||
builder.Build(pctx, ctx, "copy_corpus", "copy corpus")
|
builder.Build("copy_corpus", "copy corpus")
|
||||||
fuzz.corpusIntermediateDir = intermediateDir
|
fuzz.corpusIntermediateDir = intermediateDir
|
||||||
|
|
||||||
fuzz.data = android.PathsForModuleSrc(ctx, fuzz.Properties.Data)
|
fuzz.data = android.PathsForModuleSrc(ctx, fuzz.Properties.Data)
|
||||||
builder = android.NewRuleBuilder()
|
builder = android.NewRuleBuilder(pctx, ctx)
|
||||||
intermediateDir = android.PathForModuleOut(ctx, "data")
|
intermediateDir = android.PathForModuleOut(ctx, "data")
|
||||||
for _, entry := range fuzz.data {
|
for _, entry := range fuzz.data {
|
||||||
builder.Command().Text("cp").
|
builder.Command().Text("cp").
|
||||||
Input(entry).
|
Input(entry).
|
||||||
Output(intermediateDir.Join(ctx, entry.Rel()))
|
Output(intermediateDir.Join(ctx, entry.Rel()))
|
||||||
}
|
}
|
||||||
builder.Build(pctx, ctx, "copy_data", "copy data")
|
builder.Build("copy_data", "copy data")
|
||||||
fuzz.dataIntermediateDir = intermediateDir
|
fuzz.dataIntermediateDir = intermediateDir
|
||||||
|
|
||||||
if fuzz.Properties.Dictionary != nil {
|
if fuzz.Properties.Dictionary != nil {
|
||||||
@@ -419,12 +419,12 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
sharedLibraries := collectAllSharedDependencies(ctx, module)
|
sharedLibraries := collectAllSharedDependencies(ctx, module)
|
||||||
|
|
||||||
var files []fileToZip
|
var files []fileToZip
|
||||||
builder := android.NewRuleBuilder()
|
builder := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
// Package the corpora into a zipfile.
|
// Package the corpora into a zipfile.
|
||||||
if fuzzModule.corpus != nil {
|
if fuzzModule.corpus != nil {
|
||||||
corpusZip := archDir.Join(ctx, module.Name()+"_seed_corpus.zip")
|
corpusZip := archDir.Join(ctx, module.Name()+"_seed_corpus.zip")
|
||||||
command := builder.Command().BuiltTool(ctx, "soong_zip").
|
command := builder.Command().BuiltTool("soong_zip").
|
||||||
Flag("-j").
|
Flag("-j").
|
||||||
FlagWithOutput("-o ", corpusZip)
|
FlagWithOutput("-o ", corpusZip)
|
||||||
command.FlagWithRspFileInputList("-r ", fuzzModule.corpus)
|
command.FlagWithRspFileInputList("-r ", fuzzModule.corpus)
|
||||||
@@ -434,7 +434,7 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
// Package the data into a zipfile.
|
// Package the data into a zipfile.
|
||||||
if fuzzModule.data != nil {
|
if fuzzModule.data != nil {
|
||||||
dataZip := archDir.Join(ctx, module.Name()+"_data.zip")
|
dataZip := archDir.Join(ctx, module.Name()+"_data.zip")
|
||||||
command := builder.Command().BuiltTool(ctx, "soong_zip").
|
command := builder.Command().BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", dataZip)
|
FlagWithOutput("-o ", dataZip)
|
||||||
for _, f := range fuzzModule.data {
|
for _, f := range fuzzModule.data {
|
||||||
intermediateDir := strings.TrimSuffix(f.String(), f.Rel())
|
intermediateDir := strings.TrimSuffix(f.String(), f.Rel())
|
||||||
@@ -492,7 +492,7 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fuzzZip := archDir.Join(ctx, module.Name()+".zip")
|
fuzzZip := archDir.Join(ctx, module.Name()+".zip")
|
||||||
command := builder.Command().BuiltTool(ctx, "soong_zip").
|
command := builder.Command().BuiltTool("soong_zip").
|
||||||
Flag("-j").
|
Flag("-j").
|
||||||
FlagWithOutput("-o ", fuzzZip)
|
FlagWithOutput("-o ", fuzzZip)
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
@@ -504,7 +504,7 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
command.FlagWithInput("-f ", file.SourceFilePath)
|
command.FlagWithInput("-f ", file.SourceFilePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.Build(pctx, ctx, "create-"+fuzzZip.String(),
|
builder.Build("create-"+fuzzZip.String(),
|
||||||
"Package "+module.Name()+" for "+archString+"-"+hostOrTargetString)
|
"Package "+module.Name()+" for "+archString+"-"+hostOrTargetString)
|
||||||
|
|
||||||
// Don't add modules to 'make haiku' that are set to not be exported to the
|
// Don't add modules to 'make haiku' that are set to not be exported to the
|
||||||
@@ -531,11 +531,11 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
filesToZip := archDirs[archOs]
|
filesToZip := archDirs[archOs]
|
||||||
arch := archOs.arch
|
arch := archOs.arch
|
||||||
hostOrTarget := archOs.hostOrTarget
|
hostOrTarget := archOs.hostOrTarget
|
||||||
builder := android.NewRuleBuilder()
|
builder := android.NewRuleBuilder(pctx, ctx)
|
||||||
outputFile := android.PathForOutput(ctx, "fuzz-"+hostOrTarget+"-"+arch+".zip")
|
outputFile := android.PathForOutput(ctx, "fuzz-"+hostOrTarget+"-"+arch+".zip")
|
||||||
s.packages = append(s.packages, outputFile)
|
s.packages = append(s.packages, outputFile)
|
||||||
|
|
||||||
command := builder.Command().BuiltTool(ctx, "soong_zip").
|
command := builder.Command().BuiltTool("soong_zip").
|
||||||
Flag("-j").
|
Flag("-j").
|
||||||
FlagWithOutput("-o ", outputFile).
|
FlagWithOutput("-o ", outputFile).
|
||||||
Flag("-L 0") // No need to try and re-compress the zipfiles.
|
Flag("-L 0") // No need to try and re-compress the zipfiles.
|
||||||
@@ -549,7 +549,7 @@ func (s *fuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
command.FlagWithInput("-f ", fileToZip.SourceFilePath)
|
command.FlagWithInput("-f ", fileToZip.SourceFilePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.Build(pctx, ctx, "create-fuzz-package-"+arch+"-"+hostOrTarget,
|
builder.Build("create-fuzz-package-"+arch+"-"+hostOrTarget,
|
||||||
"Create fuzz target packages for "+arch+"-"+hostOrTarget)
|
"Create fuzz target packages for "+arch+"-"+hostOrTarget)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
cc/gen.go
15
cc/gen.go
@@ -75,10 +75,9 @@ func genYacc(ctx android.ModuleContext, rule *android.RuleBuilder, yaccFile andr
|
|||||||
cmd := rule.Command()
|
cmd := rule.Command()
|
||||||
|
|
||||||
// Fix up #line markers to not use the sbox temporary directory
|
// Fix up #line markers to not use the sbox temporary directory
|
||||||
// android.SboxPathForOutput(outDir, outDir) returns the sbox placeholder for the out
|
// android.sboxPathForOutput(outDir, outDir) returns the sbox placeholder for the out
|
||||||
// directory itself, without any filename appended.
|
// directory itself, without any filename appended.
|
||||||
// TODO(ccross): make this cmd.PathForOutput(outDir) instead.
|
sboxOutDir := cmd.PathForOutput(outDir)
|
||||||
sboxOutDir := android.SboxPathForOutput(outDir, outDir)
|
|
||||||
sedCmd := "sed -i.bak 's#" + sboxOutDir + "#" + outDir.String() + "#'"
|
sedCmd := "sed -i.bak 's#" + sboxOutDir + "#" + outDir.String() + "#'"
|
||||||
rule.Command().Text(sedCmd).Input(outFile)
|
rule.Command().Text(sedCmd).Input(outFile)
|
||||||
rule.Command().Text(sedCmd).Input(headerFile)
|
rule.Command().Text(sedCmd).Input(headerFile)
|
||||||
@@ -137,7 +136,7 @@ func genAidl(ctx android.ModuleContext, rule *android.RuleBuilder, aidlFile andr
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := rule.Command()
|
cmd := rule.Command()
|
||||||
cmd.BuiltTool(ctx, "aidl-cpp").
|
cmd.BuiltTool("aidl-cpp").
|
||||||
FlagWithDepFile("-d", depFile).
|
FlagWithDepFile("-d", depFile).
|
||||||
Flag("--ninja").
|
Flag("--ninja").
|
||||||
Flag(aidlFlags).
|
Flag(aidlFlags).
|
||||||
@@ -232,7 +231,7 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
|||||||
var yaccRule_ *android.RuleBuilder
|
var yaccRule_ *android.RuleBuilder
|
||||||
yaccRule := func() *android.RuleBuilder {
|
yaccRule := func() *android.RuleBuilder {
|
||||||
if yaccRule_ == nil {
|
if yaccRule_ == nil {
|
||||||
yaccRule_ = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "yacc"),
|
yaccRule_ = android.NewRuleBuilder(pctx, ctx).Sbox(android.PathForModuleGen(ctx, "yacc"),
|
||||||
android.PathForModuleGen(ctx, "yacc.sbox.textproto"))
|
android.PathForModuleGen(ctx, "yacc.sbox.textproto"))
|
||||||
}
|
}
|
||||||
return yaccRule_
|
return yaccRule_
|
||||||
@@ -262,7 +261,7 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
|||||||
deps = append(deps, headerFile)
|
deps = append(deps, headerFile)
|
||||||
case ".aidl":
|
case ".aidl":
|
||||||
if aidlRule == nil {
|
if aidlRule == nil {
|
||||||
aidlRule = android.NewRuleBuilder().Sbox(android.PathForModuleGen(ctx, "aidl"),
|
aidlRule = android.NewRuleBuilder(pctx, ctx).Sbox(android.PathForModuleGen(ctx, "aidl"),
|
||||||
android.PathForModuleGen(ctx, "aidl.sbox.textproto"))
|
android.PathForModuleGen(ctx, "aidl.sbox.textproto"))
|
||||||
}
|
}
|
||||||
cppFile := android.GenPathWithExt(ctx, "aidl", srcFile, "cpp")
|
cppFile := android.GenPathWithExt(ctx, "aidl", srcFile, "cpp")
|
||||||
@@ -285,11 +284,11 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if aidlRule != nil {
|
if aidlRule != nil {
|
||||||
aidlRule.Build(pctx, ctx, "aidl", "gen aidl")
|
aidlRule.Build("aidl", "gen aidl")
|
||||||
}
|
}
|
||||||
|
|
||||||
if yaccRule_ != nil {
|
if yaccRule_ != nil {
|
||||||
yaccRule_.Build(pctx, ctx, "yacc", "gen yacc")
|
yaccRule_.Build("yacc", "gen yacc")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rsFiles) > 0 {
|
if len(rsFiles) > 0 {
|
||||||
|
@@ -1754,13 +1754,13 @@ func maybeInjectBoringSSLHash(ctx android.ModuleContext, outputFile android.Modu
|
|||||||
hashedOutputfile := outputFile
|
hashedOutputfile := outputFile
|
||||||
outputFile = android.PathForModuleOut(ctx, "unhashed", fileName)
|
outputFile = android.PathForModuleOut(ctx, "unhashed", fileName)
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "bssl_inject_hash").
|
BuiltTool("bssl_inject_hash").
|
||||||
Flag("-sha256").
|
Flag("-sha256").
|
||||||
FlagWithInput("-in-object ", outputFile).
|
FlagWithInput("-in-object ", outputFile).
|
||||||
FlagWithOutput("-o ", hashedOutputfile)
|
FlagWithOutput("-o ", hashedOutputfile)
|
||||||
rule.Build(pctx, ctx, "injectCryptoHash", "inject crypto hash")
|
rule.Build("injectCryptoHash", "inject crypto hash")
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputFile
|
return outputFile
|
||||||
|
@@ -50,11 +50,11 @@ func genProto(ctx android.ModuleContext, protoFile android.Path, flags builderFl
|
|||||||
depFile := ccFile.ReplaceExtension(ctx, "d")
|
depFile := ccFile.ReplaceExtension(ctx, "d")
|
||||||
outputs := android.WritablePaths{ccFile, headerFile}
|
outputs := android.WritablePaths{ccFile, headerFile}
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
android.ProtoRule(ctx, rule, protoFile, flags.proto, protoDeps, outDir, depFile, outputs)
|
android.ProtoRule(rule, protoFile, flags.proto, protoDeps, outDir, depFile, outputs)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "protoc_"+protoFile.Rel(), "protoc "+protoFile.Rel())
|
rule.Build("protoc_"+protoFile.Rel(), "protoc "+protoFile.Rel())
|
||||||
|
|
||||||
return ccFile, headerFile
|
return ccFile, headerFile
|
||||||
}
|
}
|
||||||
|
@@ -1124,7 +1124,7 @@ func (c *snapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
ctx,
|
ctx,
|
||||||
snapshotDir,
|
snapshotDir,
|
||||||
c.name+"-"+ctx.Config().DeviceName()+".zip")
|
c.name+"-"+ctx.Config().DeviceName()+".zip")
|
||||||
zipRule := android.NewRuleBuilder()
|
zipRule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
// filenames in rspfile from FlagWithRspFileInputList might be single-quoted. Remove it with tr
|
// filenames in rspfile from FlagWithRspFileInputList might be single-quoted. Remove it with tr
|
||||||
snapshotOutputList := android.PathForOutput(
|
snapshotOutputList := android.PathForOutput(
|
||||||
@@ -1140,12 +1140,12 @@ func (c *snapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
zipRule.Temporary(snapshotOutputList)
|
zipRule.Temporary(snapshotOutputList)
|
||||||
|
|
||||||
zipRule.Command().
|
zipRule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", zipPath).
|
FlagWithOutput("-o ", zipPath).
|
||||||
FlagWithArg("-C ", android.PathForOutput(ctx, snapshotDir).String()).
|
FlagWithArg("-C ", android.PathForOutput(ctx, snapshotDir).String()).
|
||||||
FlagWithInput("-l ", snapshotOutputList)
|
FlagWithInput("-l ", snapshotOutputList)
|
||||||
|
|
||||||
zipRule.Build(pctx, ctx, zipPath.String(), c.name+" snapshot "+zipPath.String())
|
zipRule.Build(zipPath.String(), c.name+" snapshot "+zipPath.String())
|
||||||
zipRule.DeleteTemporaryFiles()
|
zipRule.DeleteTemporaryFiles()
|
||||||
c.snapshotZipFile = android.OptionalPathForPath(zipPath)
|
c.snapshotZipFile = android.OptionalPathForPath(zipPath)
|
||||||
}
|
}
|
||||||
|
@@ -762,7 +762,7 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
})
|
})
|
||||||
|
|
||||||
zipPath := android.PathForOutput(ctx, snapshotDir, "android-vndk-"+ctx.DeviceConfig().DeviceArch()+".zip")
|
zipPath := android.PathForOutput(ctx, snapshotDir, "android-vndk-"+ctx.DeviceConfig().DeviceArch()+".zip")
|
||||||
zipRule := android.NewRuleBuilder()
|
zipRule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
// filenames in rspfile from FlagWithRspFileInputList might be single-quoted. Remove it with xargs
|
// filenames in rspfile from FlagWithRspFileInputList might be single-quoted. Remove it with xargs
|
||||||
snapshotOutputList := android.PathForOutput(ctx, snapshotDir, "android-vndk-"+ctx.DeviceConfig().DeviceArch()+"_list")
|
snapshotOutputList := android.PathForOutput(ctx, snapshotDir, "android-vndk-"+ctx.DeviceConfig().DeviceArch()+"_list")
|
||||||
@@ -775,12 +775,12 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
zipRule.Temporary(snapshotOutputList)
|
zipRule.Temporary(snapshotOutputList)
|
||||||
|
|
||||||
zipRule.Command().
|
zipRule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", zipPath).
|
FlagWithOutput("-o ", zipPath).
|
||||||
FlagWithArg("-C ", android.PathForOutput(ctx, snapshotDir).String()).
|
FlagWithArg("-C ", android.PathForOutput(ctx, snapshotDir).String()).
|
||||||
FlagWithInput("-l ", snapshotOutputList)
|
FlagWithInput("-l ", snapshotOutputList)
|
||||||
|
|
||||||
zipRule.Build(pctx, ctx, zipPath.String(), "vndk snapshot "+zipPath.String())
|
zipRule.Build(zipPath.String(), "vndk snapshot "+zipPath.String())
|
||||||
zipRule.DeleteTemporaryFiles()
|
zipRule.DeleteTemporaryFiles()
|
||||||
c.vndkSnapshotZipFile = android.OptionalPathForPath(zipPath)
|
c.vndkSnapshotZipFile = android.OptionalPathForPath(zipPath)
|
||||||
}
|
}
|
||||||
|
@@ -51,7 +51,7 @@ var DexpreoptRunningInSoong = false
|
|||||||
|
|
||||||
// GenerateDexpreoptRule generates a set of commands that will preopt a module based on a GlobalConfig and a
|
// GenerateDexpreoptRule generates a set of commands that will preopt a module based on a GlobalConfig and a
|
||||||
// ModuleConfig. The produced files and their install locations will be available through rule.Installs().
|
// ModuleConfig. The produced files and their install locations will be available through rule.Installs().
|
||||||
func GenerateDexpreoptRule(ctx android.PathContext, globalSoong *GlobalSoongConfig,
|
func GenerateDexpreoptRule(ctx android.BuilderContext, globalSoong *GlobalSoongConfig,
|
||||||
global *GlobalConfig, module *ModuleConfig) (rule *android.RuleBuilder, err error) {
|
global *GlobalConfig, module *ModuleConfig) (rule *android.RuleBuilder, err error) {
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
@@ -67,7 +67,7 @@ func GenerateDexpreoptRule(ctx android.PathContext, globalSoong *GlobalSoongConf
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
rule = android.NewRuleBuilder()
|
rule = android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
generateProfile := module.ProfileClassListing.Valid() && !global.DisableGenerateProfile
|
generateProfile := module.ProfileClassListing.Valid() && !global.DisableGenerateProfile
|
||||||
generateBootProfile := module.ProfileBootListing.Valid() && !global.DisableGenerateProfile
|
generateBootProfile := module.ProfileBootListing.Valid() && !global.DisableGenerateProfile
|
||||||
|
@@ -27,6 +27,7 @@ import (
|
|||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/dexpreopt"
|
"android/soong/dexpreopt"
|
||||||
|
|
||||||
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/pathtools"
|
"github.com/google/blueprint/pathtools"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -38,12 +39,16 @@ var (
|
|||||||
outDir = flag.String("out_dir", "", "path to output directory")
|
outDir = flag.String("out_dir", "", "path to output directory")
|
||||||
)
|
)
|
||||||
|
|
||||||
type pathContext struct {
|
type builderContext struct {
|
||||||
config android.Config
|
config android.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *pathContext) Config() android.Config { return x.config }
|
func (x *builderContext) Config() android.Config { return x.config }
|
||||||
func (x *pathContext) AddNinjaFileDeps(...string) {}
|
func (x *builderContext) AddNinjaFileDeps(...string) {}
|
||||||
|
func (x *builderContext) Build(android.PackageContext, android.BuildParams) {}
|
||||||
|
func (x *builderContext) Rule(android.PackageContext, string, blueprint.RuleParams, ...string) blueprint.Rule {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@@ -76,7 +81,7 @@ func main() {
|
|||||||
usage("--module configuration file is required")
|
usage("--module configuration file is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := &pathContext{android.NullConfig(*outDir)}
|
ctx := &builderContext{android.NullConfig(*outDir)}
|
||||||
|
|
||||||
globalSoongConfigData, err := ioutil.ReadFile(*globalSoongConfigPath)
|
globalSoongConfigData, err := ioutil.ReadFile(*globalSoongConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -133,7 +138,7 @@ func main() {
|
|||||||
writeScripts(ctx, globalSoongConfig, globalConfig, moduleConfig, *dexpreoptScriptPath)
|
writeScripts(ctx, globalSoongConfig, globalConfig, moduleConfig, *dexpreoptScriptPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeScripts(ctx android.PathContext, globalSoong *dexpreopt.GlobalSoongConfig,
|
func writeScripts(ctx android.BuilderContext, globalSoong *dexpreopt.GlobalSoongConfig,
|
||||||
global *dexpreopt.GlobalConfig, module *dexpreopt.ModuleConfig, dexpreoptScriptPath string) {
|
global *dexpreopt.GlobalConfig, module *dexpreopt.ModuleConfig, dexpreoptScriptPath string) {
|
||||||
dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(ctx, globalSoong, global, module)
|
dexpreoptRule, err := dexpreopt.GenerateDexpreoptRule(ctx, globalSoong, global, module)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -60,7 +60,7 @@ func testModuleConfig(ctx android.PathContext, name, partition string) *ModuleCo
|
|||||||
|
|
||||||
func TestDexPreopt(t *testing.T) {
|
func TestDexPreopt(t *testing.T) {
|
||||||
config := android.TestConfig("out", nil, "", nil)
|
config := android.TestConfig("out", nil, "", nil)
|
||||||
ctx := android.PathContextForTesting(config)
|
ctx := android.BuilderContextForTesting(config)
|
||||||
globalSoong := GlobalSoongConfigForTests(config)
|
globalSoong := GlobalSoongConfigForTests(config)
|
||||||
global := GlobalConfigForTests(ctx)
|
global := GlobalConfigForTests(ctx)
|
||||||
module := testSystemModuleConfig(ctx, "test")
|
module := testSystemModuleConfig(ctx, "test")
|
||||||
@@ -82,7 +82,7 @@ func TestDexPreopt(t *testing.T) {
|
|||||||
|
|
||||||
func TestDexPreoptSystemOther(t *testing.T) {
|
func TestDexPreoptSystemOther(t *testing.T) {
|
||||||
config := android.TestConfig("out", nil, "", nil)
|
config := android.TestConfig("out", nil, "", nil)
|
||||||
ctx := android.PathContextForTesting(config)
|
ctx := android.BuilderContextForTesting(config)
|
||||||
globalSoong := GlobalSoongConfigForTests(config)
|
globalSoong := GlobalSoongConfigForTests(config)
|
||||||
global := GlobalConfigForTests(ctx)
|
global := GlobalConfigForTests(ctx)
|
||||||
systemModule := testSystemModuleConfig(ctx, "Stest")
|
systemModule := testSystemModuleConfig(ctx, "Stest")
|
||||||
@@ -142,7 +142,7 @@ func TestDexPreoptSystemOther(t *testing.T) {
|
|||||||
|
|
||||||
func TestDexPreoptProfile(t *testing.T) {
|
func TestDexPreoptProfile(t *testing.T) {
|
||||||
config := android.TestConfig("out", nil, "", nil)
|
config := android.TestConfig("out", nil, "", nil)
|
||||||
ctx := android.PathContextForTesting(config)
|
ctx := android.BuilderContextForTesting(config)
|
||||||
globalSoong := GlobalSoongConfigForTests(config)
|
globalSoong := GlobalSoongConfigForTests(config)
|
||||||
global := GlobalConfigForTests(ctx)
|
global := GlobalConfigForTests(ctx)
|
||||||
module := testSystemModuleConfig(ctx, "test")
|
module := testSystemModuleConfig(ctx, "test")
|
||||||
|
@@ -63,9 +63,9 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
f.CopyDepsToZip(ctx, zipFile)
|
f.CopyDepsToZip(ctx, zipFile)
|
||||||
|
|
||||||
rootDir := android.PathForModuleOut(ctx, "root").OutputPath
|
rootDir := android.PathForModuleOut(ctx, "root").OutputPath
|
||||||
builder := android.NewRuleBuilder()
|
builder := android.NewRuleBuilder(pctx, ctx)
|
||||||
builder.Command().
|
builder.Command().
|
||||||
BuiltTool(ctx, "zipsync").
|
BuiltTool("zipsync").
|
||||||
FlagWithArg("-d ", rootDir.String()). // zipsync wipes this. No need to clear.
|
FlagWithArg("-d ", rootDir.String()). // zipsync wipes this. No need to clear.
|
||||||
Input(zipFile)
|
Input(zipFile)
|
||||||
|
|
||||||
@@ -81,14 +81,14 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Implicit(mkuserimg)
|
Implicit(mkuserimg)
|
||||||
|
|
||||||
f.output = android.PathForModuleOut(ctx, "filesystem.img").OutputPath
|
f.output = android.PathForModuleOut(ctx, "filesystem.img").OutputPath
|
||||||
builder.Command().BuiltTool(ctx, "build_image").
|
builder.Command().BuiltTool("build_image").
|
||||||
Text(rootDir.String()). // input directory
|
Text(rootDir.String()). // input directory
|
||||||
Input(propFile).
|
Input(propFile).
|
||||||
Output(f.output).
|
Output(f.output).
|
||||||
Text(rootDir.String()) // directory where to find fs_config_files|dirs
|
Text(rootDir.String()) // directory where to find fs_config_files|dirs
|
||||||
|
|
||||||
// rootDir is not deleted. Might be useful for quick inspection.
|
// rootDir is not deleted. Might be useful for quick inspection.
|
||||||
builder.Build(pctx, ctx, "build_filesystem_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName()))
|
builder.Build("build_filesystem_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName()))
|
||||||
|
|
||||||
f.installDir = android.PathForModuleInstall(ctx, "etc")
|
f.installDir = android.PathForModuleInstall(ctx, "etc")
|
||||||
ctx.InstallFile(f.installDir, f.installFileName(), f.output)
|
ctx.InstallFile(f.installDir, f.installFileName(), f.output)
|
||||||
|
@@ -342,8 +342,27 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pick a unique path outside the task.genDir for the sbox manifest textproto,
|
||||||
|
// a unique rule name, and the user-visible description.
|
||||||
|
manifestName := "genrule.sbox.textproto"
|
||||||
|
desc := "generate"
|
||||||
|
name := "generator"
|
||||||
|
if task.shards > 0 {
|
||||||
|
manifestName = "genrule_" + strconv.Itoa(task.shard) + ".sbox.textproto"
|
||||||
|
desc += " " + strconv.Itoa(task.shard)
|
||||||
|
name += strconv.Itoa(task.shard)
|
||||||
|
} else if len(task.out) == 1 {
|
||||||
|
desc += " " + task.out[0].Base()
|
||||||
|
}
|
||||||
|
|
||||||
|
manifestPath := android.PathForModuleOut(ctx, manifestName)
|
||||||
|
|
||||||
|
// Use a RuleBuilder to create a rule that runs the command inside an sbox sandbox.
|
||||||
|
rule := android.NewRuleBuilder(pctx, ctx).Sbox(task.genDir, manifestPath)
|
||||||
|
cmd := rule.Command()
|
||||||
|
|
||||||
for _, out := range task.out {
|
for _, out := range task.out {
|
||||||
addLocationLabel(out.Rel(), []string{android.SboxPathForOutput(out, task.genDir)})
|
addLocationLabel(out.Rel(), []string{cmd.PathForOutput(out)})
|
||||||
}
|
}
|
||||||
|
|
||||||
referencedDepfile := false
|
referencedDepfile := false
|
||||||
@@ -374,7 +393,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
case "out":
|
case "out":
|
||||||
var sandboxOuts []string
|
var sandboxOuts []string
|
||||||
for _, out := range task.out {
|
for _, out := range task.out {
|
||||||
sandboxOuts = append(sandboxOuts, android.SboxPathForOutput(out, task.genDir))
|
sandboxOuts = append(sandboxOuts, cmd.PathForOutput(out))
|
||||||
}
|
}
|
||||||
return strings.Join(sandboxOuts, " "), nil
|
return strings.Join(sandboxOuts, " "), nil
|
||||||
case "depfile":
|
case "depfile":
|
||||||
@@ -384,7 +403,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
return "__SBOX_DEPFILE__", nil
|
return "__SBOX_DEPFILE__", nil
|
||||||
case "genDir":
|
case "genDir":
|
||||||
return android.SboxPathForOutput(task.genDir, task.genDir), nil
|
return cmd.PathForOutput(task.genDir), nil
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(name, "location ") {
|
if strings.HasPrefix(name, "location ") {
|
||||||
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
||||||
@@ -426,24 +445,6 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
g.rawCommands = append(g.rawCommands, rawCommand)
|
g.rawCommands = append(g.rawCommands, rawCommand)
|
||||||
|
|
||||||
// Pick a unique path outside the task.genDir for the sbox manifest textproto,
|
|
||||||
// a unique rule name, and the user-visible description.
|
|
||||||
manifestName := "genrule.sbox.textproto"
|
|
||||||
desc := "generate"
|
|
||||||
name := "generator"
|
|
||||||
if task.shards > 0 {
|
|
||||||
manifestName = "genrule_" + strconv.Itoa(task.shard) + ".sbox.textproto"
|
|
||||||
desc += " " + strconv.Itoa(task.shard)
|
|
||||||
name += strconv.Itoa(task.shard)
|
|
||||||
} else if len(task.out) == 1 {
|
|
||||||
desc += " " + task.out[0].Base()
|
|
||||||
}
|
|
||||||
|
|
||||||
manifestPath := android.PathForModuleOut(ctx, manifestName)
|
|
||||||
|
|
||||||
// Use a RuleBuilder to create a rule that runs the command inside an sbox sandbox.
|
|
||||||
rule := android.NewRuleBuilder().Sbox(task.genDir, manifestPath)
|
|
||||||
cmd := rule.Command()
|
|
||||||
cmd.Text(rawCommand)
|
cmd.Text(rawCommand)
|
||||||
cmd.ImplicitOutputs(task.out)
|
cmd.ImplicitOutputs(task.out)
|
||||||
cmd.Implicits(task.in)
|
cmd.Implicits(task.in)
|
||||||
@@ -454,7 +455,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the rule to run the genrule command inside sbox.
|
// Create the rule to run the genrule command inside sbox.
|
||||||
rule.Build(pctx, ctx, name, desc)
|
rule.Build(name, desc)
|
||||||
|
|
||||||
if len(task.copyTo) > 0 {
|
if len(task.copyTo) > 0 {
|
||||||
// If copyTo is set, multiple shards need to be copied into a single directory.
|
// If copyTo is set, multiple shards need to be copied into a single directory.
|
||||||
@@ -612,6 +613,10 @@ func NewGenSrcs() *Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
genDir := android.PathForModuleGen(ctx, genSubDir)
|
genDir := android.PathForModuleGen(ctx, genSubDir)
|
||||||
|
// TODO(ccross): this RuleBuilder is a hack to be able to call
|
||||||
|
// rule.Command().PathForOutput. Replace this with passing the rule into the
|
||||||
|
// generator.
|
||||||
|
rule := android.NewRuleBuilder(pctx, ctx).Sbox(genDir, nil)
|
||||||
|
|
||||||
for _, in := range shard {
|
for _, in := range shard {
|
||||||
outFile := android.GenPathWithExt(ctx, finalSubDir, in, String(properties.Output_extension))
|
outFile := android.GenPathWithExt(ctx, finalSubDir, in, String(properties.Output_extension))
|
||||||
@@ -634,11 +639,11 @@ func NewGenSrcs() *Module {
|
|||||||
case "in":
|
case "in":
|
||||||
return in.String(), nil
|
return in.String(), nil
|
||||||
case "out":
|
case "out":
|
||||||
return android.SboxPathForOutput(outFile, genDir), nil
|
return rule.Command().PathForOutput(outFile), nil
|
||||||
case "depfile":
|
case "depfile":
|
||||||
// Generate a depfile for each output file. Store the list for
|
// Generate a depfile for each output file. Store the list for
|
||||||
// later in order to combine them all into a single depfile.
|
// later in order to combine them all into a single depfile.
|
||||||
depFile := android.SboxPathForOutput(outFile.ReplaceExtension(ctx, "d"), genDir)
|
depFile := rule.Command().PathForOutput(outFile.ReplaceExtension(ctx, "d"))
|
||||||
commandDepFiles = append(commandDepFiles, depFile)
|
commandDepFiles = append(commandDepFiles, depFile)
|
||||||
return depFile, nil
|
return depFile, nil
|
||||||
default:
|
default:
|
||||||
|
28
java/app.go
28
java/app.go
@@ -1115,8 +1115,8 @@ func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig androi
|
|||||||
}
|
}
|
||||||
|
|
||||||
fixedConfig := android.PathForModuleOut(ctx, "test_config_fixer", "AndroidTest.xml")
|
fixedConfig := android.PathForModuleOut(ctx, "test_config_fixer", "AndroidTest.xml")
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
command := rule.Command().BuiltTool(ctx, "test_config_fixer").Input(testConfig).Output(fixedConfig)
|
command := rule.Command().BuiltTool("test_config_fixer").Input(testConfig).Output(fixedConfig)
|
||||||
fixNeeded := false
|
fixNeeded := false
|
||||||
|
|
||||||
if ctx.ModuleName() != a.installApkName {
|
if ctx.ModuleName() != a.installApkName {
|
||||||
@@ -1131,7 +1131,7 @@ func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig androi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if fixNeeded {
|
if fixNeeded {
|
||||||
rule.Build(pctx, ctx, "fix_test_config", "fix test config")
|
rule.Build("fix_test_config", "fix test config")
|
||||||
return fixedConfig
|
return fixedConfig
|
||||||
}
|
}
|
||||||
return testConfig
|
return testConfig
|
||||||
@@ -1440,15 +1440,15 @@ func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Textf(`if (zipinfo %s 'lib/*.so' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then`, inputPath).
|
Textf(`if (zipinfo %s 'lib/*.so' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then`, inputPath).
|
||||||
BuiltTool(ctx, "zip2zip").
|
BuiltTool("zip2zip").
|
||||||
FlagWithInput("-i ", inputPath).
|
FlagWithInput("-i ", inputPath).
|
||||||
FlagWithOutput("-o ", outputPath).
|
FlagWithOutput("-o ", outputPath).
|
||||||
FlagWithArg("-0 ", "'lib/**/*.so'").
|
FlagWithArg("-0 ", "'lib/**/*.so'").
|
||||||
Textf(`; else cp -f %s %s; fi`, inputPath, outputPath)
|
Textf(`; else cp -f %s %s; fi`, inputPath, outputPath)
|
||||||
rule.Build(pctx, ctx, "uncompress-embedded-jni-libs", "Uncompress embedded JIN libs")
|
rule.Build("uncompress-embedded-jni-libs", "Uncompress embedded JIN libs")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether this module should have the dex file stored uncompressed in the APK.
|
// Returns whether this module should have the dex file stored uncompressed in the APK.
|
||||||
@@ -1467,15 +1467,15 @@ func (a *AndroidAppImport) shouldUncompressDex(ctx android.ModuleContext) bool {
|
|||||||
|
|
||||||
func (a *AndroidAppImport) uncompressDex(
|
func (a *AndroidAppImport) uncompressDex(
|
||||||
ctx android.ModuleContext, inputPath android.Path, outputPath android.OutputPath) {
|
ctx android.ModuleContext, inputPath android.Path, outputPath android.OutputPath) {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Textf(`if (zipinfo %s '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then`, inputPath).
|
Textf(`if (zipinfo %s '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then`, inputPath).
|
||||||
BuiltTool(ctx, "zip2zip").
|
BuiltTool("zip2zip").
|
||||||
FlagWithInput("-i ", inputPath).
|
FlagWithInput("-i ", inputPath).
|
||||||
FlagWithOutput("-o ", outputPath).
|
FlagWithOutput("-o ", outputPath).
|
||||||
FlagWithArg("-0 ", "'classes*.dex'").
|
FlagWithArg("-0 ", "'classes*.dex'").
|
||||||
Textf(`; else cp -f %s %s; fi`, inputPath, outputPath)
|
Textf(`; else cp -f %s %s; fi`, inputPath, outputPath)
|
||||||
rule.Build(pctx, ctx, "uncompress-dex", "Uncompress dex files")
|
rule.Build("uncompress-dex", "Uncompress dex files")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
@@ -2015,8 +2015,8 @@ func (u *usesLibrary) freezeEnforceUsesLibraries() {
|
|||||||
func (u *usesLibrary) verifyUsesLibrariesManifest(ctx android.ModuleContext, manifest android.Path) android.Path {
|
func (u *usesLibrary) verifyUsesLibrariesManifest(ctx android.ModuleContext, manifest android.Path) android.Path {
|
||||||
outputFile := android.PathForModuleOut(ctx, "manifest_check", "AndroidManifest.xml")
|
outputFile := android.PathForModuleOut(ctx, "manifest_check", "AndroidManifest.xml")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
cmd := rule.Command().BuiltTool(ctx, "manifest_check").
|
cmd := rule.Command().BuiltTool("manifest_check").
|
||||||
Flag("--enforce-uses-libraries").
|
Flag("--enforce-uses-libraries").
|
||||||
Input(manifest).
|
Input(manifest).
|
||||||
FlagWithOutput("-o ", outputFile)
|
FlagWithOutput("-o ", outputFile)
|
||||||
@@ -2029,7 +2029,7 @@ func (u *usesLibrary) verifyUsesLibrariesManifest(ctx android.ModuleContext, man
|
|||||||
cmd.FlagWithArg("--optional-uses-library ", lib)
|
cmd.FlagWithArg("--optional-uses-library ", lib)
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "verify_uses_libraries", "verify <uses-library>")
|
rule.Build("verify_uses_libraries", "verify <uses-library>")
|
||||||
|
|
||||||
return outputFile
|
return outputFile
|
||||||
}
|
}
|
||||||
@@ -2039,7 +2039,7 @@ func (u *usesLibrary) verifyUsesLibrariesManifest(ctx android.ModuleContext, man
|
|||||||
func (u *usesLibrary) verifyUsesLibrariesAPK(ctx android.ModuleContext, apk android.Path) android.Path {
|
func (u *usesLibrary) verifyUsesLibrariesAPK(ctx android.ModuleContext, apk android.Path) android.Path {
|
||||||
outputFile := android.PathForModuleOut(ctx, "verify_uses_libraries", apk.Base())
|
outputFile := android.PathForModuleOut(ctx, "verify_uses_libraries", apk.Base())
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
aapt := ctx.Config().HostToolPath(ctx, "aapt")
|
aapt := ctx.Config().HostToolPath(ctx, "aapt")
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Textf("aapt_binary=%s", aapt.String()).Implicit(aapt).
|
Textf("aapt_binary=%s", aapt.String()).Implicit(aapt).
|
||||||
@@ -2048,7 +2048,7 @@ func (u *usesLibrary) verifyUsesLibrariesAPK(ctx android.ModuleContext, apk andr
|
|||||||
Tool(android.PathForSource(ctx, "build/make/core/verify_uses_libraries.sh")).Input(apk)
|
Tool(android.PathForSource(ctx, "build/make/core/verify_uses_libraries.sh")).Input(apk)
|
||||||
rule.Command().Text("cp -f").Input(apk).Output(outputFile)
|
rule.Command().Text("cp -f").Input(apk).Output(outputFile)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "verify_uses_libraries", "verify <uses-library>")
|
rule.Build("verify_uses_libraries", "verify <uses-library>")
|
||||||
|
|
||||||
return outputFile
|
return outputFile
|
||||||
}
|
}
|
||||||
|
@@ -85,8 +85,8 @@ func (b *bootJarsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
|
|
||||||
timestamp := android.PathForOutput(ctx, "boot-jars-package-check/stamp")
|
timestamp := android.PathForOutput(ctx, "boot-jars-package-check/stamp")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
checkBootJars := rule.Command().BuiltTool(ctx, "check_boot_jars").
|
checkBootJars := rule.Command().BuiltTool("check_boot_jars").
|
||||||
Input(ctx.Config().HostToolPath(ctx, "dexdump")).
|
Input(ctx.Config().HostToolPath(ctx, "dexdump")).
|
||||||
Input(android.PathForSource(ctx, "build/soong/scripts/check_boot_jars/package_allowed_list.txt"))
|
Input(android.PathForSource(ctx, "build/soong/scripts/check_boot_jars/package_allowed_list.txt"))
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ func (b *bootJarsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkBootJars.Text("&& touch").Output(timestamp)
|
checkBootJars.Text("&& touch").Output(timestamp)
|
||||||
rule.Build(pctx, ctx, "boot_jars_package_check", "check boot jar packages")
|
rule.Build("boot_jars_package_check", "check boot jar packages")
|
||||||
|
|
||||||
// The check-boot-jars phony target depends on the timestamp created if the check succeeds.
|
// The check-boot-jars phony target depends on the timestamp created if the check succeeds.
|
||||||
ctx.Phony("check-boot-jars", timestamp)
|
ctx.Phony("check-boot-jars", timestamp)
|
||||||
|
@@ -216,7 +216,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
|
|||||||
return dexJarFile
|
return dexJarFile
|
||||||
}
|
}
|
||||||
|
|
||||||
dexpreoptRule.Build(pctx, ctx, "dexpreopt", "dexpreopt")
|
dexpreoptRule.Build("dexpreopt", "dexpreopt")
|
||||||
|
|
||||||
d.builtInstalled = dexpreoptRule.Installs().String()
|
d.builtInstalled = dexpreoptRule.Installs().String()
|
||||||
|
|
||||||
|
@@ -539,14 +539,14 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig) *bootI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if image.zip != nil {
|
if image.zip != nil {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", image.zip).
|
FlagWithOutput("-o ", image.zip).
|
||||||
FlagWithArg("-C ", image.dir.Join(ctx, android.Android.String()).String()).
|
FlagWithArg("-C ", image.dir.Join(ctx, android.Android.String()).String()).
|
||||||
FlagWithInputList("-f ", zipFiles, " -f ")
|
FlagWithInputList("-f ", zipFiles, " -f ")
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "zip_"+image.name, "zip "+image.name+" image")
|
rule.Build("zip_"+image.name, "zip "+image.name+" image")
|
||||||
}
|
}
|
||||||
|
|
||||||
return image
|
return image
|
||||||
@@ -568,7 +568,7 @@ func buildBootImageVariant(ctx android.SingletonContext, image *bootImageVariant
|
|||||||
oatLocation := dexpreopt.PathToLocation(outputPath, arch)
|
oatLocation := dexpreopt.PathToLocation(outputPath, arch)
|
||||||
imagePath := outputPath.ReplaceExtension(ctx, "art")
|
imagePath := outputPath.ReplaceExtension(ctx, "art")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.MissingDeps(missingDeps)
|
rule.MissingDeps(missingDeps)
|
||||||
|
|
||||||
rule.Command().Text("mkdir").Flag("-p").Flag(symbolsDir.String())
|
rule.Command().Text("mkdir").Flag("-p").Flag(symbolsDir.String())
|
||||||
@@ -689,7 +689,7 @@ func buildBootImageVariant(ctx android.SingletonContext, image *bootImageVariant
|
|||||||
android.RuleBuilderInstall{unstrippedOat, filepath.Join(installDir, unstrippedOat.Base())})
|
android.RuleBuilderInstall{unstrippedOat, filepath.Join(installDir, unstrippedOat.Base())})
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.Build(pctx, ctx, image.name+"JarsDexpreopt_"+image.target.String(), "dexpreopt "+image.name+" jars "+arch.String())
|
rule.Build(image.name+"JarsDexpreopt_"+image.target.String(), "dexpreopt "+image.name+" jars "+arch.String())
|
||||||
|
|
||||||
// save output and installed files for makevars
|
// save output and installed files for makevars
|
||||||
image.installs = rule.Installs()
|
image.installs = rule.Installs()
|
||||||
@@ -713,7 +713,7 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImageConfig,
|
|||||||
profile := ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
|
profile := ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
|
||||||
defaultProfile := "frameworks/base/config/boot-image-profile.txt"
|
defaultProfile := "frameworks/base/config/boot-image-profile.txt"
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.MissingDeps(missingDeps)
|
rule.MissingDeps(missingDeps)
|
||||||
|
|
||||||
var bootImageProfile android.Path
|
var bootImageProfile android.Path
|
||||||
@@ -744,7 +744,7 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImageConfig,
|
|||||||
|
|
||||||
rule.Install(profile, "/system/etc/boot-image.prof")
|
rule.Install(profile, "/system/etc/boot-image.prof")
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "bootJarsProfile", "profile boot jars")
|
rule.Build("bootJarsProfile", "profile boot jars")
|
||||||
|
|
||||||
image.profileInstalls = rule.Installs()
|
image.profileInstalls = rule.Installs()
|
||||||
|
|
||||||
@@ -766,7 +766,7 @@ func bootFrameworkProfileRule(ctx android.SingletonContext, image *bootImageConf
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return ctx.Config().Once(bootFrameworkProfileRuleKey, func() interface{} {
|
return ctx.Config().Once(bootFrameworkProfileRuleKey, func() interface{} {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.MissingDeps(missingDeps)
|
rule.MissingDeps(missingDeps)
|
||||||
|
|
||||||
// Some branches like master-art-host don't have frameworks/base, so manually
|
// Some branches like master-art-host don't have frameworks/base, so manually
|
||||||
@@ -794,7 +794,7 @@ func bootFrameworkProfileRule(ctx android.SingletonContext, image *bootImageConf
|
|||||||
FlagWithOutput("--reference-profile-file=", profile)
|
FlagWithOutput("--reference-profile-file=", profile)
|
||||||
|
|
||||||
rule.Install(profile, "/system/etc/boot-image.bprof")
|
rule.Install(profile, "/system/etc/boot-image.bprof")
|
||||||
rule.Build(pctx, ctx, "bootFrameworkProfile", "profile boot framework jars")
|
rule.Build("bootFrameworkProfile", "profile boot framework jars")
|
||||||
image.profileInstalls = append(image.profileInstalls, rule.Installs()...)
|
image.profileInstalls = append(image.profileInstalls, rule.Installs()...)
|
||||||
|
|
||||||
return profile
|
return profile
|
||||||
@@ -839,7 +839,7 @@ func updatableBcpPackagesRule(ctx android.SingletonContext, image *bootImageConf
|
|||||||
// WriteFileRule automatically adds the last end-of-line.
|
// WriteFileRule automatically adds the last end-of-line.
|
||||||
android.WriteFileRule(ctx, updatableBcpPackages, strings.Join(updatablePackages, "\n"))
|
android.WriteFileRule(ctx, updatableBcpPackages, strings.Join(updatablePackages, "\n"))
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.MissingDeps(missingDeps)
|
rule.MissingDeps(missingDeps)
|
||||||
rule.Install(updatableBcpPackages, "/system/etc/"+updatableBcpPackagesName)
|
rule.Install(updatableBcpPackages, "/system/etc/"+updatableBcpPackagesName)
|
||||||
// TODO: Rename `profileInstalls` to `extraInstalls`?
|
// TODO: Rename `profileInstalls` to `extraInstalls`?
|
||||||
@@ -863,25 +863,25 @@ func dumpOatRules(ctx android.SingletonContext, image *bootImageConfig) {
|
|||||||
}
|
}
|
||||||
// Create a rule to call oatdump.
|
// Create a rule to call oatdump.
|
||||||
output := android.PathForOutput(ctx, "boot."+suffix+".oatdump.txt")
|
output := android.PathForOutput(ctx, "boot."+suffix+".oatdump.txt")
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
// TODO: for now, use the debug version for better error reporting
|
// TODO: for now, use the debug version for better error reporting
|
||||||
BuiltTool(ctx, "oatdumpd").
|
BuiltTool("oatdumpd").
|
||||||
FlagWithInputList("--runtime-arg -Xbootclasspath:", image.dexPathsDeps.Paths(), ":").
|
FlagWithInputList("--runtime-arg -Xbootclasspath:", image.dexPathsDeps.Paths(), ":").
|
||||||
FlagWithList("--runtime-arg -Xbootclasspath-locations:", image.dexLocationsDeps, ":").
|
FlagWithList("--runtime-arg -Xbootclasspath-locations:", image.dexLocationsDeps, ":").
|
||||||
FlagWithArg("--image=", strings.Join(image.imageLocations(), ":")).Implicits(image.imagesDeps.Paths()).
|
FlagWithArg("--image=", strings.Join(image.imageLocations(), ":")).Implicits(image.imagesDeps.Paths()).
|
||||||
FlagWithOutput("--output=", output).
|
FlagWithOutput("--output=", output).
|
||||||
FlagWithArg("--instruction-set=", arch.String())
|
FlagWithArg("--instruction-set=", arch.String())
|
||||||
rule.Build(pctx, ctx, "dump-oat-boot-"+suffix, "dump oat boot "+arch.String())
|
rule.Build("dump-oat-boot-"+suffix, "dump oat boot "+arch.String())
|
||||||
|
|
||||||
// Create a phony rule that depends on the output file and prints the path.
|
// Create a phony rule that depends on the output file and prints the path.
|
||||||
phony := android.PathForPhony(ctx, "dump-oat-boot-"+suffix)
|
phony := android.PathForPhony(ctx, "dump-oat-boot-"+suffix)
|
||||||
rule = android.NewRuleBuilder()
|
rule = android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Implicit(output).
|
Implicit(output).
|
||||||
ImplicitOutput(phony).
|
ImplicitOutput(phony).
|
||||||
Text("echo").FlagWithArg("Output in ", output.String())
|
Text("echo").FlagWithArg("Output in ", output.String())
|
||||||
rule.Build(pctx, ctx, "phony-dump-oat-boot-"+suffix, "dump oat boot "+arch.String())
|
rule.Build("phony-dump-oat-boot-"+suffix, "dump oat boot "+arch.String())
|
||||||
|
|
||||||
allPhonies = append(allPhonies, phony)
|
allPhonies = append(allPhonies, phony)
|
||||||
}
|
}
|
||||||
|
@@ -671,7 +671,7 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
j.stubsSrcJar = nil
|
j.stubsSrcJar = nil
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().Text("rm -rf").Text(outDir.String())
|
rule.Command().Text("rm -rf").Text(outDir.String())
|
||||||
rule.Command().Text("mkdir -p").Text(outDir.String())
|
rule.Command().Text("mkdir -p").Text(outDir.String())
|
||||||
@@ -689,7 +689,7 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Flag("-Xdoclint:none")
|
Flag("-Xdoclint:none")
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
Flag("-write_if_changed").
|
Flag("-write_if_changed").
|
||||||
Flag("-d").
|
Flag("-d").
|
||||||
FlagWithOutput("-o ", j.docZip).
|
FlagWithOutput("-o ", j.docZip).
|
||||||
@@ -700,7 +700,7 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
zipSyncCleanupCmd(rule, srcJarDir)
|
zipSyncCleanupCmd(rule, srcJarDir)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "javadoc", "javadoc")
|
rule.Build("javadoc", "javadoc")
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -845,7 +845,7 @@ func javadocCmd(ctx android.ModuleContext, rule *android.RuleBuilder, srcs andro
|
|||||||
outDir, srcJarDir, srcJarList android.Path, sourcepaths android.Paths) *android.RuleBuilderCommand {
|
outDir, srcJarDir, srcJarList android.Path, sourcepaths android.Paths) *android.RuleBuilderCommand {
|
||||||
|
|
||||||
cmd := rule.Command().
|
cmd := rule.Command().
|
||||||
BuiltTool(ctx, "soong_javac_wrapper").Tool(config.JavadocCmd(ctx)).
|
BuiltTool("soong_javac_wrapper").Tool(config.JavadocCmd(ctx)).
|
||||||
Flag(config.JavacVmFlags).
|
Flag(config.JavacVmFlags).
|
||||||
FlagWithArg("-encoding ", "UTF-8").
|
FlagWithArg("-encoding ", "UTF-8").
|
||||||
FlagWithRspFileInputList("@", srcs).
|
FlagWithRspFileInputList("@", srcs).
|
||||||
@@ -914,7 +914,7 @@ func dokkaCmd(ctx android.ModuleContext, rule *android.RuleBuilder,
|
|||||||
dokkaClasspath := append(bootclasspath.Paths(), classpath.Paths()...)
|
dokkaClasspath := append(bootclasspath.Paths(), classpath.Paths()...)
|
||||||
|
|
||||||
return rule.Command().
|
return rule.Command().
|
||||||
BuiltTool(ctx, "dokka").
|
BuiltTool("dokka").
|
||||||
Flag(config.JavacVmFlags).
|
Flag(config.JavacVmFlags).
|
||||||
Flag(srcJarDir.String()).
|
Flag(srcJarDir.String()).
|
||||||
FlagWithInputList("-classpath ", dokkaClasspath, ":").
|
FlagWithInputList("-classpath ", dokkaClasspath, ":").
|
||||||
@@ -934,7 +934,7 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
outDir := android.PathForModuleOut(ctx, "out")
|
outDir := android.PathForModuleOut(ctx, "out")
|
||||||
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
srcJarList := zipSyncCmd(ctx, rule, srcJarDir, d.Javadoc.srcJars)
|
srcJarList := zipSyncCmd(ctx, rule, srcJarDir, d.Javadoc.srcJars)
|
||||||
|
|
||||||
@@ -968,7 +968,7 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
Flag("-write_if_changed").
|
Flag("-write_if_changed").
|
||||||
Flag("-d").
|
Flag("-d").
|
||||||
FlagWithOutput("-o ", d.docZip).
|
FlagWithOutput("-o ", d.docZip).
|
||||||
@@ -979,7 +979,7 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
zipSyncCleanupCmd(rule, srcJarDir)
|
zipSyncCleanupCmd(rule, srcJarDir)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "javadoc", desc)
|
rule.Build("javadoc", desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1278,7 +1278,7 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
|
|||||||
}).NoVarTemplate(ctx.Config()))
|
}).NoVarTemplate(ctx.Config()))
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.BuiltTool(ctx, "metalava").
|
cmd.BuiltTool("metalava").
|
||||||
Flag(config.JavacVmFlags).
|
Flag(config.JavacVmFlags).
|
||||||
Flag("-J--add-opens=java.base/java.util=ALL-UNNAMED").
|
Flag("-J--add-opens=java.base/java.util=ALL-UNNAMED").
|
||||||
FlagWithArg("-encoding ", "UTF-8").
|
FlagWithArg("-encoding ", "UTF-8").
|
||||||
@@ -1333,7 +1333,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
srcJarDir := android.PathForModuleOut(ctx, "srcjars")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
if BoolDefault(d.properties.High_mem, false) {
|
if BoolDefault(d.properties.High_mem, false) {
|
||||||
// This metalava run uses lots of memory, restrict the number of metalava jobs that can run in parallel.
|
// This metalava run uses lots of memory, restrict the number of metalava jobs that can run in parallel.
|
||||||
@@ -1480,19 +1480,19 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
cmd.FlagWithArg("--error-message:compatibility:released ", msg)
|
cmd.FlagWithArg("--error-message:compatibility:released ", msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
impRule := android.NewRuleBuilder()
|
impRule := android.NewRuleBuilder(pctx, ctx)
|
||||||
impCmd := impRule.Command()
|
impCmd := impRule.Command()
|
||||||
// An action that copies the ninja generated rsp file to a new location. This allows us to
|
// An action that copies the ninja generated rsp file to a new location. This allows us to
|
||||||
// add a large number of inputs to a file without exceeding bash command length limits (which
|
// add a large number of inputs to a file without exceeding bash command length limits (which
|
||||||
// would happen if we use the WriteFile rule). The cp is needed because RuleBuilder sets the
|
// would happen if we use the WriteFile rule). The cp is needed because RuleBuilder sets the
|
||||||
// rsp file to be ${output}.rsp.
|
// rsp file to be ${output}.rsp.
|
||||||
impCmd.Text("cp").FlagWithRspFileInputList("", cmd.GetImplicits()).Output(implicitsRsp)
|
impCmd.Text("cp").FlagWithRspFileInputList("", cmd.GetImplicits()).Output(implicitsRsp)
|
||||||
impRule.Build(pctx, ctx, "implicitsGen", "implicits generation")
|
impRule.Build("implicitsGen", "implicits generation")
|
||||||
cmd.Implicit(implicitsRsp)
|
cmd.Implicit(implicitsRsp)
|
||||||
|
|
||||||
if generateStubs {
|
if generateStubs {
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
Flag("-write_if_changed").
|
Flag("-write_if_changed").
|
||||||
Flag("-jar").
|
Flag("-jar").
|
||||||
FlagWithOutput("-o ", d.Javadoc.stubsSrcJar).
|
FlagWithOutput("-o ", d.Javadoc.stubsSrcJar).
|
||||||
@@ -1503,7 +1503,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
if Bool(d.properties.Write_sdk_values) {
|
if Bool(d.properties.Write_sdk_values) {
|
||||||
d.metadataZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"-metadata.zip")
|
d.metadataZip = android.PathForModuleOut(ctx, ctx.ModuleName()+"-metadata.zip")
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
Flag("-write_if_changed").
|
Flag("-write_if_changed").
|
||||||
Flag("-d").
|
Flag("-d").
|
||||||
FlagWithOutput("-o ", d.metadataZip).
|
FlagWithOutput("-o ", d.metadataZip).
|
||||||
@@ -1524,7 +1524,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
zipSyncCleanupCmd(rule, srcJarDir)
|
zipSyncCleanupCmd(rule, srcJarDir)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "metalava", "metalava merged")
|
rule.Build("metalava", "metalava merged")
|
||||||
|
|
||||||
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") {
|
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") {
|
||||||
|
|
||||||
@@ -1542,7 +1542,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
d.checkCurrentApiTimestamp = android.PathForModuleOut(ctx, "check_current_api.timestamp")
|
d.checkCurrentApiTimestamp = android.PathForModuleOut(ctx, "check_current_api.timestamp")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
// Diff command line.
|
// Diff command line.
|
||||||
// -F matches the closest "opening" line, such as "package android {"
|
// -F matches the closest "opening" line, such as "package android {"
|
||||||
@@ -1576,12 +1576,12 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Text("; exit 38").
|
Text("; exit 38").
|
||||||
Text(")")
|
Text(")")
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "metalavaCurrentApiCheck", "check current API")
|
rule.Build("metalavaCurrentApiCheck", "check current API")
|
||||||
|
|
||||||
d.updateCurrentApiTimestamp = android.PathForModuleOut(ctx, "update_current_api.timestamp")
|
d.updateCurrentApiTimestamp = android.PathForModuleOut(ctx, "update_current_api.timestamp")
|
||||||
|
|
||||||
// update API rule
|
// update API rule
|
||||||
rule = android.NewRuleBuilder()
|
rule = android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().Text("( true")
|
rule.Command().Text("( true")
|
||||||
|
|
||||||
@@ -1602,7 +1602,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Text("; exit 38").
|
Text("; exit 38").
|
||||||
Text(")")
|
Text(")")
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "metalavaCurrentApiUpdate", "update current API")
|
rule.Build("metalavaCurrentApiUpdate", "update current API")
|
||||||
}
|
}
|
||||||
|
|
||||||
if String(d.properties.Check_nullability_warnings) != "" {
|
if String(d.properties.Check_nullability_warnings) != "" {
|
||||||
@@ -1625,7 +1625,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
` and submitting the updated file as part of your change.`,
|
` and submitting the updated file as part of your change.`,
|
||||||
d.nullabilityWarningsFile, checkNullabilityWarnings)
|
d.nullabilityWarningsFile, checkNullabilityWarnings)
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Text("(").
|
Text("(").
|
||||||
@@ -1637,7 +1637,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
Text("; exit 38").
|
Text("; exit 38").
|
||||||
Text(")")
|
Text(")")
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "nullabilityWarningsCheck", "nullability warnings check")
|
rule.Build("nullabilityWarningsCheck", "nullability warnings check")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1722,7 +1722,7 @@ func zipSyncCmd(ctx android.ModuleContext, rule *android.RuleBuilder,
|
|||||||
|
|
||||||
rule.Temporary(srcJarList)
|
rule.Temporary(srcJarList)
|
||||||
|
|
||||||
rule.Command().BuiltTool(ctx, "zipsync").
|
rule.Command().BuiltTool("zipsync").
|
||||||
FlagWithArg("-d ", srcJarDir.String()).
|
FlagWithArg("-d ", srcJarDir.String()).
|
||||||
FlagWithOutput("-l ", srcJarList).
|
FlagWithOutput("-l ", srcJarList).
|
||||||
FlagWithArg("-f ", `"*.java"`).
|
FlagWithArg("-f ", `"*.java"`).
|
||||||
@@ -1783,9 +1783,9 @@ func (p *PrebuiltStubsSources) GenerateAndroidBuildActions(ctx android.ModuleCon
|
|||||||
srcGlob := localSrcDir + "/**/*"
|
srcGlob := localSrcDir + "/**/*"
|
||||||
srcPaths := android.PathsForModuleSrc(ctx, []string{srcGlob})
|
srcPaths := android.PathsForModuleSrc(ctx, []string{srcGlob})
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
Flag("-write_if_changed").
|
Flag("-write_if_changed").
|
||||||
Flag("-jar").
|
Flag("-jar").
|
||||||
FlagWithOutput("-o ", p.stubsSrcJar).
|
FlagWithOutput("-o ", p.stubsSrcJar).
|
||||||
@@ -1794,7 +1794,7 @@ func (p *PrebuiltStubsSources) GenerateAndroidBuildActions(ctx android.ModuleCon
|
|||||||
|
|
||||||
rule.Restat()
|
rule.Restat()
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "zip src", "Create srcjar from prebuilt source")
|
rule.Build("zip src", "Create srcjar from prebuilt source")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PrebuiltStubsSources) Prebuilt() *android.Prebuilt {
|
func (p *PrebuiltStubsSources) Prebuilt() *android.Prebuilt {
|
||||||
|
@@ -57,7 +57,7 @@ func genAidl(ctx android.ModuleContext, aidlFiles android.Paths, aidlFlags strin
|
|||||||
|
|
||||||
outDir := srcJarFile.ReplaceExtension(ctx, "tmp")
|
outDir := srcJarFile.ReplaceExtension(ctx, "tmp")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().Text("rm -rf").Flag(outDir.String())
|
rule.Command().Text("rm -rf").Flag(outDir.String())
|
||||||
rule.Command().Text("mkdir -p").Flag(outDir.String())
|
rule.Command().Text("mkdir -p").Flag(outDir.String())
|
||||||
@@ -98,7 +98,7 @@ func genAidl(ctx android.ModuleContext, aidlFiles android.Paths, aidlFlags strin
|
|||||||
ruleDesc += " " + strconv.Itoa(i)
|
ruleDesc += " " + strconv.Itoa(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.Build(pctx, ctx, ruleName, ruleDesc)
|
rule.Build(ruleName, ruleDesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
return srcJarFiles
|
return srcJarFiles
|
||||||
|
@@ -135,12 +135,12 @@ func (h *hiddenAPI) hiddenAPIGenerateCSV(ctx android.ModuleContext, flagsCSV, me
|
|||||||
})
|
})
|
||||||
h.metadataCSVPath = metadataCSV
|
h.metadataCSVPath = metadataCSV
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "merge_csv").
|
BuiltTool("merge_csv").
|
||||||
FlagWithInput("--zip_input=", classesJar).
|
FlagWithInput("--zip_input=", classesJar).
|
||||||
FlagWithOutput("--output=", indexCSV)
|
FlagWithOutput("--output=", indexCSV)
|
||||||
rule.Build(pctx, ctx, "merged-hiddenapi-index", "Merged Hidden API index")
|
rule.Build("merged-hiddenapi-index", "Merged Hidden API index")
|
||||||
h.indexCSVPath = indexCSV
|
h.indexCSVPath = indexCSV
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -189,7 +189,7 @@ func stubFlagsRule(ctx android.SingletonContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Singleton rule which applies hiddenapi on all boot class path dex files.
|
// Singleton rule which applies hiddenapi on all boot class path dex files.
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
outputPath := hiddenAPISingletonPaths(ctx).stubFlags
|
outputPath := hiddenAPISingletonPaths(ctx).stubFlags
|
||||||
tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp")
|
tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp")
|
||||||
@@ -208,7 +208,7 @@ func stubFlagsRule(ctx android.SingletonContext) {
|
|||||||
|
|
||||||
commitChangeForRestat(rule, tempPath, outputPath)
|
commitChangeForRestat(rule, tempPath, outputPath)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "hiddenAPIStubFlagsFile", "hiddenapi stub flags")
|
rule.Build("hiddenAPIStubFlagsFile", "hiddenapi stub flags")
|
||||||
}
|
}
|
||||||
|
|
||||||
// flagsRule creates a rule to build hiddenapi-flags.csv out of flags.csv files generated for boot image modules and
|
// flagsRule creates a rule to build hiddenapi-flags.csv out of flags.csv files generated for boot image modules and
|
||||||
@@ -236,7 +236,7 @@ func flagsRule(ctx android.SingletonContext) android.Path {
|
|||||||
ctx.Errorf("Failed to find combined-removed-dex.")
|
ctx.Errorf("Failed to find combined-removed-dex.")
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
outputPath := hiddenAPISingletonPaths(ctx).flags
|
outputPath := hiddenAPISingletonPaths(ctx).flags
|
||||||
tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp")
|
tempPath := android.PathForOutput(ctx, outputPath.Rel()+".tmp")
|
||||||
@@ -266,7 +266,7 @@ func flagsRule(ctx android.SingletonContext) android.Path {
|
|||||||
|
|
||||||
commitChangeForRestat(rule, tempPath, outputPath)
|
commitChangeForRestat(rule, tempPath, outputPath)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "hiddenAPIFlagsFile", "hiddenapi flags")
|
rule.Build("hiddenAPIFlagsFile", "hiddenapi flags")
|
||||||
|
|
||||||
return outputPath
|
return outputPath
|
||||||
}
|
}
|
||||||
@@ -274,14 +274,14 @@ func flagsRule(ctx android.SingletonContext) android.Path {
|
|||||||
// emptyFlagsRule creates a rule to build an empty hiddenapi-flags.csv, which is needed by master-art-host builds that
|
// emptyFlagsRule creates a rule to build an empty hiddenapi-flags.csv, which is needed by master-art-host builds that
|
||||||
// have a partial manifest without frameworks/base but still need to build a boot image.
|
// have a partial manifest without frameworks/base but still need to build a boot image.
|
||||||
func emptyFlagsRule(ctx android.SingletonContext) android.Path {
|
func emptyFlagsRule(ctx android.SingletonContext) android.Path {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
outputPath := hiddenAPISingletonPaths(ctx).flags
|
outputPath := hiddenAPISingletonPaths(ctx).flags
|
||||||
|
|
||||||
rule.Command().Text("rm").Flag("-f").Output(outputPath)
|
rule.Command().Text("rm").Flag("-f").Output(outputPath)
|
||||||
rule.Command().Text("touch").Output(outputPath)
|
rule.Command().Text("touch").Output(outputPath)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "emptyHiddenAPIFlagsFile", "empty hiddenapi flags")
|
rule.Build("emptyHiddenAPIFlagsFile", "empty hiddenapi flags")
|
||||||
|
|
||||||
return outputPath
|
return outputPath
|
||||||
}
|
}
|
||||||
@@ -299,16 +299,16 @@ func metadataRule(ctx android.SingletonContext) android.Path {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
outputPath := hiddenAPISingletonPaths(ctx).metadata
|
outputPath := hiddenAPISingletonPaths(ctx).metadata
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "merge_csv").
|
BuiltTool("merge_csv").
|
||||||
FlagWithOutput("--output=", outputPath).
|
FlagWithOutput("--output=", outputPath).
|
||||||
Inputs(metadataCSV)
|
Inputs(metadataCSV)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "hiddenAPIGreylistMetadataFile", "hiddenapi greylist metadata")
|
rule.Build("hiddenAPIGreylistMetadataFile", "hiddenapi greylist metadata")
|
||||||
|
|
||||||
return outputPath
|
return outputPath
|
||||||
}
|
}
|
||||||
@@ -399,13 +399,13 @@ func (h *hiddenAPIIndexSingleton) GenerateBuildActions(ctx android.SingletonCont
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "merge_csv").
|
BuiltTool("merge_csv").
|
||||||
FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties").
|
FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties").
|
||||||
FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index).
|
FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index).
|
||||||
Inputs(indexes)
|
Inputs(indexes)
|
||||||
rule.Build(pctx, ctx, "singleton-merged-hiddenapi-index", "Singleton merged Hidden API index")
|
rule.Build("singleton-merged-hiddenapi-index", "Singleton merged Hidden API index")
|
||||||
|
|
||||||
h.index = hiddenAPISingletonPaths(ctx).index
|
h.index = hiddenAPISingletonPaths(ctx).index
|
||||||
}
|
}
|
||||||
|
@@ -3049,21 +3049,21 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
dexOutputFile := android.PathForModuleOut(ctx, ctx.ModuleName()+".jar")
|
dexOutputFile := android.PathForModuleOut(ctx, ctx.ModuleName()+".jar")
|
||||||
|
|
||||||
if j.dexpreopter.uncompressedDex {
|
if j.dexpreopter.uncompressedDex {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
temporary := android.PathForModuleOut(ctx, ctx.ModuleName()+".jar.unaligned")
|
temporary := android.PathForModuleOut(ctx, ctx.ModuleName()+".jar.unaligned")
|
||||||
rule.Temporary(temporary)
|
rule.Temporary(temporary)
|
||||||
|
|
||||||
// use zip2zip to uncompress classes*.dex files
|
// use zip2zip to uncompress classes*.dex files
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "zip2zip").
|
BuiltTool("zip2zip").
|
||||||
FlagWithInput("-i ", inputJar).
|
FlagWithInput("-i ", inputJar).
|
||||||
FlagWithOutput("-o ", temporary).
|
FlagWithOutput("-o ", temporary).
|
||||||
FlagWithArg("-0 ", "'classes*.dex'")
|
FlagWithArg("-0 ", "'classes*.dex'")
|
||||||
|
|
||||||
// use zipalign to align uncompressed classes*.dex files
|
// use zipalign to align uncompressed classes*.dex files
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "zipalign").
|
BuiltTool("zipalign").
|
||||||
Flag("-f").
|
Flag("-f").
|
||||||
Text("4").
|
Text("4").
|
||||||
Input(temporary).
|
Input(temporary).
|
||||||
@@ -3071,7 +3071,7 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
rule.DeleteTemporaryFiles()
|
rule.DeleteTemporaryFiles()
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "uncompress_dex", "uncompress dex")
|
rule.Build("uncompress_dex", "uncompress dex")
|
||||||
} else {
|
} else {
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: android.Cp,
|
Rule: android.Cp,
|
||||||
|
@@ -63,9 +63,9 @@ func kotlinCommonSrcsList(ctx android.ModuleContext, commonSrcFiles android.Path
|
|||||||
// we can't use the rsp file because it is already being used for srcs.
|
// we can't use the rsp file because it is already being used for srcs.
|
||||||
// Insert a second rule to write out the list of resources to a file.
|
// Insert a second rule to write out the list of resources to a file.
|
||||||
commonSrcsList := android.PathForModuleOut(ctx, "kotlinc_common_srcs.list")
|
commonSrcsList := android.PathForModuleOut(ctx, "kotlinc_common_srcs.list")
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().Text("cp").FlagWithRspFileInputList("", commonSrcFiles).Output(commonSrcsList)
|
rule.Command().Text("cp").FlagWithRspFileInputList("", commonSrcFiles).Output(commonSrcsList)
|
||||||
rule.Build(pctx, ctx, "kotlin_common_srcs_list", "kotlin common_srcs list")
|
rule.Build("kotlin_common_srcs_list", "kotlin common_srcs list")
|
||||||
return android.OptionalPathForPath(commonSrcsList)
|
return android.OptionalPathForPath(commonSrcsList)
|
||||||
}
|
}
|
||||||
return android.OptionalPath{}
|
return android.OptionalPath{}
|
||||||
|
16
java/lint.go
16
java/lint.go
@@ -176,9 +176,9 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext,
|
|||||||
// we can't use the rsp file because it is already being used for srcs.
|
// we can't use the rsp file because it is already being used for srcs.
|
||||||
// Insert a second rule to write out the list of resources to a file.
|
// Insert a second rule to write out the list of resources to a file.
|
||||||
resourcesList = android.PathForModuleOut(ctx, "lint", "resources.list")
|
resourcesList = android.PathForModuleOut(ctx, "lint", "resources.list")
|
||||||
resListRule := android.NewRuleBuilder()
|
resListRule := android.NewRuleBuilder(pctx, ctx)
|
||||||
resListRule.Command().Text("cp").FlagWithRspFileInputList("", l.resources).Output(resourcesList)
|
resListRule.Command().Text("cp").FlagWithRspFileInputList("", l.resources).Output(resourcesList)
|
||||||
resListRule.Build(pctx, ctx, "lint_resources_list", "lint resources list")
|
resListRule.Build("lint_resources_list", "lint resources list")
|
||||||
deps = append(deps, l.resources...)
|
deps = append(deps, l.resources...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext,
|
|||||||
srcJarList := zipSyncCmd(ctx, rule, srcJarDir, l.srcJars)
|
srcJarList := zipSyncCmd(ctx, rule, srcJarDir, l.srcJars)
|
||||||
|
|
||||||
cmd := rule.Command().
|
cmd := rule.Command().
|
||||||
BuiltTool(ctx, "lint-project-xml").
|
BuiltTool("lint-project-xml").
|
||||||
FlagWithOutput("--project_out ", projectXMLPath).
|
FlagWithOutput("--project_out ", projectXMLPath).
|
||||||
FlagWithOutput("--config_out ", configXMLPath).
|
FlagWithOutput("--config_out ", configXMLPath).
|
||||||
FlagWithArg("--name ", ctx.ModuleName())
|
FlagWithArg("--name ", ctx.ModuleName())
|
||||||
@@ -284,7 +284,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
if l.manifest == nil {
|
if l.manifest == nil {
|
||||||
manifest := l.generateManifest(ctx, rule)
|
manifest := l.generateManifest(ctx, rule)
|
||||||
@@ -347,7 +347,7 @@ func (l *linter) lint(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
rule.Command().Text("rm -rf").Flag(cacheDir.String()).Flag(homeDir.String())
|
rule.Command().Text("rm -rf").Flag(cacheDir.String()).Flag(homeDir.String())
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "lint", "lint")
|
rule.Build("lint", "lint")
|
||||||
|
|
||||||
l.outputs = lintOutputs{
|
l.outputs = lintOutputs{
|
||||||
html: html,
|
html: html,
|
||||||
@@ -511,12 +511,12 @@ func lintZip(ctx android.BuilderContext, paths android.Paths, outputPath android
|
|||||||
return paths[i].String() < paths[j].String()
|
return paths[i].String() < paths[j].String()
|
||||||
})
|
})
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().BuiltTool(ctx, "soong_zip").
|
rule.Command().BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", outputPath).
|
FlagWithOutput("-o ", outputPath).
|
||||||
FlagWithArg("-C ", android.PathForIntermediates(ctx).String()).
|
FlagWithArg("-C ", android.PathForIntermediates(ctx).String()).
|
||||||
FlagWithRspFileInputList("-r ", paths)
|
FlagWithRspFileInputList("-r ", paths)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, outputPath.Base(), outputPath.Base())
|
rule.Build(outputPath.Base(), outputPath.Base())
|
||||||
}
|
}
|
||||||
|
@@ -86,15 +86,15 @@ func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.Singlet
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
outputPath := platformCompatConfigPath(ctx)
|
outputPath := platformCompatConfigPath(ctx)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "process-compat-config").
|
BuiltTool("process-compat-config").
|
||||||
FlagForEachInput("--xml ", compatConfigMetadata).
|
FlagForEachInput("--xml ", compatConfigMetadata).
|
||||||
FlagWithOutput("--merged-config ", outputPath)
|
FlagWithOutput("--merged-config ", outputPath)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "merged-compat-config", "Merge compat config")
|
rule.Build("merged-compat-config", "Merge compat config")
|
||||||
|
|
||||||
p.metadata = outputPath
|
p.metadata = outputPath
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ func (p *platformCompatConfigSingleton) MakeVars(ctx android.MakeVarsContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
configFileName := p.Name() + ".xml"
|
configFileName := p.Name() + ".xml"
|
||||||
metadataFileName := p.Name() + "_meta.xml"
|
metadataFileName := p.Name() + "_meta.xml"
|
||||||
@@ -115,13 +115,13 @@ func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleCon
|
|||||||
path := android.PathForModuleSrc(ctx, String(p.properties.Src))
|
path := android.PathForModuleSrc(ctx, String(p.properties.Src))
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "process-compat-config").
|
BuiltTool("process-compat-config").
|
||||||
FlagWithInput("--jar ", path).
|
FlagWithInput("--jar ", path).
|
||||||
FlagWithOutput("--device-config ", p.configFile).
|
FlagWithOutput("--device-config ", p.configFile).
|
||||||
FlagWithOutput("--merged-config ", p.metadataFile)
|
FlagWithOutput("--merged-config ", p.metadataFile)
|
||||||
|
|
||||||
p.installDirPath = android.PathForModuleInstall(ctx, "etc", "compatconfig")
|
p.installDirPath = android.PathForModuleInstall(ctx, "etc", "compatconfig")
|
||||||
rule.Build(pctx, ctx, configFileName, "Extract compat/compat_config.xml and install it")
|
rule.Build(configFileName, "Extract compat/compat_config.xml and install it")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ func genProto(ctx android.ModuleContext, protoFiles android.Paths, flags android
|
|||||||
|
|
||||||
outDir := srcJarFile.ReplaceExtension(ctx, "tmp")
|
outDir := srcJarFile.ReplaceExtension(ctx, "tmp")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().Text("rm -rf").Flag(outDir.String())
|
rule.Command().Text("rm -rf").Flag(outDir.String())
|
||||||
rule.Command().Text("mkdir -p").Flag(outDir.String())
|
rule.Command().Text("mkdir -p").Flag(outDir.String())
|
||||||
@@ -42,13 +42,13 @@ func genProto(ctx android.ModuleContext, protoFiles android.Paths, flags android
|
|||||||
for _, protoFile := range shard {
|
for _, protoFile := range shard {
|
||||||
depFile := srcJarFile.InSameDir(ctx, protoFile.String()+".d")
|
depFile := srcJarFile.InSameDir(ctx, protoFile.String()+".d")
|
||||||
rule.Command().Text("mkdir -p").Flag(filepath.Dir(depFile.String()))
|
rule.Command().Text("mkdir -p").Flag(filepath.Dir(depFile.String()))
|
||||||
android.ProtoRule(ctx, rule, protoFile, flags, flags.Deps, outDir, depFile, nil)
|
android.ProtoRule(rule, protoFile, flags, flags.Deps, outDir, depFile, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proto generated java files have an unknown package name in the path, so package the entire output directory
|
// Proto generated java files have an unknown package name in the path, so package the entire output directory
|
||||||
// into a srcjar.
|
// into a srcjar.
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
Flag("-jar").
|
Flag("-jar").
|
||||||
Flag("-write_if_changed").
|
Flag("-write_if_changed").
|
||||||
FlagWithOutput("-o ", srcJarFile).
|
FlagWithOutput("-o ", srcJarFile).
|
||||||
@@ -66,7 +66,7 @@ func genProto(ctx android.ModuleContext, protoFiles android.Paths, flags android
|
|||||||
ruleDesc += " " + strconv.Itoa(i)
|
ruleDesc += " " + strconv.Itoa(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.Build(pctx, ctx, ruleName, ruleDesc)
|
rule.Build(ruleName, ruleDesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
return srcJarFiles
|
return srcJarFiles
|
||||||
|
@@ -199,7 +199,7 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
|
|
||||||
func generateRoboTestConfig(ctx android.ModuleContext, outputFile android.WritablePath,
|
func generateRoboTestConfig(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||||
instrumentedApp *AndroidApp) {
|
instrumentedApp *AndroidApp) {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
manifest := instrumentedApp.mergedManifestFile
|
manifest := instrumentedApp.mergedManifestFile
|
||||||
resourceApk := instrumentedApp.outputFile
|
resourceApk := instrumentedApp.outputFile
|
||||||
@@ -213,11 +213,11 @@ func generateRoboTestConfig(ctx android.ModuleContext, outputFile android.Writab
|
|||||||
Implicit(manifest).
|
Implicit(manifest).
|
||||||
Implicit(resourceApk)
|
Implicit(resourceApk)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "generate_test_config", "generate test_config.properties")
|
rule.Build("generate_test_config", "generate test_config.properties")
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateSameDirRoboTestConfigJar(ctx android.ModuleContext, outputFile android.ModuleOutPath) {
|
func generateSameDirRoboTestConfigJar(ctx android.ModuleContext, outputFile android.ModuleOutPath) {
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
outputDir := outputFile.InSameDir(ctx)
|
outputDir := outputFile.InSameDir(ctx)
|
||||||
configFile := outputDir.Join(ctx, "com/android/tools/test_config.properties")
|
configFile := outputDir.Join(ctx, "com/android/tools/test_config.properties")
|
||||||
@@ -230,12 +230,12 @@ func generateSameDirRoboTestConfigJar(ctx android.ModuleContext, outputFile andr
|
|||||||
Textf(`echo "android_resource_apk=%s.apk"`, ctx.ModuleName()).
|
Textf(`echo "android_resource_apk=%s.apk"`, ctx.ModuleName()).
|
||||||
Text(") >>").Output(configFile)
|
Text(") >>").Output(configFile)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
FlagWithArg("-C ", outputDir.String()).
|
FlagWithArg("-C ", outputDir.String()).
|
||||||
FlagWithInput("-f ", configFile).
|
FlagWithInput("-f ", configFile).
|
||||||
FlagWithOutput("-o ", outputFile)
|
FlagWithOutput("-o ", outputFile)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "generate_test_config_samedir", "generate test_config.properties")
|
rule.Build("generate_test_config_samedir", "generate test_config.properties")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *robolectricTest) generateRoboSrcJar(ctx android.ModuleContext, outputFile android.WritablePath,
|
func (r *robolectricTest) generateRoboSrcJar(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||||
|
12
java/sdk.go
12
java/sdk.go
@@ -544,7 +544,7 @@ func createSdkFrameworkAidl(ctx android.SingletonContext) {
|
|||||||
|
|
||||||
commitChangeForRestat(rule, tempPath, combinedAidl)
|
commitChangeForRestat(rule, tempPath, combinedAidl)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "framework_aidl", "generate framework.aidl")
|
rule.Build("framework_aidl", "generate framework.aidl")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a version of framework.aidl for the non-updatable part of the platform.
|
// Creates a version of framework.aidl for the non-updatable part of the platform.
|
||||||
@@ -558,7 +558,7 @@ func createNonUpdatableFrameworkAidl(ctx android.SingletonContext) {
|
|||||||
|
|
||||||
commitChangeForRestat(rule, tempPath, combinedAidl)
|
commitChangeForRestat(rule, tempPath, combinedAidl)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "framework_non_updatable_aidl", "generate framework_non_updatable.aidl")
|
rule.Build("framework_non_updatable_aidl", "generate framework_non_updatable.aidl")
|
||||||
}
|
}
|
||||||
|
|
||||||
func createFrameworkAidl(stubsModules []string, path android.OutputPath, ctx android.SingletonContext) *android.RuleBuilder {
|
func createFrameworkAidl(stubsModules []string, path android.OutputPath, ctx android.SingletonContext) *android.RuleBuilder {
|
||||||
@@ -586,7 +586,7 @@ func createFrameworkAidl(stubsModules []string, path android.OutputPath, ctx and
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.MissingDeps(missingDeps)
|
rule.MissingDeps(missingDeps)
|
||||||
|
|
||||||
var aidls android.Paths
|
var aidls android.Paths
|
||||||
@@ -597,7 +597,7 @@ func createFrameworkAidl(stubsModules []string, path android.OutputPath, ctx and
|
|||||||
rule.Command().
|
rule.Command().
|
||||||
Text("rm -f").Output(aidl)
|
Text("rm -f").Output(aidl)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "sdkparcelables").
|
BuiltTool("sdkparcelables").
|
||||||
Input(jar).
|
Input(jar).
|
||||||
Output(aidl)
|
Output(aidl)
|
||||||
|
|
||||||
@@ -632,7 +632,7 @@ func nonUpdatableFrameworkAidlPath(ctx android.PathContext) android.OutputPath {
|
|||||||
func createAPIFingerprint(ctx android.SingletonContext) {
|
func createAPIFingerprint(ctx android.SingletonContext) {
|
||||||
out := ApiFingerprintPath(ctx)
|
out := ApiFingerprintPath(ctx)
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Text("rm -f").Output(out)
|
Text("rm -f").Output(out)
|
||||||
@@ -659,7 +659,7 @@ func createAPIFingerprint(ctx android.SingletonContext) {
|
|||||||
Output(out)
|
Output(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "api_fingerprint", "generate api_fingerprint.txt")
|
rule.Build("api_fingerprint", "generate api_fingerprint.txt")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ApiFingerprintPath(ctx android.PathContext) android.OutputPath {
|
func ApiFingerprintPath(ctx android.PathContext) android.OutputPath {
|
||||||
|
@@ -2176,12 +2176,12 @@ func (module *sdkLibraryXml) GenerateAndroidBuildActions(ctx android.ModuleConte
|
|||||||
xmlContent := fmt.Sprintf(permissionsTemplate, libName, module.implPath(ctx))
|
xmlContent := fmt.Sprintf(permissionsTemplate, libName, module.implPath(ctx))
|
||||||
|
|
||||||
module.outputFilePath = android.PathForModuleOut(ctx, libName+".xml").OutputPath
|
module.outputFilePath = android.PathForModuleOut(ctx, libName+".xml").OutputPath
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Text("/bin/bash -c \"echo -e '" + xmlContent + "'\" > ").
|
Text("/bin/bash -c \"echo -e '" + xmlContent + "'\" > ").
|
||||||
Output(module.outputFilePath)
|
Output(module.outputFilePath)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "java_sdk_xml", "Permission XML")
|
rule.Build("java_sdk_xml", "Permission XML")
|
||||||
|
|
||||||
module.installDirPath = android.PathForModuleInstall(ctx, "etc", module.SubDir())
|
module.installDirPath = android.PathForModuleInstall(ctx, "etc", module.SubDir())
|
||||||
}
|
}
|
||||||
|
@@ -68,13 +68,13 @@ func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
inputFile := android.PathForModuleSrc(ctx, android.String(l.properties.Src))
|
inputFile := android.PathForModuleSrc(ctx, android.String(l.properties.Src))
|
||||||
l.outputFilePath = android.PathForModuleOut(ctx, "linker.config.pb").OutputPath
|
l.outputFilePath = android.PathForModuleOut(ctx, "linker.config.pb").OutputPath
|
||||||
l.installDirPath = android.PathForModuleInstall(ctx, "etc")
|
l.installDirPath = android.PathForModuleInstall(ctx, "etc")
|
||||||
linkerConfigRule := android.NewRuleBuilder()
|
linkerConfigRule := android.NewRuleBuilder(pctx, ctx)
|
||||||
linkerConfigRule.Command().
|
linkerConfigRule.Command().
|
||||||
BuiltTool(ctx, "conv_linker_config").
|
BuiltTool("conv_linker_config").
|
||||||
Flag("proto").
|
Flag("proto").
|
||||||
FlagWithInput("-s ", inputFile).
|
FlagWithInput("-s ", inputFile).
|
||||||
FlagWithOutput("-o ", l.outputFilePath)
|
FlagWithOutput("-o ", l.outputFilePath)
|
||||||
linkerConfigRule.Build(pctx, ctx, "conv_linker_config",
|
linkerConfigRule.Build("conv_linker_config",
|
||||||
"Generate linker config protobuf "+l.outputFilePath.String())
|
"Generate linker config protobuf "+l.outputFilePath.String())
|
||||||
|
|
||||||
if proptools.BoolDefault(l.properties.Installable, true) {
|
if proptools.BoolDefault(l.properties.Installable, true) {
|
||||||
|
@@ -24,17 +24,17 @@ func genProto(ctx android.ModuleContext, protoFile android.Path, flags android.P
|
|||||||
outDir := srcsZipFile.ReplaceExtension(ctx, "tmp")
|
outDir := srcsZipFile.ReplaceExtension(ctx, "tmp")
|
||||||
depFile := srcsZipFile.ReplaceExtension(ctx, "srcszip.d")
|
depFile := srcsZipFile.ReplaceExtension(ctx, "srcszip.d")
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
rule.Command().Text("rm -rf").Flag(outDir.String())
|
rule.Command().Text("rm -rf").Flag(outDir.String())
|
||||||
rule.Command().Text("mkdir -p").Flag(outDir.String())
|
rule.Command().Text("mkdir -p").Flag(outDir.String())
|
||||||
|
|
||||||
android.ProtoRule(ctx, rule, protoFile, flags, flags.Deps, outDir, depFile, nil)
|
android.ProtoRule(rule, protoFile, flags, flags.Deps, outDir, depFile, nil)
|
||||||
|
|
||||||
// Proto generated python files have an unknown package name in the path, so package the entire output directory
|
// Proto generated python files have an unknown package name in the path, so package the entire output directory
|
||||||
// into a srcszip.
|
// into a srcszip.
|
||||||
zipCmd := rule.Command().
|
zipCmd := rule.Command().
|
||||||
BuiltTool(ctx, "soong_zip").
|
BuiltTool("soong_zip").
|
||||||
FlagWithOutput("-o ", srcsZipFile)
|
FlagWithOutput("-o ", srcsZipFile)
|
||||||
if pkgPath != "" {
|
if pkgPath != "" {
|
||||||
zipCmd.FlagWithArg("-P ", pkgPath)
|
zipCmd.FlagWithArg("-P ", pkgPath)
|
||||||
@@ -44,7 +44,7 @@ func genProto(ctx android.ModuleContext, protoFile android.Path, flags android.P
|
|||||||
|
|
||||||
rule.Command().Text("rm -rf").Flag(outDir.String())
|
rule.Command().Text("rm -rf").Flag(outDir.String())
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "protoc_"+protoFile.Rel(), "protoc "+protoFile.Rel())
|
rule.Build("protoc_"+protoFile.Rel(), "protoc "+protoFile.Rel())
|
||||||
|
|
||||||
return srcsZipFile
|
return srcsZipFile
|
||||||
}
|
}
|
||||||
|
@@ -93,7 +93,7 @@ func (proto *protobufDecorator) GenerateSource(ctx ModuleContext, deps PathDeps)
|
|||||||
// stemFile must be first here as the first path in BaseSourceProvider.OutputFiles is the library entry-point.
|
// stemFile must be first here as the first path in BaseSourceProvider.OutputFiles is the library entry-point.
|
||||||
outputs := android.WritablePaths{stemFile}
|
outputs := android.WritablePaths{stemFile}
|
||||||
|
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
for _, protoFile := range protoFiles {
|
for _, protoFile := range protoFiles {
|
||||||
protoName := strings.TrimSuffix(protoFile.Base(), ".proto")
|
protoName := strings.TrimSuffix(protoFile.Base(), ".proto")
|
||||||
protoNames = append(protoNames, protoName)
|
protoNames = append(protoNames, protoName)
|
||||||
@@ -108,7 +108,7 @@ func (proto *protobufDecorator) GenerateSource(ctx ModuleContext, deps PathDeps)
|
|||||||
|
|
||||||
depFile := android.PathForModuleOut(ctx, protoName+".d")
|
depFile := android.PathForModuleOut(ctx, protoName+".d")
|
||||||
|
|
||||||
android.ProtoRule(ctx, rule, protoFile, protoFlags, protoFlags.Deps, outDir, depFile, ruleOutputs)
|
android.ProtoRule(rule, protoFile, protoFlags, protoFlags.Deps, outDir, depFile, ruleOutputs)
|
||||||
outputs = append(outputs, ruleOutputs...)
|
outputs = append(outputs, ruleOutputs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ func (proto *protobufDecorator) GenerateSource(ctx ModuleContext, deps PathDeps)
|
|||||||
Text("printf '" + proto.genModFileContents(ctx, protoNames) + "' >").
|
Text("printf '" + proto.genModFileContents(ctx, protoNames) + "' >").
|
||||||
Output(stemFile)
|
Output(stemFile)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, "protoc_"+ctx.ModuleName(), "protoc "+ctx.ModuleName())
|
rule.Build("protoc_"+ctx.ModuleName(), "protoc "+ctx.ModuleName())
|
||||||
|
|
||||||
proto.BaseSourceProvider.OutputFiles = outputs.Paths()
|
proto.BaseSourceProvider.OutputFiles = outputs.Paths()
|
||||||
|
|
||||||
|
@@ -92,7 +92,7 @@ func (gc *generatedContents) Printfln(format string, args ...interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gf *generatedFile) build(pctx android.PackageContext, ctx android.BuilderContext, implicits android.Paths) {
|
func (gf *generatedFile) build(pctx android.PackageContext, ctx android.BuilderContext, implicits android.Paths) {
|
||||||
rb := android.NewRuleBuilder()
|
rb := android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
content := gf.content.String()
|
content := gf.content.String()
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ func (gf *generatedFile) build(pctx android.PackageContext, ctx android.BuilderC
|
|||||||
Text("| sed 's/\\\\n/\\n/g' >").Output(gf.path)
|
Text("| sed 's/\\\\n/\\n/g' >").Output(gf.path)
|
||||||
rb.Command().
|
rb.Command().
|
||||||
Text("chmod a+x").Output(gf.path)
|
Text("chmod a+x").Output(gf.path)
|
||||||
rb.Build(pctx, ctx, gf.path.Base(), "Build "+gf.path.Base())
|
rb.Build(gf.path.Base(), "Build "+gf.path.Base())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect all the members.
|
// Collect all the members.
|
||||||
|
@@ -247,16 +247,16 @@ func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
m.latestApiFile = android.PathForSource(ctx, ctx.ModuleDir(), "api", baseModuleName+"-latest.txt")
|
m.latestApiFile = android.PathForSource(ctx, ctx.ModuleDir(), "api", baseModuleName+"-latest.txt")
|
||||||
|
|
||||||
// dump API rule
|
// dump API rule
|
||||||
rule := android.NewRuleBuilder()
|
rule := android.NewRuleBuilder(pctx, ctx)
|
||||||
m.dumpedApiFile = android.PathForModuleOut(ctx, "api-dump.txt")
|
m.dumpedApiFile = android.PathForModuleOut(ctx, "api-dump.txt")
|
||||||
rule.Command().
|
rule.Command().
|
||||||
BuiltTool(ctx, "sysprop_api_dump").
|
BuiltTool("sysprop_api_dump").
|
||||||
Output(m.dumpedApiFile).
|
Output(m.dumpedApiFile).
|
||||||
Inputs(android.PathsForModuleSrc(ctx, m.properties.Srcs))
|
Inputs(android.PathsForModuleSrc(ctx, m.properties.Srcs))
|
||||||
rule.Build(pctx, ctx, baseModuleName+"_api_dump", baseModuleName+" api dump")
|
rule.Build(baseModuleName+"_api_dump", baseModuleName+" api dump")
|
||||||
|
|
||||||
// check API rule
|
// check API rule
|
||||||
rule = android.NewRuleBuilder()
|
rule = android.NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
// 1. compares current.txt to api-dump.txt
|
// 1. compares current.txt to api-dump.txt
|
||||||
// current.txt should be identical to api-dump.txt.
|
// current.txt should be identical to api-dump.txt.
|
||||||
@@ -284,7 +284,7 @@ func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Text("( ").
|
Text("( ").
|
||||||
BuiltTool(ctx, "sysprop_api_checker").
|
BuiltTool("sysprop_api_checker").
|
||||||
Input(m.latestApiFile).
|
Input(m.latestApiFile).
|
||||||
Input(m.currentApiFile).
|
Input(m.currentApiFile).
|
||||||
Text(" || ( echo").Flag("-e").
|
Text(" || ( echo").Flag("-e").
|
||||||
@@ -297,7 +297,7 @@ func (m *syspropLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
Text("touch").
|
Text("touch").
|
||||||
Output(m.checkApiFileTimeStamp)
|
Output(m.checkApiFileTimeStamp)
|
||||||
|
|
||||||
rule.Build(pctx, ctx, baseModuleName+"_check_api", baseModuleName+" check api")
|
rule.Build(baseModuleName+"_check_api", baseModuleName+" check api")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *syspropLibrary) AndroidMk() android.AndroidMkData {
|
func (m *syspropLibrary) AndroidMk() android.AndroidMkData {
|
||||||
|
Reference in New Issue
Block a user