Merge #396: Reproducible builds updates for 0.4

a7678091673015a7f8c193451b5e591930a27ba1 docker: use 'apt satisfy' to avoid being too strict with package pinning (Antoine Poinsot)
1454bd86d5e8cf9c2ed935be1b7889132fff851b docker: adapt the reproducible builds to the new gui folder structure (Antoine Poinsot)
2596e03a9f877372145e464a5eef49b443b758ab guix: use rust 1.65 to build the GUI (Antoine Poinsot)
b295637101c92f1d19053ce5aa25cf01f8b35d7a guix: always expose the "ui" GUI folder (Antoine Poinsot)
0824fcfefcbd2788425cf6d6dd2b480e07834f99 guix: use the minimal version of coreutils (Antoine Poinsot)

Pull request description:

  This updates the reproducible builds with the new structure of the GUI project, updates `rustc` for building the GUI in GUIX to 1.65 to drop the last patch that was required, and update the dependencies versions in the Dockerfiles.

ACKs for top commit:
  darosior:
    ACK a7678091673015a7f8c193451b5e591930a27ba1

Tree-SHA512: c672bcca2e7558830dae04bbb7bc8f156481e942c8f75a24033b2d6d2a50ed3d39edffd37d6b485b0dada1c020fd4766eed7712384414c0fec34a22273086157
This commit is contained in:
Antoine Poinsot 2023-03-31 12:14:54 +02:00
commit c9753e9153
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
6 changed files with 47 additions and 533 deletions

View File

@ -11,10 +11,16 @@ docker build . -t liana_cross_win -f contrib/reproducible/docker/windows.Dockerf
docker run --rm -ti \
-v "$TARGET_DIR/gui":/liana/target \
-v "$PWD/contrib/reproducible/docker":/liana/docker \
-v "$PWD/gui/Cargo.toml":/liana/Cargo.toml \
-v "$PWD/gui/Cargo.lock":/liana/Cargo.lock \
-v "$PWD/gui/src":/liana/src \
-v "$PWD/gui/static":/liana/static \
-v "$PWD/gui/ui/Cargo.toml":/liana/ui/Cargo.toml \
-v "$PWD/gui/ui/Cargo.lock":/liana/ui/Cargo.lock \
-v "$PWD/gui/ui/src":/liana/ui/src \
-v "$PWD/gui/ui/static":/liana/ui/static \
liana_cross_win
# Sanity check the given MacOS SDK is the expected one.
if ! $(echo "28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0 $(basename $XCODE_PATH)" | sha256sum -c --status); then
echo "No or invalid Xcode SDK found. Need an Xcode_12.2.xip. You can configure the path using \$XCODE_PATH.";
@ -27,9 +33,16 @@ docker run --rm -ti \
-v "$TARGET_DIR":/liana/target \
-v "$TARGET_DIR/gui":/liana/gui/target \
-v "$PWD/contrib/reproducible/docker":/liana/docker \
-v "$PWD/Cargo.toml":/liana/Cargo.toml \
-v "$PWD/Cargo.lock":/liana/Cargo.lock \
-v "$PWD/src":/liana/src \
-v "$PWD/gui/Cargo.toml":/liana/gui/Cargo.toml \
-v "$PWD/gui/Cargo.lock":/liana/gui/Cargo.lock \
-v "$PWD/gui/src":/liana/gui/src \
-v "$PWD/gui/static":/liana/gui/static \
-v "$PWD/gui/ui/Cargo.toml":/liana/gui/ui/Cargo.toml \
-v "$PWD/gui/ui/Cargo.lock":/liana/gui/ui/Cargo.lock \
-v "$PWD/gui/ui/src":/liana/gui/ui/src \
-v "$PWD/gui/ui/static":/liana/gui/ui/static \
-v "$XCODE_PATH":/liana/Xcode_12.2.xip \
liana_cross_mac

View File

