Skip to content

Commit

Permalink
set default Rust toolchain to stable and install cargo-ledger v1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Jan 24, 2024
1 parent 8d50c2b commit b141536
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.14.0] - 2024-01-23

### Changed
- [full, legacy, dev-tools] Default Rust toolchain set to stable 1.75.0

## [3.13.0] - 2024-01-18

### Changed
Expand Down
25 changes: 15 additions & 10 deletions full/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
ARG RUST_STABLE_VERSION=1.75.0
ARG RUST_NIGHTLY_VERSION=nightly-2023-11-10

ENV RUST_STABLE=$RUST_STABLE_VERSION
ENV RUST_NIGHTLY=$RUST_NIGHTLY_VERSION

# Add curl for Rust buildchain
RUN apk add --update-cache --upgrade curl

Expand All @@ -15,17 +18,19 @@ RUN apk add rustup
# Adding cargo binaries to PATH
ENV PATH=${CARGO_HOME}/bin:${PATH}

# Installing rustup and setting the default toolchain to the RUST_NIGHTLY_VERSION nightly channel.
RUN rustup-init --default-toolchain $RUST_NIGHTLY_VERSION -y
# Installing rustup and setting the default toolchain to the RUST_STABLE_VERSION channel.
RUN rustup-init --default-toolchain $RUST_STABLE_VERSION -y

# Installing stable channel version RUST_STABLE_VERSION as well (for cargo-ledger installation).
RUN rustup install $RUST_STABLE_VERSION
# Installing nightly channel version RUST_NIGHTLY_VERSION (for Rust applications).
RUN rustup install $RUST_NIGHTLY_VERSION

# Adding ARMV6M target to the installed nightly toolchain
# Adding ARMV6M target to the installed stable and nightly toolchains
RUN rustup target add thumbv6m-none-eabi --toolchain $RUST_STABLE_VERSION
RUN rustup target add thumbv6m-none-eabi --toolchain $RUST_NIGHTLY_VERSION

# Adding rust-src component to nightly channel
# Adding rust-src component to nightly and stable channels
RUN rustup component add rust-src --toolchain $RUST_NIGHTLY_VERSION
RUN rustup component add rust-src --toolchain $RUST_STABLE_VERSION

# Python packages building dependencies, can be removed afterwards
RUN apk add -t python_build_deps python3-dev \
Expand All @@ -37,11 +42,11 @@ RUN pip3 install ledgerwallet==0.4.0
# Cleanup, remove packages that aren't needed anymore
RUN apk del python_build_deps

# Add cargo ledger (needs a version of Rust >= 1.70)
RUN cargo +$RUST_STABLE_VERSION install --version 1.2.3 cargo-ledger
# Add cargo ledger
RUN cargo +$RUST_STABLE_VERSION install --version 1.2.4 cargo-ledger

# Setup cargo ledger (install JSON target files)
RUN cargo ledger setup
# Setup cargo ledger (install JSON target files) for nightly
RUN cargo +$RUST_NIGHTLY_VERSION ledger setup

# Add a global Cargo config file (includes mandatory unstable features used to build our apps)
ADD ./full/cargo_global_config.toml $CARGO_HOME/config.toml
24 changes: 15 additions & 9 deletions legacy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ ARG LLVM_VERSION=12
ARG RUST_STABLE_VERSION=1.75.0
ARG RUST_NIGHTLY_VERSION=nightly-2023-11-10

ENV RUST_STABLE=$RUST_STABLE_VERSION
ENV RUST_NIGHTLY=$RUST_NIGHTLY_VERSION


RUN apt-get update && apt-get upgrade -qy
RUN apt-get install -qy \
clang-$LLVM_VERSION \
Expand Down Expand Up @@ -59,27 +63,29 @@ ENV PATH=/opt/gcc-arm-none-eabi-${TOOLCHAIN_VERSION}/bin:$PATH \
# Adding cargo binaries to PATH
ENV PATH=${CARGO_HOME}/bin:${PATH}

# Installing rustup to manage rust toolchainsand setting the default toolchain to the RUST_NIGHTLY_VERSION nightly channel.
# Installing rustup to manage rust toolchains and setting the default toolchain to the RUST_STABLE_VERSION stable channel.
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain $RUST_NIGHTLY_VERSION -y
sh -s -- --default-toolchain $RUST_STABLE_VERSION -y

# Installing stable channel version RUST_STABLE_VERSION as well (for cargo-ledger installation).
RUN rustup install $RUST_STABLE_VERSION
# Installing nightly channel version RUST_NIGHTLY_VERSION
RUN rustup install $RUST_NIGHTLY_VERSION

# Adding ARMV6M target to the installed nightly toolchain
# Adding ARMV6M target to the installed stable toolchain
RUN rustup target add thumbv6m-none-eabi --toolchain $RUST_STABLE_VERSION
RUN rustup target add thumbv6m-none-eabi --toolchain $RUST_NIGHTLY_VERSION

# Adding rust-src component to nightly channel
# Adding rust-src component to nightly and stable channels
RUN rustup component add rust-src --toolchain $RUST_NIGHTLY_VERSION
RUN rustup component add rust-src --toolchain $RUST_STABLE_VERSION

# Add ledgerwallet python package used by cargo ledger to generate the app APDU file
RUN pip3 install ledgerwallet==0.4.0

# Add cargo ledger (needs a version of Rust >= 1.70)
RUN cargo +$RUST_STABLE_VERSION install --version 1.2.3 cargo-ledger
# Add cargo ledger
RUN cargo +$RUST_STABLE_VERSION install --version 1.2.4 cargo-ledger

# Setup cargo ledger (install JSON target files)
RUN cargo ledger setup
RUN cargo +$RUST_NIGHTLY_VERSION ledger setup

# Adding LLVM-15 APT repository and installing it
RUN wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
Expand Down

0 comments on commit b141536

Please sign in to comment.