Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes name conflict in swift generated code #5181

Merged
merged 3 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ Use the template below to make assigning a version number during the release cut
- Description of the change with a link to the pull request ([#0000](https://github.com/mozilla/application-services/pull/0000))

-->

## 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))
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions components/tabs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Guid> {
Ok(Guid::new(val.as_str()))
fn into_custom(val: Self::Builtin) -> uniffi::Result<TabsGuid> {
Ok(TabsGuid::new(val.as_str()))
}

fn from_custom(obj: Self) -> Self::Builtin {
Expand Down
4 changes: 2 additions & 2 deletions components/tabs/src/tabs.udl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Custom]
typedef string Guid;
typedef string TabsGuid;

namespace tabs {

Expand Down Expand Up @@ -95,7 +95,7 @@ interface TabsBridgedEngine {
sequence<string> apply();

[Throws=TabsError]
void set_uploaded(i64 new_timestamp, sequence<Guid> uploaded_ids);
void set_uploaded(i64 new_timestamp, sequence<TabsGuid> uploaded_ids);

[Throws=TabsError]
void sync_finished();
Expand Down