@ -4,24 +4,24 @@ WORKDIR /liana
# We try to pin our dependencies to avoid potential sources of non-determinism, but we don't go
# out of our way to pin the whole tree of deps. Instead invest time in getting Guix cross-compilation.
RUN apt update && apt install -y \
clang=1:11.0-51+nmu5 \
make=4.3-4.1 \
libssl-dev=1.1.1n-0+deb11u3 \
liblzma-dev=5.2.5-2.1~deb11u1 \
libxml2=2.9.10+dfsg-6.7+deb11u3 \
libxml2-dev=2.9.10+dfsg-6.7+deb11u3 \
cmake=3.18.4-2+deb11u1 \
git=1:2.30.2-1 \
patch=2.7.6-7 \
python3=3.9.2-3 \
llvm-dev=1:11.0-51+nmu5 \
cpio=2.13+dfsg-4 \
zlib1g-dev=1:1.2.11.dfsg-2+deb11u2 \
libbz2-dev=1.0.8-4 \
xz-utils=5.2.5-2.1~deb11u1 \
bzip2=1.0.8-4 \
curl=7.74.0-1.3+deb11u5
RUN apt update && apt satisfy -y \
"clang (>=11.0, <=11.0)" \
"make (<=4.3-*)" \
"libssl-dev (>=1.1, <=1.1)" \
"liblzma-dev (>=5.2, <=5.2)" \
"libxml2 (>=2.9, <= 2.9)" \
"libxml2-dev (>=2.9, <=2.9)" \
"cmake (>=3.18, <=3.18)" \
"git (>=2.30, <=2.30)" \
"patch (>=2.7, <=2.7)" \
"python3 (>=3.9, <=3.9)" \
"llvm-dev (>=11.0, <=11.0)" \
"cpio (<=2.13+*)" \
"zlib1g-dev (>=1.2, <=1.2)" \
"libbz2-dev (>=1.0, <=1.0)" \
"xz-utils (>=5.2, <=5.2)" \
"bzip2 (>=1.0, <=1.0)" \
"curl (>=7.74, <=7.74)"
# Download the cargo binary and compiled stdlib from the distributed releases to make sure to build with
# the very same toolchain. We use 1.65.0 because it is unfortunately the MSRV of the GUI.
@ -33,21 +33,8 @@ RUN curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-unknown-linux-
tar -xzf rust-1.65.0-x86_64-apple-darwin.tar.gz && \
rm -r *.tar.gz
# Copy the Cargo files for both the daemon and the GUI to vendor the dependencies.
COPY Cargo.toml Cargo.lock /liana/
COPY gui/Cargo.toml gui/Cargo.lock /liana/gui/
# We cache the dependencies sources in the image to avoid re-indexing everything from scratch
# at every run. It was useful when debugging the build, it could be removed eventually if we
# think the tradeoff vs the image size isn't worth it anymore.
RUN /liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo vendor && \
cd gui && \
/liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo vendor && \
cd ..
# Cargo configuration for using the vendored dependencies during the builds.
COPY contrib/reproducible/docker/cargo_config.toml /liana/.cargo/cargo_config.toml
COPY contrib/reproducible/docker/cargo_config.toml /liana/gui/.cargo/cargo_config.toml
# NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size
# and not needing internet access when running the image to build the software.
# For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies.
# This doesn't work: RUSTFLAGS="-L/liana/rust-1.65.0-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/"

View File

@ -4,10 +4,10 @@ WORKDIR /liana
# We try to pin our dependencies to avoid potential sources of non-determinism, but we don't go
# out of our way to pin the whole tree of deps. Instead invest time in getting Guix cross-compilation.
RUN apt update && apt install -y \
gcc-mingw-w64-x86-64=10.2.1-6+24.2 \
curl=7.74.0-1.3+deb11u5 \
gcc=4:10.2.1-1
RUN apt update && apt satisfy -y \
"gcc-mingw-w64-x86-64 (>=10.2, <=10.2)" \
"curl (>=7.74, <=7.74)" \
"gcc (>=10.2, <=10.2)"
# Download the cargo binary and compiled stdlib from the distributed releases to make sure to build with
# the very same toolchain. We use 1.65.0 because it is unfortunately the MSRV of the GUI.
@ -19,16 +19,8 @@ RUN curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-unknown-linux-
tar -xzf rust-1.65.0-x86_64-pc-windows-gnu.tar.gz && \
rm -r *.tar.gz
# Copy the Cargo files to vendor the dependencies.
COPY gui/Cargo.toml gui/Cargo.lock /liana/
# We cache the dependencies sources in the image to avoid re-indexing everything from scratch
# at every run. It was useful when debugging the build, it could be removed eventually if we
# think the tradeoff vs the image size wasn't worth it anymore.
RUN /liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo vendor
# Cargo configuration for using the vendored dependencies during the build.
COPY contrib/reproducible/docker/cargo_config.toml /liana/.cargo/cargo_config.toml
# NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size
# and not needing internet access when running the image to build the software.
# For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies.
# This doesn't work: RUSTFLAGS="-L /liana/rust-1.65.0-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.65.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/"

