summaryrefslogtreecommitdiff
path: root/android/defs.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/defs.go')
-rw-r--r--android/defs.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/android/defs.go b/android/defs.go
index 9f3fb1ee6..c4e3b995f 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -102,6 +102,18 @@ var (
Description: "concatenate files to $out",
})
+ // Calculates the hash of a directory and writes to a file.
+ // Note that the directory to calculate the hash is intentionally not listed as an input,
+ // to prevent adding directory as a ninja dependency. Thus, an implicit dependency to a file
+ // is required.
+ WriteDirectoryHash = pctx.AndroidStaticRule("WriteDirectoryHash",
+ blueprint.RuleParams{
+ Command: "rm -f $out && ${calculateDirectoryHash} $dir $out",
+ CommandDeps: []string{"${calculateDirectoryHash}"},
+ Description: "Calculates the hash of a directory and writes to $out",
+ }, "dir",
+ )
+
// Used only when USE_GOMA=true is set, to restrict non-goma jobs to the local parallelism value
localPool = blueprint.NewBuiltinPool("local_pool")
@@ -118,4 +130,6 @@ func init() {
pctx.VariableFunc("RBEWrapper", func(ctx PackageVarContext) string {
return ctx.Config().RBEWrapper()
})
+
+ pctx.HostBinToolVariable("calculateDirectoryHash", "calculate_directory_hash")
}