aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-04-25 03:16:16 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-04-25 03:16:16 +0000
commit945d2e841672efc3b6e66018d5082edc5cabbc17 (patch)
treef26fd118bed6b75eb6ed31b3dd876eb6b7888991
parent5ba2eb60e641b76a96e5fab1cc9435e776af3fc3 (diff)
parentd7b758db94de2a6449f5315ec223a9e8b73cdea9 (diff)
downloadaidl-945d2e841672efc3b6e66018d5082edc5cabbc17.tar.gz
Snap for 5503058 from d7b758db94de2a6449f5315ec223a9e8b73cdea9 to qt-release
Change-Id: I8608bc6fcdcd58863e817fc2d864ac852f8ba077
-rw-r--r--aidl.cpp6
-rw-r--r--build/aidl_interface.go43
2 files changed, 46 insertions, 3 deletions
diff --git a/aidl.cpp b/aidl.cpp
index b5f13262..83142710 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -433,6 +433,12 @@ bool parse_preprocessed_file(const IoDelegate& io_delegate, const string& filena
AidlLocation location = AidlLocation(filename, point, point);
if (decl == "parcelable") {
+ // ParcelFileDescriptor is treated as a built-in type, but it's also in the framework.aidl.
+ // So aidl should ignore built-in types in framework.aidl to prevent duplication.
+ // (b/130899491)
+ if (AidlTypenames::IsBuiltinTypename(class_name)) {
+ continue;
+ }
AidlParcelable* doc = new AidlParcelable(
location, new AidlQualifiedName(location, class_name, ""), package, "" /* comments */);
types->AddParcelableType(*doc, filename);
diff --git a/build/aidl_interface.go b/build/aidl_interface.go
index 294d1f5e..89594d23 100644
--- a/build/aidl_interface.go
+++ b/build/aidl_interface.go
@@ -94,6 +94,11 @@ var (
CommandDeps: []string{"${aidlCmd}"},
Description: "AIDL CHECK API: ${new} against ${old}",
}, "old", "new")
+
+ aidlDiffApiRule = pctx.StaticRule("aidlDiffApiRule", blueprint.RuleParams{
+ Command: `diff -r ${old} ${new} && touch ${out}`,
+ Description: "Check equality of ${new} and ${old}",
+ }, "old", "new")
)
func init() {
@@ -416,6 +421,24 @@ func (m *aidlApi) checkCompatibility(ctx android.ModuleContext, oldApiDir androi
return timestampFile
}
+func (m *aidlApi) checkEquality(ctx android.ModuleContext, oldApiDir android.Path, oldApiFiles android.Paths, newApiDir android.Path, newApiFiles android.Paths) android.WritablePath {
+ newVersion := newApiDir.Base()
+ timestampFile := android.PathForModuleOut(ctx, "checkapi_"+newVersion+".timestamp")
+ var allApiFiles android.Paths
+ allApiFiles = append(allApiFiles, oldApiFiles...)
+ allApiFiles = append(allApiFiles, newApiFiles...)
+ ctx.ModuleBuild(pctx, android.ModuleBuildParams{
+ Rule: aidlDiffApiRule,
+ Implicits: allApiFiles,
+ Output: timestampFile,
+ Args: map[string]string{
+ "old": oldApiDir.String(),
+ "new": newApiDir.String(),
+ },
+ })
+ return timestampFile
+}
+
func (m *aidlApi) GenerateAndroidBuildActions(ctx android.ModuleContext) {
currentVersion := m.validateCurrentVersion(ctx)
@@ -436,15 +459,29 @@ func (m *aidlApi) GenerateAndroidBuildActions(ctx android.ModuleContext) {
apiDirs[currentVersion] = currentDumpDir
apiFiles[currentVersion] = currentApiFiles.Paths()
- // Check that version X is backward compatible with version X-1, and that the currentVersion (ToT)
- // is backwards compatible with latest frozen version.
- for i, newVersion := range append(m.properties.Versions, currentVersion) {
+ // Check that version X is backward compatible with version X-1
+ for i, newVersion := range m.properties.Versions {
if i != 0 {
oldVersion := m.properties.Versions[i-1]
checkApiTimestamp := m.checkCompatibility(ctx, apiDirs[oldVersion], apiFiles[oldVersion], apiDirs[newVersion], apiFiles[newVersion])
m.checkApiTimestamps = append(m.checkApiTimestamps, checkApiTimestamp)
}
}
+
+ // ... and that the currentVersion (ToT) is backwards compatible with or
+ // equal to the latest frozen version
+ if len(m.properties.Versions) >= 1 {
+ latestVersion := m.properties.Versions[len(m.properties.Versions)-1]
+ var checkApiTimestamp android.WritablePath
+ if ctx.Config().DefaultAppTargetSdkInt() != android.FutureApiLevel {
+ // If API is frozen, don't allow any change to the API
+ checkApiTimestamp = m.checkEquality(ctx, apiDirs[latestVersion], apiFiles[latestVersion], apiDirs[currentVersion], apiFiles[currentVersion])
+ } else {
+ // If not, allow backwards compatible changes to the API
+ checkApiTimestamp = m.checkCompatibility(ctx, apiDirs[latestVersion], apiFiles[latestVersion], apiDirs[currentVersion], apiFiles[currentVersion])
+ }
+ m.checkApiTimestamps = append(m.checkApiTimestamps, checkApiTimestamp)
+ }
}
func (m *aidlApi) AndroidMk() android.AndroidMkData {