From 914ac9caece18a0fdacbd5920c2cf703051835f3 Mon Sep 17 00:00:00 2001 From: Tarik Eshaq Date: Sat, 15 Oct 2022 11:49:32 -0400 Subject: [PATCH] Fixes name conflict in swift generated code (#5181) * Fixes name conflict in swift generated code * Adds changelog --- CHANGES_UNRELEASED.md | 4 ++++ .../src/main/java/mozilla/appservices/tabs/Guid.kt | 11 +++++++++++ components/tabs/src/lib.rs | 8 ++++---- components/tabs/src/tabs.udl | 4 ++-- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 components/tabs/android/src/main/java/mozilla/appservices/tabs/Guid.kt diff --git a/CHANGES_UNRELEASED.md b/CHANGES_UNRELEASED.md index d139ca14fd..5508024585 100644 --- a/CHANGES_UNRELEASED.md +++ b/CHANGES_UNRELEASED.md @@ -19,6 +19,10 @@ Use the template below to make assigning a version number during the release cut --> +## General +### What's fixed +- Fixed a bug released in 94.3.1. The bug broke firefox-ios builds due to a name conflict. ([#5181](https://github.com/mozilla/application-services/pull/5181)) + ## Nimbus ⛅️🔬🔭 ### What's Changed diff --git a/components/tabs/android/src/main/java/mozilla/appservices/tabs/Guid.kt b/components/tabs/android/src/main/java/mozilla/appservices/tabs/Guid.kt new file mode 100644 index 0000000000..4ef99a6882 --- /dev/null +++ b/components/tabs/android/src/main/java/mozilla/appservices/tabs/Guid.kt @@ -0,0 +1,11 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +@file:Suppress("InvalidPackageDeclaration") +package mozilla.appservices.remotetabs + +// We needed to rename the Rust `TabsGuid` struct to `Guid` in order to circumvent the naming conflict in +// iOS with the Guid exposed in `places.udl`. But that creates a breaking change for the Android code. So we are aliasing +// `TabsGuid` back to `Guid` to prevent a breaking change. +typealias Guid = TabsGuid diff --git a/components/tabs/src/lib.rs b/components/tabs/src/lib.rs index 0a02633924..a7010b71f1 100644 --- a/components/tabs/src/lib.rs +++ b/components/tabs/src/lib.rs @@ -15,12 +15,12 @@ mod sync; uniffi_macros::include_scaffolding!("tabs"); // Our UDL uses a `Guid` type. -use sync_guid::Guid; -impl UniffiCustomTypeConverter for Guid { +use sync_guid::Guid as TabsGuid; +impl UniffiCustomTypeConverter for TabsGuid { type Builtin = String; - fn into_custom(val: Self::Builtin) -> uniffi::Result { - Ok(Guid::new(val.as_str())) + fn into_custom(val: Self::Builtin) -> uniffi::Result { + Ok(TabsGuid::new(val.as_str())) } fn from_custom(obj: Self) -> Self::Builtin { diff --git a/components/tabs/src/tabs.udl b/components/tabs/src/tabs.udl index e411457064..abbe020265 100644 --- a/components/tabs/src/tabs.udl +++ b/components/tabs/src/tabs.udl @@ -1,5 +1,5 @@ [Custom] -typedef string Guid; +typedef string TabsGuid; namespace tabs { @@ -95,7 +95,7 @@ interface TabsBridgedEngine { sequence apply(); [Throws=TabsError] - void set_uploaded(i64 new_timestamp, sequence uploaded_ids); + void set_uploaded(i64 new_timestamp, sequence uploaded_ids); [Throws=TabsError] void sync_finished();