richard pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
-
64cb7b18
by Pier Angelo Vendrame at 2023-08-10T16:26:11+00:00
6 changed files:
- Makefile
- projects/application-services/build
- projects/application-services/config
- − projects/uniffi-rs/btreeset.patch
- − projects/uniffi-rs/build
- − projects/uniffi-rs/config
Changes:
| ... | ... | @@ -583,9 +583,6 @@ cargo_vendor-application-services: submodule-update |
| 583 | 583 | cargo_vendor-cbindgen: submodule-update
|
| 584 | 584 | $(rbm) build cbindgen --step cargo_vendor --target alpha --target torbrowser-linux-x86_64
|
| 585 | 585 | |
| 586 | -cargo_vendor-uniffi-rs: submodule-update
|
|
| 587 | - $(rbm) build uniffi-rs --step cargo_vendor --target nightly --target torbrowser-linux-x86_64
|
|
| 588 | - |
|
| 589 | 586 | go_vendor-snowflake-alpha: submodule-update
|
| 590 | 587 | $(rbm) build snowflake --step go_vendor --target alpha --target torbrowser-linux-x86_64
|
| 591 | 588 |
| ... | ... | @@ -21,8 +21,7 @@ mkdir /var/tmp/build |
| 21 | 21 | cd /var/tmp/dist
|
| 22 | 22 | tar -xf $rootdir/[% c('input_files_by_name/rust') %]
|
| 23 | 23 | tar -xf $rootdir/[% c('input_files_by_name/ninja') %]
|
| 24 | -tar -xf $rootdir/[% c('input_files_by_name/uniffi-rs') %]
|
|
| 25 | -export PATH=/var/tmp/dist/rust/bin:/var/tmp/dist/ninja:/var/tmp/dist/uniffi-rs:$PATH
|
|
| 24 | +export PATH=/var/tmp/dist/rust/bin:/var/tmp/dist/ninja:$PATH
|
|
| 26 | 25 | export RUST_ANDROID_GRADLE_PYTHON_COMMAND=python3
|
| 27 | 26 | cd $rootdir
|
| 28 | 27 |
| ... | ... | @@ -46,9 +46,6 @@ steps: |
| 46 | 46 | - project: ninja
|
| 47 | 47 | name: ninja
|
| 48 | 48 | pkg_type: build
|
| 49 | - - project: uniffi-rs
|
|
| 50 | - name: uniffi-rs
|
|
| 51 | - pkg_type: build
|
|
| 52 | 49 | # See libs/build-all.sh to update these!
|
| 53 | 50 | # Also, build them with application-services, since they need the NDK and
|
| 54 | 51 | # we are using a different one from the other projects.
|
| 1 | -diff --git a/uniffi_bindgen/src/interface/types.rs b/uniffi_bindgen/src/interface/types.rs
|
|
| 2 | -index 6448d58..b7efd22 100644
|
|
| 3 | ---- a/uniffi_bindgen/src/interface/types.rs
|
|
| 4 | -+++ b/uniffi_bindgen/src/interface/types.rs
|
|
| 5 | -@@ -26,7 +26,7 @@
|
|
| 6 | - use anyhow::bail;
|
|
| 7 | - use anyhow::Result;
|
|
| 8 | - use std::convert::TryFrom;
|
|
| 9 | --use std::{collections::hash_map::Entry, collections::HashMap, collections::HashSet};
|
|
| 10 | -+use std::{collections::hash_map::Entry, collections::HashMap, collections::BTreeSet};
|
|
| 11 | -
|
|
| 12 | - use super::Attributes;
|
|
| 13 | -
|
|
| 14 | -@@ -71,7 +71,7 @@ pub enum FFIType {
|
|
| 15 | - /// Represents all the different high-level types that can be used in a component interface.
|
|
| 16 | - /// At this level we identify user-defined types by name, without knowing any details
|
|
| 17 | - /// of their internal structure apart from what type of thing they are (record, enum, etc).
|
|
| 18 | --#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
|
| 19 | -+#[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
|
|
| 20 | - pub enum Type {
|
|
| 21 | - // Primitive types.
|
|
| 22 | - UInt8,
|
|
| 23 | -@@ -195,7 +195,7 @@ pub(crate) struct TypeUniverse {
|
|
| 24 | - // Named type definitions (including aliases).
|
|
| 25 | - type_definitions: HashMap<String, Type>,
|
|
| 26 | - // All the types in the universe, by canonical type name.
|
|
| 27 | -- all_known_types: HashSet<Type>,
|
|
| 28 | -+ all_known_types: BTreeSet<Type>,
|
|
| 29 | - }
|
|
| 30 | -
|
|
| 31 | - impl TypeUniverse { |
| 1 | -#!/bin/bash
|
|
| 2 | -[% c("var/set_default_env") -%]
|
|
| 3 | -distdir=/var/tmp/dist
|
|
| 4 | -builddir=/var/tmp/build/[% project %]
|
|
| 5 | -mkdir -p $distdir/[% project %]
|
|
| 6 | -tar -C $distdir -xf $rootdir/[% c('input_files_by_name/rust') %]
|
|
| 7 | -export PATH="/var/tmp/dist/rust/bin:$PATH"
|
|
| 8 | -mkdir -p /var/tmp/build
|
|
| 9 | -tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.[% c('compress_tar') %]
|
|
| 10 | - |
|
| 11 | -# Now prepare the offline build
|
|
| 12 | -# Move the directory for hardcoding the path in .cargo/config
|
|
| 13 | -mv /var/tmp/build/[% project %]-[% c('version') %] $builddir
|
|
| 14 | -tar -C $builddir -xjf uniffi-rs-vendor-[% c('version') %].tar.bz2
|
|
| 15 | -cd $builddir
|
|
| 16 | -mkdir .cargo
|
|
| 17 | -cat > .cargo/config << 'EOF'
|
|
| 18 | -[source.crates-io]
|
|
| 19 | -replace-with = "vendored-sources"
|
|
| 20 | - |
|
| 21 | -[source.vendored-sources]
|
|
| 22 | -directory = "/var/tmp/build/uniffi-rs/vendor"
|
|
| 23 | -EOF
|
|
| 24 | - |
|
| 25 | -# We change the data type of the `all_known_types` Set from HashSet to BTreeSet.
|
|
| 26 | -# Uniffi iterates over the elements of this set, and iteration over a HashSet occurs
|
|
| 27 | -# in an arbitrary order, while iteration over a BTreeSet orders in a defined (and
|
|
| 28 | -# deterministic) order. This patch solves a build reproducibility issue, see
|
|
| 29 | -# tor-browser-build#40208.
|
|
| 30 | -#
|
|
| 31 | -# Upstream bug: https://github.com/mozilla/uniffi-rs/issues/374
|
|
| 32 | -patch -p1 < $rootdir/btreeset.patch
|
|
| 33 | -# We usually use --frozen but there is no Cargo.lock file available. Thus resort
|
|
| 34 | -# to --offline.
|
|
| 35 | -cargo build --release --offline --target x86_64-unknown-linux-gnu
|
|
| 36 | -mv target/x86_64-unknown-linux-gnu/release/uniffi-bindgen $distdir/[% project %]
|
|
| 37 | - |
|
| 38 | -cd $distdir
|
|
| 39 | -[% c('tar', {
|
|
| 40 | - tar_src => [ project ],
|
|
| 41 | - tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'),
|
|
| 42 | - }) %] |
| 1 | -# vim: filetype=yaml sw=2
|
|
| 2 | -version: 0.7.0
|
|
| 3 | -git_url: https://github.com/mozilla/uniffi-rs
|
|
| 4 | -git_hash: ea3ff0402438ef1ebceda4c5fbbbd2ed6a9be227
|
|
| 5 | -filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.[% c("compress_tar") %]'
|
|
| 6 | - |
|
| 7 | -container:
|
|
| 8 | - use_container: 1
|
|
| 9 | - |
|
| 10 | -input_files:
|
|
| 11 | - - project: container-image
|
|
| 12 | - - name: rust
|
|
| 13 | - project: rust
|
|
| 14 | - # Use `make cargo_vendor-uniffi-rs` to re-generate the vendor tarball
|
|
| 15 | - - URL: https://people.torproject.org/~boklm/mirrors/sources/uniffi-rs-vendor-[% c('version') %].tar.bz2
|
|
| 16 | - sha256sum: 8f201df618b3e7bcaaf01a87e0d55171605b80abeb1b660fe4dd0b9bfc10a0d8
|
|
| 17 | - - filename: btreeset.patch
|
|
| 18 | - |
|
| 19 | -steps:
|
|
| 20 | - cargo_vendor:
|
|
| 21 | - filename: '[% project %]-vendor-[% c("version") %].tar.bz2'
|
|
| 22 | - input_files:
|
|
| 23 | - - project: container-image
|
|
| 24 | - pkg_type: build
|
|
| 25 | - - project: rust
|
|
| 26 | - name: rust
|
|
| 27 | - pkg_type: build |