Provide generated sources to clippy.
clippy was not being provided generated sources previously, so it would error out on being unable to locate the sources. Test: Clippy no longer errors out on generated sources. Bug: 161748694 Change-Id: I85907327ca40c82a9520e0c0dbd643bfba6b7315
This commit is contained in:
@@ -42,14 +42,14 @@ var (
|
|||||||
_ = pctx.SourcePathVariable("clippyCmd", "${config.RustBin}/clippy-driver")
|
_ = pctx.SourcePathVariable("clippyCmd", "${config.RustBin}/clippy-driver")
|
||||||
clippyDriver = pctx.AndroidStaticRule("clippy",
|
clippyDriver = pctx.AndroidStaticRule("clippy",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
Command: "$clippyCmd " +
|
Command: "$envVars $clippyCmd " +
|
||||||
// Because clippy-driver uses rustc as backend, we need to have some output even during the linting.
|
// Because clippy-driver uses rustc as backend, we need to have some output even during the linting.
|
||||||
// Use the metadata output as it has the smallest footprint.
|
// Use the metadata output as it has the smallest footprint.
|
||||||
"--emit metadata -o $out $in ${libFlags} " +
|
"--emit metadata -o $out $in ${libFlags} " +
|
||||||
"$rustcFlags $clippyFlags",
|
"$rustcFlags $clippyFlags",
|
||||||
CommandDeps: []string{"$clippyCmd"},
|
CommandDeps: []string{"$clippyCmd"},
|
||||||
},
|
},
|
||||||
"rustcFlags", "libFlags", "clippyFlags")
|
"rustcFlags", "libFlags", "clippyFlags", "envVars")
|
||||||
|
|
||||||
zip = pctx.AndroidStaticRule("zip",
|
zip = pctx.AndroidStaticRule("zip",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
@@ -199,25 +199,6 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
|
|||||||
output.coverageFile = gcnoFile
|
output.coverageFile = gcnoFile
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.Clippy {
|
|
||||||
clippyFile := android.PathForModuleOut(ctx, outputFile.Base()+".clippy")
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
|
||||||
Rule: clippyDriver,
|
|
||||||
Description: "clippy " + main.Rel(),
|
|
||||||
Output: clippyFile,
|
|
||||||
ImplicitOutputs: nil,
|
|
||||||
Inputs: inputs,
|
|
||||||
Implicits: implicits,
|
|
||||||
Args: map[string]string{
|
|
||||||
"rustcFlags": strings.Join(rustcFlags, " "),
|
|
||||||
"libFlags": strings.Join(libFlags, " "),
|
|
||||||
"clippyFlags": strings.Join(flags.ClippyFlags, " "),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
// Declare the clippy build as an implicit dependency of the original crate.
|
|
||||||
implicits = append(implicits, clippyFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(deps.SrcDeps) > 0 {
|
if len(deps.SrcDeps) > 0 {
|
||||||
moduleGenDir := android.PathForModuleOut(ctx, "out/")
|
moduleGenDir := android.PathForModuleOut(ctx, "out/")
|
||||||
var outputs android.WritablePaths
|
var outputs android.WritablePaths
|
||||||
@@ -243,6 +224,26 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
|
|||||||
envVars = append(envVars, "OUT_DIR=$$PWD/"+moduleGenDir.String())
|
envVars = append(envVars, "OUT_DIR=$$PWD/"+moduleGenDir.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flags.Clippy {
|
||||||
|
clippyFile := android.PathForModuleOut(ctx, outputFile.Base()+".clippy")
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: clippyDriver,
|
||||||
|
Description: "clippy " + main.Rel(),
|
||||||
|
Output: clippyFile,
|
||||||
|
ImplicitOutputs: nil,
|
||||||
|
Inputs: inputs,
|
||||||
|
Implicits: implicits,
|
||||||
|
Args: map[string]string{
|
||||||
|
"rustcFlags": strings.Join(rustcFlags, " "),
|
||||||
|
"libFlags": strings.Join(libFlags, " "),
|
||||||
|
"clippyFlags": strings.Join(flags.ClippyFlags, " "),
|
||||||
|
"envVars": strings.Join(envVars, " "),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// Declare the clippy build as an implicit dependency of the original crate.
|
||||||
|
implicits = append(implicits, clippyFile)
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: rustc,
|
Rule: rustc,
|
||||||
Description: "rustc " + main.Rel(),
|
Description: "rustc " + main.Rel(),
|
||||||
|
Reference in New Issue
Block a user