Add genrule to find API file Metalava used to generate annotations
The API file Metalava used to migrate NULLs would be
27.txt(PLATFORM_SDK_VERSION - 1) As tnorbye@ mentioned. So add a genrule to
fetch the API file for annotations.
Test: m -j metalava-api-stubs-docs
Bug: b/78245848
Change-Id: I4194d34a6bb6ab0aeccc0b39e6fbb0885c2d03c3
diff --git a/Android.bp b/Android.bp
index 8248d1b..fdea2fe 100644
--- a/Android.bp
+++ b/Android.bp
@@ -37,6 +37,17 @@
],
}
+genrule {
+ name: "public-api-for-metalava-annotations",
+ srcs: [
+ "*/public/api/android.txt",
+ ],
+ cmd: "cp -f $$(echo $(in) | tr \" \" \"\\n\" | sort -n | tail -2 | head -1) $(genDir)/last-released-api.txt",
+ out: [
+ "last-released-api.txt",
+ ],
+}
+
prebuilt_apis {
name: "prebuilt_apis",
}