commit a612f504aafd18c3356cbfec20f3f5dfcfc2497f Author: Matthew Finkel sysrqb@torproject.org Date: Wed Apr 28 19:38:39 2021 +0000
Bug 40293: Patch app-services' vendored uniffi_bindgen --- ...niverse-of-known-types-in-an-ordered-BTre.patch | 51 ++++++++++++++++++++++ projects/application-services/build | 9 ++++ projects/application-services/config | 1 + 3 files changed, 61 insertions(+)
diff --git a/projects/application-services/0001-Store-the-universe-of-known-types-in-an-ordered-BTre.patch b/projects/application-services/0001-Store-the-universe-of-known-types-in-an-ordered-BTre.patch new file mode 100644 index 0000000..947b2f6 --- /dev/null +++ b/projects/application-services/0001-Store-the-universe-of-known-types-in-an-ordered-BTre.patch @@ -0,0 +1,51 @@ +From 4b9826025ac3242580efd7549d9b55d4466112e3 Mon Sep 17 00:00:00 2001 +From: Matthew Finkel sysrqb@torproject.org +Date: Wed, 28 Apr 2021 18:38:47 +0000 +Subject: [PATCH] Store the universe of known types in an ordered BTreeSet + (#374) + +The set of types is used in multiple places during FFI creation. When +the data structure does not guarantee the order of elements, such as +HashSet, the resulting generated source code is not deterministic. Using +a BTreeSet resolves this issue by providing a well-defined element order +over which the the set may be iterated. +--- + uniffi_bindgen/src/interface/types/mod.rs | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/uniffi_bindgen/src/interface/types/mod.rs b/uniffi_bindgen/src/interface/types/mod.rs +index c4b0094..670b4bb 100644 +--- a/uniffi_bindgen/src/interface/types/mod.rs ++++ b/uniffi_bindgen/src/interface/types/mod.rs +@@ -21,7 +21,7 @@ + //! about how these API-level types map into the lower-level types of the FFI layer as represented + //! by the [`ffi::FFIType`] enum, but that's a detail that is invisible to end users. + +-use std::{collections::hash_map::Entry, collections::HashMap, collections::HashSet}; ++use std::{collections::hash_map::Entry, collections::BTreeSet, collections::HashMap}; + + use anyhow::{bail, Result}; + +@@ -35,7 +35,7 @@ pub(super) use resolver::{resolve_builtin_type, TypeResolver}; + /// Represents all the different high-level types that can be used in a component interface. + /// At this level we identify user-defined types by name, without knowing any details + /// of their internal structure apart from what type of thing they are (record, enum, etc). +-#[derive(Debug, Clone, Eq, PartialEq, Hash)] ++#[derive(Debug, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)] + pub enum Type { + // Primitive types. + UInt8, +@@ -159,8 +159,8 @@ impl Into<FFIType> for &Type { + pub(crate) struct TypeUniverse { + // Named type definitions (including aliases). + type_definitions: HashMap<String, Type>, +- // All the types in the universe, by canonical type name. +- all_known_types: HashSet<Type>, ++ // All the types in the universe, by canonical type name, in a well-defined order. ++ all_known_types: BTreeSet<Type>, + } + + impl TypeUniverse { +-- +2.25.1 + diff --git a/projects/application-services/build b/projects/application-services/build index 40001cd..b22b4c7 100644 --- a/projects/application-services/build +++ b/projects/application-services/build @@ -49,6 +49,15 @@ directory = "/var/tmp/build/application-services/vendor" offline=true EOF
+# Bug 40293: Patch vendored uniffi_bindgen. +pushd /var/tmp/build/application-services/vendor/ +patch -p1 < $rootdir/0001-Store-the-universe-of-known-types-in-an-ordered-BTre.patch +# Update the expected checksum in the vendored source. +sed -i \ + 's/e39e61458d0d28c2b3425852c8a55625cc185ce806fbc7c0c6682f8cc93dec8d/0909e5214eedf1f2e709909176b1cbda39887002b26388535c3bc551fb04da1b/' \ + uniffi_bindgen/.cargo-checksum.json +popd + patch -p1 < $rootdir/update-cargo-lock.patch cd components/external/nimbus-sdk patch -p1 < $rootdir/viaduct-workaround.patch diff --git a/projects/application-services/config b/projects/application-services/config index 456ce87..32aa7ec 100644 --- a/projects/application-services/config +++ b/projects/application-services/config @@ -92,6 +92,7 @@ input_files: - filename: update-cargo-lock.patch - filename: gen_gradle_deps_file.sh enable: '[% c("var/fetch_gradle_dependencies") %]' + - filename: 0001-Store-the-universe-of-known-types-in-an-ordered-BTre.patch
steps: list_toolchain_updates:
tbb-commits@lists.torproject.org