summaryrefslogtreecommitdiff
path: root/java/hiddenapi_singleton.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-04-12 16:39:39 +0100
committer Paul Duffin <paulduffin@google.com> 2021-04-14 18:54:45 +0100
commit22c743170d304cc19136e25aa4dce4668fbfef71 (patch)
treed749db5033ddc4a926b519c59d9c4e8bc6f0d0df /java/hiddenapi_singleton.go
parent00b2bfdea57286232ac6c7ec36742d95c9d7a04e (diff)
Move handling of prebuilt hiddenapi-index.csv to hiddenapi singleton
This change moves the handling of the prebuilt hiddenapi-index.csv file from the hiddenAPIIndexSingleton and removes that as it no longer needed. Bug: 179354495 Test: verified that the out/soong/hiddenapi/... files are unchanged by this change Change-Id: Iab1b39a57f28caa855c48538aa2230795f2c3271
Diffstat (limited to 'java/hiddenapi_singleton.go')
-rw-r--r--java/hiddenapi_singleton.go42
1 files changed, 12 insertions, 30 deletions
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 6c91a9140..8f3a3baff 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -24,7 +24,6 @@ func init() {
func RegisterHiddenApiSingletonComponents(ctx android.RegistrationContext) {
ctx.RegisterSingletonType("hiddenapi", hiddenAPISingletonFactory)
- ctx.RegisterSingletonType("hiddenapi_index", hiddenAPIIndexSingletonFactory)
}
var PrepareForTestWithHiddenApiBuildComponents = android.FixtureRegisterWithContext(RegisterHiddenApiSingletonComponents)
@@ -138,6 +137,7 @@ func (h *hiddenAPISingleton) GenerateBuildActions(ctx android.SingletonContext)
if ctx.Config().PrebuiltHiddenApiDir(ctx) != "" {
h.flags = prebuiltFlagsRule(ctx)
+ prebuiltIndexRule(ctx)
return
}
@@ -321,6 +321,17 @@ func prebuiltFlagsRule(ctx android.SingletonContext) android.Path {
return outputPath
}
+func prebuiltIndexRule(ctx android.SingletonContext) {
+ outputPath := hiddenAPISingletonPaths(ctx).index
+ inputPath := android.PathForSource(ctx, ctx.Config().PrebuiltHiddenApiDir(ctx), "hiddenapi-index.csv")
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
+ Output: outputPath,
+ Input: inputPath,
+ })
+}
+
// flagsRule is a placeholder that simply returns the location of the file, the generation of the
// ninja rules is done in generateHiddenAPIBuildActions.
func flagsRule(ctx android.SingletonContext) android.Path {
@@ -388,32 +399,3 @@ func commitChangeForRestat(rule *android.RuleBuilder, tempPath, outputPath andro
Text("fi").
Text(")")
}
-
-func hiddenAPIIndexSingletonFactory() android.Singleton {
- return &hiddenAPIIndexSingleton{}
-}
-
-type hiddenAPIIndexSingleton struct {
- index android.Path
-}
-
-func (h *hiddenAPIIndexSingleton) GenerateBuildActions(ctx android.SingletonContext) {
- // Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true
- if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
- return
- }
-
- if ctx.Config().PrebuiltHiddenApiDir(ctx) != "" {
- outputPath := hiddenAPISingletonPaths(ctx).index
- inputPath := android.PathForSource(ctx, ctx.Config().PrebuiltHiddenApiDir(ctx), "hiddenapi-index.csv")
-
- ctx.Build(pctx, android.BuildParams{
- Rule: android.Cp,
- Output: outputPath,
- Input: inputPath,
- })
-
- h.index = outputPath
- return
- }
-}