From 0d48542497a4e9c7a5ad0cb816bcaa4e922477b9 Mon Sep 17 00:00:00 2001 From: Sammy Khamis Date: Tue, 25 Oct 2022 20:03:22 +0000 Subject: [PATCH] Bug 1791851 - Add tabs as a uniffi component r=teshaq,LougeniaBailey,bdk Differential Revision: https://phabricator.services.mozilla.com/D157979 --- toolkit/components/moz.build | 1 + .../components/generated/README.md | 6 ++++++ .../uniffi-bindgen-gecko-js/components/moz.build | 12 ++++++++++++ .../uniffi-bindgen-gecko-js/mach_commands.py | 3 ++- toolkit/library/rust/shared/lib.rs | 8 ++++++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 toolkit/components/uniffi-bindgen-gecko-js/components/generated/README.md create mode 100644 toolkit/components/uniffi-bindgen-gecko-js/components/moz.build diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index 728f51896190..676e9be1fb6b 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -79,6 +79,7 @@ DIRS += [ "tooltiptext", "typeaheadfind", "uniffi-js", + "uniffi-bindgen-gecko-js/components", "utils", "url-classifier", "urlformatter", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/README.md b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/README.md new file mode 100644 index 000000000000..4e4267acd4a3 --- /dev/null +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/README.md @@ -0,0 +1,6 @@ +This directory is where modules generated by UniFFI will be created. + +All files in this directory, other than this one, are generated and should +not be hand-edited. + +To update these files, execute `./mach uniffi generate` diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build new file mode 100644 index 000000000000..119400a35154 --- /dev/null +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build @@ -0,0 +1,12 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +EXTRA_JS_MODULES += [ + "generated/RustTabs.jsm", +] + +with Files("**"): + BUG_COMPONENT = ("Toolkit", "UniFFI Bindings") diff --git a/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py b/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py index 9ba6310921a3..34d024e9287f 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py +++ b/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py @@ -13,8 +13,9 @@ from mach.decorators import ( # committing to using UniFFI. There are other ways to consume Rust from # JavaScript that might fit your use case better. UDL_FILES = [ - # TODO: Use UniFFI + "third_party/rust/tabs/src/tabs.udl", ] + FIXTURE_UDL_FILES = [ "third_party/rust/uniffi-example-geometry/src/geometry.udl", "third_party/rust/uniffi-example-arithmetic/src/arithmetic.udl", diff --git a/toolkit/library/rust/shared/lib.rs b/toolkit/library/rust/shared/lib.rs index da221979acc9..e93db1603962 100644 --- a/toolkit/library/rust/shared/lib.rs +++ b/toolkit/library/rust/shared/lib.rs @@ -57,6 +57,14 @@ extern crate audio_thread_priority; #[cfg(not(target_os = "android"))] extern crate webext_storage_bridge; +#[cfg(not(target_os = "android"))] +extern crate tabs; + +#[cfg(not(target_os = "android"))] +mod reexport_tabs { + tabs::uniffi_reexport_scaffolding!(); +} + #[cfg(feature = "webrtc")] extern crate mdns_service; extern crate neqo_glue;