View File

@ -117,11 +117,14 @@ for project_folder in "" "gui"; do
# NOTE: it looks like "--rebuild-cache" is necessary for the IS_GUI variable to
# be taken into account when building the container (otherwise the GUI container could
# miss some dependencies).
# TODO: only expose the "ui" folder for GUI builds
IS_GUI="$IS_GUI" time_machine shell --no-cwd \
--expose="$PROJECT_ROOT/src=/liana/src" \
--expose="$PWD/gui/static=/liana/static" \
--expose="$PROJECT_ROOT/Cargo.toml=/liana/Cargo.toml" \
--expose="$BUILD_ROOT/Cargo.lock=/liana/Cargo.lock" \
--expose="$PWD/gui/ui/src=/liana/ui/src" \
--expose="$PWD/gui/ui/Cargo.toml=/liana/ui/Cargo.toml" \
--expose="$PWD/gui/ui/static=/liana/ui/static" \
--expose="$PWD/contrib/reproducible/guix/build.sh=/liana/build.sh" \
--expose="$PROJECT_VENDOR_DIR=/vendor" \
--share="$PROJECT_OUT_DIR=/out" \

View File

@ -5,7 +5,7 @@
(append
(list
"rust:cargo"
"coreutils"
"coreutils-minimal"
"patchelf"
"gcc-toolchain@10.3.0")
;; Additional dependencies for building the GUI, and the regular rustc for building
@ -24,5 +24,5 @@
(if
(string=? is_gui "1")
(list
(@@ (gnu packages rust) rust-1.64))
(@@ (gnu packages rust) rust-1.65))
'())))))

View File

@ -1,481 +0,0 @@
commit f71bc71bf6724a1c5e2a3246dd8bd0a90fcf0e15
Author: Antoine Poinsot <darosior@protonmail.com>
Date: Thu Dec 1 15:38:32 2022 +0100
Do not use, or special-case them, unstable features as of 1.60.0
This is in order to make the GUI MSRV effectively 1.60.0.
Default derivation on enums is removed.
Usage of bool_to_option is removed.
Generic associated types is unfortunately special cased as enabled. This
forces use to set RUSTC_BOOTSTRAP=1 in the Guix container...
diff --git a/iced_glow/src/lib.rs b/iced_glow/src/lib.rs
index e3690a69..b5b9cc38 100644
--- a/iced_glow/src/lib.rs
+++ b/iced_glow/src/lib.rs
@@ -20,6 +20,7 @@
#![forbid(rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_cfg))]
+#![feature(generic_associated_types)]
pub use glow;
diff --git a/iced_graphics/src/lib.rs b/iced_graphics/src/lib.rs
index d39dd90c..876b478f 100644
--- a/iced_graphics/src/lib.rs
+++ b/iced_graphics/src/lib.rs
@@ -21,6 +21,7 @@
#![forbid(rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_cfg))]
+#![feature(generic_associated_types)]
mod antialiasing;
mod error;
mod primitive;
diff --git a/iced_native/src/program/state.rs b/iced_native/src/program/state.rs
index 8ae1cacb..25a3028b 100644
--- a/iced_native/src/program/state.rs
+++ b/iced_native/src/program/state.rs
@@ -120,7 +120,11 @@ where
.iter()
.zip(event_statuses)
.filter_map(|(event, status)| {
- matches!(status, event::Status::Ignored).then_some(event)
+ if matches!(status, event::Status::Ignored) {
+ Some(event)
+ } else {
+ None
+ }
})
.cloned()
.collect();
diff --git a/iced_style/src/theme.rs b/iced_style/src/theme.rs
index 55bfa4ca..e29fde31 100644
--- a/iced_style/src/theme.rs
+++ b/iced_style/src/theme.rs
@@ -26,10 +26,9 @@ use iced_core::{Background, Color, Vector};
use std::rc::Rc;
/// A built-in theme.
-#[derive(Debug, Clone, PartialEq, Default)]
+#[derive(Debug, Clone, PartialEq)]
pub enum Theme {
/// The built-in light variant.
- #[default]
Light,
/// The built-in dark variant.
Dark,
@@ -62,6 +61,12 @@ impl Theme {
}
}
+impl Default for Theme {
+ fn default() -> Self {
+ Self::Light
+ }
+}
+
/// A [`Theme`] with a customized [`Palette`].
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Custom {
@@ -80,15 +85,19 @@ impl Custom {
}
/// The style of an application.
-#[derive(Default)]
pub enum Application {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn application::StyleSheet<Style = Theme>>),
}
+impl Default for Application {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl application::StyleSheet for Theme {
type Style = Application;
@@ -120,10 +129,11 @@ impl From<fn(&Theme) -> application::Appearance> for Application {
}
/// The style of a button.
-#[derive(Default)]
+/*
+ * Button
+ */
pub enum Button {
/// The primary style.
- #[default]
Primary,
/// The secondary style.
Secondary,
@@ -139,6 +149,12 @@ pub enum Button {
Custom(Box<dyn button::StyleSheet<Style = Theme>>),
}
+impl Default for Button {
+ fn default() -> Self {
+ Self::Primary
+ }
+}
+
impl button::StyleSheet for Theme {
type Style = Button;
@@ -228,10 +244,11 @@ impl button::StyleSheet for Theme {
}
/// The style of a checkbox.
-#[derive(Default)]
+/*
+ * Checkbox
+ */
pub enum Checkbox {
/// The primary style.
- #[default]
Primary,
/// The secondary style.
Secondary,
@@ -243,6 +260,12 @@ pub enum Checkbox {
Custom(Box<dyn checkbox::StyleSheet<Style = Theme>>),
}
+impl Default for Checkbox {
+ fn default() -> Self {
+ Self::Primary
+ }
+}
+
impl checkbox::StyleSheet for Theme {
type Style = Checkbox;
@@ -340,10 +363,11 @@ fn checkbox_appearance(
}
/// The style of a container.
-#[derive(Default)]
+/*
+ * Container
+ */
pub enum Container {
/// No style.
- #[default]
Transparent,
/// A simple box.
Box,
@@ -351,6 +375,12 @@ pub enum Container {
Custom(Box<dyn container::StyleSheet<Style = Theme>>),
}
+impl Default for Container {
+ fn default() -> Self {
+ Self::Transparent
+ }
+}
+
impl From<fn(&Theme) -> container::Appearance> for Container {
fn from(f: fn(&Theme) -> container::Appearance) -> Self {
Self::Custom(Box::new(f))
@@ -388,15 +418,19 @@ impl container::StyleSheet for fn(&Theme) -> container::Appearance {
}
/// The style of a slider.
-#[derive(Default)]
pub enum Slider {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn slider::StyleSheet<Style = Theme>>),
}
+impl Default for Slider {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl slider::StyleSheet for Theme {
type Style = Slider;
@@ -469,15 +503,20 @@ impl slider::StyleSheet for Theme {
}
/// The style of a menu.
-#[derive(Clone, Default)]
+#[derive(Clone)]
pub enum Menu {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Rc<dyn menu::StyleSheet<Style = Theme>>),
}
+impl Default for Menu {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl menu::StyleSheet for Theme {
type Style = Menu;
@@ -511,10 +550,9 @@ impl From<PickList> for Menu {
}
/// The style of a pick list.
-#[derive(Clone, Default)]
+#[derive(Clone)]
pub enum PickList {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(
@@ -523,6 +561,12 @@ pub enum PickList {
),
}
+impl Default for PickList {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl pick_list::StyleSheet for Theme {
type Style = PickList;
@@ -566,15 +610,19 @@ impl pick_list::StyleSheet for Theme {
}
/// The style of a radio button.
-#[derive(Default)]
pub enum Radio {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn radio::StyleSheet<Style = Theme>>),
}
+impl Default for Radio {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl radio::StyleSheet for Theme {
type Style = Radio;
@@ -621,15 +669,19 @@ impl radio::StyleSheet for Theme {
}
/// The style of a toggler.
-#[derive(Default)]
pub enum Toggler {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn toggler::StyleSheet<Style = Theme>>),
}
+impl Default for Toggler {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl toggler::StyleSheet for Theme {
type Style = Toggler;
@@ -688,15 +740,19 @@ impl toggler::StyleSheet for Theme {
}
/// The style of a pane grid.
-#[derive(Default)]
pub enum PaneGrid {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn pane_grid::StyleSheet<Style = Theme>>),
}
+impl Default for PaneGrid {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl pane_grid::StyleSheet for Theme {
type Style = PaneGrid;
@@ -730,10 +786,11 @@ impl pane_grid::StyleSheet for Theme {
}
/// The style of a progress bar.
-#[derive(Default)]
+/*
+ * Progress Bar
+ */
pub enum ProgressBar {
/// The primary style.
- #[default]
Primary,
/// The success style.
Success,
@@ -743,6 +800,12 @@ pub enum ProgressBar {
Custom(Box<dyn progress_bar::StyleSheet<Style = Theme>>),
}
+impl Default for ProgressBar {
+ fn default() -> Self {
+ Self::Primary
+ }
+}
+
impl From<fn(&Theme) -> progress_bar::Appearance> for ProgressBar {
fn from(f: fn(&Theme) -> progress_bar::Appearance) -> Self {
Self::Custom(Box::new(f))
@@ -783,15 +846,22 @@ impl progress_bar::StyleSheet for fn(&Theme) -> progress_bar::Appearance {
}
/// The style of a rule.
-#[derive(Default)]
+/*
+ * Rule
+ */
pub enum Rule {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn rule::StyleSheet<Style = Theme>>),
}
+impl Default for Rule {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl From<fn(&Theme) -> rule::Appearance> for Rule {
fn from(f: fn(&Theme) -> rule::Appearance) -> Self {
Self::Custom(Box::new(f))
@@ -827,15 +897,19 @@ impl rule::StyleSheet for fn(&Theme) -> rule::Appearance {
/**
* Svg
*/
-#[derive(Default)]
pub enum Svg {
/// No filtering to the rendered SVG.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn svg::StyleSheet<Style = Theme>>),
}
+impl Default for Svg {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl Svg {
/// Creates a custom [`Svg`] style.
pub fn custom_fn(f: fn(&Theme) -> svg::Appearance) -> Self {
@@ -863,15 +937,19 @@ impl svg::StyleSheet for fn(&Theme) -> svg::Appearance {
}
/// The style of a scrollable.
-#[derive(Default)]
pub enum Scrollable {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn scrollable::StyleSheet<Style = Theme>>),
}
+impl Default for Scrollable {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl Scrollable {
/// Creates a custom [`Scrollable`] theme.
pub fn custom<T: scrollable::StyleSheet<Style = Theme> + 'static>(
@@ -961,15 +1039,23 @@ impl scrollable::StyleSheet for Theme {
}
/// The style of text.
-#[derive(Clone, Copy, Default)]
+/*
+ * Text
+ */
+#[derive(Clone, Copy)]
pub enum Text {
/// The default style.
- #[default]
Default,
/// Colored text.
Color(Color),
}
+impl Default for Text {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl From<Color> for Text {
fn from(color: Color) -> Self {
Text::Color(color)
@@ -988,15 +1074,19 @@ impl text::StyleSheet for Theme {
}
/// The style of a text input.
-#[derive(Default)]
pub enum TextInput {
/// The default style.
- #[default]
Default,
/// A custom style.
Custom(Box<dyn text_input::StyleSheet<Style = Theme>>),
}
+impl Default for TextInput {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl text_input::StyleSheet for Theme {
type Style = TextInput;
diff --git a/iced_wgpu/src/lib.rs b/iced_wgpu/src/lib.rs
index dcb699e8..5b3cda57 100644
--- a/iced_wgpu/src/lib.rs
+++ b/iced_wgpu/src/lib.rs
@@ -37,6 +37,7 @@
#![forbid(rust_2018_idioms)]
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_cfg))]
+#![feature(generic_associated_types)]
pub mod settings;
pub mod triangle;