|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# This script expects to be run from the tools directory in |
| 4 | +# a local checkout of Anki-Android-Backend, e.g. |
| 5 | +# git clone https://github.com/ankidroid/Anki-Android-Backend |
| 6 | +# cd Anki-Android-Backend/tools |
| 7 | + |
| 8 | +# Update the actions runner if needed? |
| 9 | +# latest release and instructions here: |
| 10 | +# https://github.com/actions/runner/releases |
| 11 | + |
| 12 | +# Install rustup, but empty |
| 13 | +#curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none |
| 14 | + |
| 15 | +# Make sure our submodules are up to date |
| 16 | + |
| 17 | +# Install the Rust toolchains we need |
| 18 | +for RUST_TC in `find .. |grep rust-toolchain.toml`; do rustup toolchain install `grep channel $RUST_TC | cut -f2 -d'"'`; done |
| 19 | + |
| 20 | +# we need protobuf |
| 21 | +brew install protobuf |
| 22 | +export PROTOC=`which protoc` |
| 23 | + |
| 24 | +# install the JDK we need |
| 25 | +brew install temurin@21 |
| 26 | + |
| 27 | +# install the NDK we need |
| 28 | +cargo install toml-cli |
| 29 | +export ANDROID_NDK_VERSION=$(toml get ../gradle/libs.versions.toml versions.ndk --raw) |
| 30 | +export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin" |
| 31 | +../.github/scripts/install_ndk.sh ${ANDROID_NDK_VERSION} |
| 32 | +export ANDROID_NDK_LATEST_HOME="${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}" |
| 33 | +export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME |
| 34 | + |
| 35 | +# install our cross compilers |
| 36 | +# TODO - for BREWCMD in `grep "brew install" ../.github/workflows/build-release.yml`; do $BREWCMD; done |
| 37 | +brew install mingw-w64 |
| 38 | +brew install MaterializeInc/crosstools/x86_64-unknown-linux-gnu |
| 39 | + |
| 40 | +# install anki-specific build tool N2 |
| 41 | +../anki/tools/install-n2 |
| 42 | + |
| 43 | +# Warm up local caches with a run of workflow build commands |
| 44 | +cd .. |
| 45 | + |
| 46 | +# from build-quick.yml |
| 47 | +cargo run -p build_rust |
| 48 | +./check-rust.sh |
| 49 | +./gradlew test rsdroid:lint |
| 50 | + |
| 51 | +# from build-release.yml |
| 52 | +export ALL_ARCHS=1 |
| 53 | +export RELEASE=1 |
| 54 | +export CARGO_PROFILE_RELEASE_LTO=fat |
| 55 | +./build.sh |
0 commit comments