aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2022-04-01 22:21:03 +0000
committerSteven Moreland <smoreland@google.com>2022-04-04 20:04:38 +0000
commited0490c75a339a9c997827282a827fe721836e06 (patch)
treec8bfeed9b55bc60bf7da03cad6e58e0eeb96d049
parentaf9ba855fcd66c3b980cff584d3e3c47927588a3 (diff)
downloadaidl-ed0490c75a339a9c997827282a827fe721836e06.tar.gz
Java: require interfaceVersion/hash for ToT vers.
This reqiures source changes, so we need to require it in order to automate API finalization. The reasons for not having this for the development version are mostly from the legacy C++ backend. For minimalism here, the NDK and Rust backends are not considered. Bug: 226954348 Test: build requires interface version and hash on interfaces. Change-Id: I0b350d9cbc4aca62bff6dc268ee7419044fc6d01
-rw-r--r--build/aidl_interface_backends.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/build/aidl_interface_backends.go b/build/aidl_interface_backends.go
index 128eee29..62a167ce 100644
--- a/build/aidl_interface_backends.go
+++ b/build/aidl_interface_backends.go
@@ -81,7 +81,7 @@ func addCppLibrary(mctx android.LoadHookContext, i *aidlInterface, version strin
Lang: lang,
BaseName: i.ModuleBase.Name(),
GenLog: genLog,
- Version: i.versionForAidlGenRule(version),
+ Version: i.versionForInitVersionCompat(version),
GenTrace: genTrace,
Unstable: i.properties.Unstable,
NotFrozen: notFrozen,
@@ -229,7 +229,7 @@ func addJavaLibrary(mctx android.LoadHookContext, i *aidlInterface, version stri
Platform_apis: proptools.Bool(i.properties.Backend.Java.Platform_apis),
Lang: langJava,
BaseName: i.ModuleBase.Name(),
- Version: i.versionForAidlGenRule(version),
+ Version: version,
GenRpc: proptools.Bool(i.properties.Backend.Java.Gen_rpc),
GenTrace: proptools.Bool(i.properties.Gen_trace),
Unstable: i.properties.Unstable,
@@ -280,7 +280,7 @@ func addRustLibrary(mctx android.LoadHookContext, i *aidlInterface, version stri
Min_sdk_version: i.minSdkVersion(langRust),
Lang: langRust,
BaseName: i.ModuleBase.Name(),
- Version: i.versionForAidlGenRule(version),
+ Version: i.versionForInitVersionCompat(version),
Unstable: i.properties.Unstable,
NotFrozen: notFrozen,
Flags: i.flagsForAidlGenRule(version),
@@ -343,7 +343,10 @@ func (i *aidlInterface) srcsForVersion(mctx android.EarlyModuleContext, version
}
}
-func (i *aidlInterface) versionForAidlGenRule(version string) string {
+// For certain backend, avoid a difference between the initial version of a versioned
+// interface and an unversioned interface. This ensures that prebuilts can't prevent
+// an interface from switching from unversioned to versioned.
+func (i *aidlInterface) versionForInitVersionCompat(version string) string {
if !i.hasVersion() {
return ""
}