summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2021-03-04 10:00:09 -0800
committer Colin Cross <ccross@android.com> 2021-03-04 10:00:09 -0800
commit00d93b143f3409241cf026be71e56dd696539e16 (patch)
tree629c931310f8686895339f8e1d40d0767f09db07
parent84f3dc1c9d2dd049e796000b329f21cf510b0990 (diff)
Make common dependencies of lint use restat
Use restat for the api_versions.xml and annotations.zip dependencies of lint so that frameworks/base changes don't always result in rerunning lint on every module. Bug: 181681346 Test: m lint-check Change-Id: Ic6a540b41cf79b21441311a8baefe528a3d90d8b
-rw-r--r--android/defs.go9
-rw-r--r--java/lint.go4
2 files changed, 11 insertions, 2 deletions
diff --git a/android/defs.go b/android/defs.go
index 38ecb0505..1a767214c 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -57,6 +57,15 @@ var (
},
"cpFlags")
+ // A copy rule that only updates the output if it changed.
+ CpIfChanged = pctx.AndroidStaticRule("CpIfChanged",
+ blueprint.RuleParams{
+ Command: "if ! cmp -s $in $out; then cp $in $out; fi",
+ Description: "cp if changed $out",
+ Restat: true,
+ },
+ "cpFlags")
+
CpExecutable = pctx.AndroidStaticRule("CpExecutable",
blueprint.RuleParams{
Command: "rm -f $out && cp $cpPreserveSymlinks $cpFlags $in $out && chmod +x $out",
diff --git a/java/lint.go b/java/lint.go
index af83664c6..12e412988 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -437,13 +437,13 @@ func (l *lintSingleton) copyLintDependencies(ctx android.SingletonContext) {
}
ctx.Build(pctx, android.BuildParams{
- Rule: android.Cp,
+ Rule: android.CpIfChanged,
Input: android.OutputFileForModule(ctx, frameworkDocStubs, ".annotations.zip"),
Output: copiedAnnotationsZipPath(ctx),
})
ctx.Build(pctx, android.BuildParams{
- Rule: android.Cp,
+ Rule: android.CpIfChanged,
Input: android.OutputFileForModule(ctx, frameworkDocStubs, ".api_versions.xml"),
Output: copiedAPIVersionsXmlPath(ctx),
})