Add support for packaging rust fuzzers
Test: make haiku-rust
Change-Id: Idd4d836d11e0ae615b59c6648d49348449589787
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 5f89d73..ea45ebd 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -91,7 +91,6 @@
if binary.distFile.Valid() {
ret.DistFiles = android.MakeDefaultDistFiles(binary.distFile.Path())
}
-
ret.Class = "EXECUTABLES"
}
@@ -201,3 +200,36 @@
entries.SetString("LOCAL_MODULE_STEM", stem)
})
}
+
+func (fuzz *fuzzDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
+ ctx.SubAndroidMk(entries, fuzz.binaryDecorator)
+
+ var fuzzFiles []string
+ for _, d := range fuzz.corpus {
+ fuzzFiles = append(fuzzFiles,
+ filepath.Dir(fuzz.corpusIntermediateDir.String())+":corpus/"+d.Base())
+ }
+
+ for _, d := range fuzz.data {
+ fuzzFiles = append(fuzzFiles,
+ filepath.Dir(fuzz.dataIntermediateDir.String())+":data/"+d.Rel())
+ }
+
+ if fuzz.dictionary != nil {
+ fuzzFiles = append(fuzzFiles,
+ filepath.Dir(fuzz.dictionary.String())+":"+fuzz.dictionary.Base())
+ }
+
+ if fuzz.config != nil {
+ fuzzFiles = append(fuzzFiles,
+ filepath.Dir(fuzz.config.String())+":config.json")
+ }
+
+ entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext,
+ entries *android.AndroidMkEntries) {
+ entries.SetBool("LOCAL_IS_FUZZ_TARGET", true)
+ if len(fuzzFiles) > 0 {
+ entries.AddStrings("LOCAL_TEST_DATA", fuzzFiles...)
+ }
+ })
+}