aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2021-05-20 14:25:34 +0900
committerJiyong Park <jiyong@google.com>2021-05-21 16:40:34 +0900
commite84c68bb75af27388f4c306e688f635118123842 (patch)
tree4df033f99d1f8b2cc08071ca3aeaef0afe30869f
parent9a311cdc8a68cf6e0621cced90c03378cb9b9e14 (diff)
downloadaidl-e84c68bb75af27388f4c306e688f635118123842.tar.gz
Make `m aidl-freeze-api` work again
Bug: 188713899 Test: m aidl-freeze-api Merged-In: I3ebc76a90efb47d8503ee89d508a91dd4b3e5980 Change-Id: I3ebc76a90efb47d8503ee89d508a91dd4b3e5980
-rw-r--r--build/Android.mk18
-rw-r--r--build/aidl_api.go23
-rw-r--r--build/aidl_mapping.go12
3 files changed, 23 insertions, 30 deletions
diff --git a/build/Android.mk b/build/Android.mk
deleted file mode 100644
index e50f7028..00000000
--- a/build/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-.PHONY: aidl-freeze-api
-aidl-freeze-api: $(addsuffix -freeze-api, $(SOONG_ALL_AIDL_INTERFACES))
diff --git a/build/aidl_api.go b/build/aidl_api.go
index 3ce72ae1..60976687 100644
--- a/build/aidl_api.go
+++ b/build/aidl_api.go
@@ -377,3 +377,26 @@ func addApiModule(mctx android.LoadHookContext, i *aidlInterface) string {
})
return apiModule
}
+
+func init() {
+ android.RegisterSingletonType("aidl-freeze-api", freezeApiSingletonFactory)
+}
+
+func freezeApiSingletonFactory() android.Singleton {
+ return &freezeApiSingleton{}
+}
+
+type freezeApiSingleton struct{}
+
+func (f *freezeApiSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ var files android.Paths
+ ctx.VisitAllModules(func(module android.Module) {
+ if !module.Enabled() {
+ return
+ }
+ if m, ok := module.(*aidlApi); ok {
+ files = append(files, m.freezeApiTimestamp)
+ }
+ })
+ ctx.Phony("aidl-freeze-api", files...)
+}
diff --git a/build/aidl_mapping.go b/build/aidl_mapping.go
index b48e61e6..b9194955 100644
--- a/build/aidl_mapping.go
+++ b/build/aidl_mapping.go
@@ -19,7 +19,6 @@ import (
"fmt"
"io"
- "strings"
"github.com/google/blueprint"
)
@@ -35,7 +34,6 @@ var (
func init() {
android.RegisterModuleType("aidl_mapping", aidlMappingFactory)
- android.RegisterMakeVarsProvider(pctx, allAidlInterfacesMakeVars)
}
type aidlMappingProperties struct {
@@ -90,13 +88,3 @@ func (m *aidlMapping) AndroidMk() android.AndroidMkData {
},
}
}
-
-func allAidlInterfacesMakeVars(ctx android.MakeVarsContext) {
- names := []string{}
- ctx.VisitAllModules(func(module android.Module) {
- if ai, ok := module.(*aidlInterface); ok {
- names = append(names, ai.BaseModuleName())
- }
- })
- ctx.Strict("ALL_AIDL_INTERFACES", strings.Join(names, " "))
-}