From 1941355128adc17440f0a8d297b7abf3655219f5 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Sun, 16 Jul 2023 13:29:44 +0530 Subject: [PATCH 1/4] Imrove builds - Add more build targets - Allow cross compile (if you have the resources, I don't) - Fix failing nixos tests --- .github/workflows/cd.yml | 101 ++++++++++++---------- .github/workflows/ci.yml | 176 +++++++++++++++++++++------------------ .gitignore | 3 + docs/en/src/sum-type.md | 2 +- flake.lock | 89 +------------------- flake.nix | 38 +++++---- src/path.rs | 15 ++-- 7 files changed, 187 insertions(+), 237 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ca26841..79461ca 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -12,71 +12,86 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: - - macos-latest - - ubuntu-latest - - ubuntu-20.04 + build: + - macos + - macos-aarch64 + - linux + - linux-musl + - aarch64-linux + # - aarch64-linux-musl + - aarch64-android + # - armv7-linux rust: [stable] include: # See the list: https://github.com/cross-rs/cross - - os: macos-latest - artifact_prefix: macos + - build: macos + os: macos-latest target: x86_64-apple-darwin binary_postfix: "" - - os: ubuntu-latest - artifact_prefix: linux + - build: macos-aarch64 + os: macos-latest + target: aarch64-apple-darwin + binary_postfix: "" + + - build: linux + os: ubuntu-latest target: x86_64-unknown-linux-gnu binary_postfix: "" - - os: ubuntu-20.04 - artifact_prefix: linux-musl + - build: linux-musl + os: ubuntu-latest target: x86_64-unknown-linux-musl binary_postfix: "" - # Will see later + - build: aarch64-linux + os: ubuntu-latest + target: aarch64-unknown-linux-gnu + binary_postfix: "" + + # - build: aarch64-linux-musl + # os: ubuntu-latest + # target: aarch64-unknown-linux-musl + # binary_postfix: "" + + - build: aarch64-android + os: ubuntu-latest + target: aarch64-linux-android + binary_postfix: "" - # - os: ubuntu-latest - # artifact_prefix: x86_64-android - # target: x86_64-linux-android - # binary_postfix: '' - # - # - os: ubuntu-latest - # artifact_prefix: aarch64-android - # target: aarch64-linux-android - # binary_postfix: '' + # - build: armv7-linux + # os: ubuntu-latest + # target: armv7-unknown-linux-gnueabihf + # binary_postfix: "" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Installing Rust toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} - override: true - name: Installing needed macOS dependencies if: matrix.os == 'macos-latest' run: brew install openssl@1.1 - name: Installing needed Ubuntu dependencies - if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-20.04' + if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update --fix-missing - sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev + sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev + + - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') + run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross - - name: Checking out sources - uses: actions/checkout@v1 + - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') + run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross - name: Running cargo build - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - toolchain: ${{ matrix.rust }} - args: --locked --release --target ${{ matrix.target }} + run: cargo build --locked --release --target ${{ matrix.target }} - name: Install gpg secret key run: | @@ -89,7 +104,7 @@ jobs: cd target/${{ matrix.target }}/release BINARY_NAME=xplr${{ matrix.binary_postfix }} strip $BINARY_NAME - RELEASE_NAME=xplr-${{ matrix.artifact_prefix }} + RELEASE_NAME=xplr-${{ matrix.build }} tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 cat <(echo "${{ secrets.GPG_PASS }}") | gpg --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor $RELEASE_NAME.tar.gz @@ -98,9 +113,9 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - target/${{ matrix.target }}/release/xplr-${{ matrix.artifact_prefix }}.tar.gz - target/${{ matrix.target }}/release/xplr-${{ matrix.artifact_prefix }}.sha256 - target/${{ matrix.target }}/release/xplr-${{ matrix.artifact_prefix }}.tar.gz.asc + target/${{ matrix.target }}/release/xplr-${{ matrix.build }}.tar.gz + target/${{ matrix.target }}/release/xplr-${{ matrix.build }}.sha256 + target/${{ matrix.target }}/release/xplr-${{ matrix.build }}.tar.gz.asc env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -108,7 +123,7 @@ jobs: name: Publishing GPG signature runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install gpg secret key run: | cat <(echo -e "${{ secrets.GPG_SECRET }}") | gpg --batch --import @@ -133,20 +148,16 @@ jobs: name: Publishing to Cargo runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable - override: true - run: | sudo apt-get update --fix-missing sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev - - uses: actions-rs/cargo@v1 - with: - command: publish - args: --allow-dirty + - run: cargo publish --allow-dirty env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_KEY }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ebe8ed..3062e6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,130 +11,144 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable - profile: minimal - override: true - - uses: actions-rs/cargo@v1 + - run: cargo check + + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable with: - command: check + toolchain: stable + components: rustfmt + - run: cargo fmt --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: clippy + - run: cargo clippy -- -D warnings + + spellcheck: + name: Spellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: codespell-project/actions-codespell@v1 + with: + ignore_words_file: .codespellignore test: name: Test Suite runs-on: ${{ matrix.os }} + needs: + - check + - fmt + - clippy + - spellcheck strategy: matrix: - os: - - macos-latest - - ubuntu-latest - - ubuntu-20.04 + build: + - macos + - macos-aarch64 + - linux + - linux-musl + - aarch64-linux + # - aarch64-linux-musl + - aarch64-android + # - armv7-linux rust: [stable] include: - - os: macos-latest - artifact_prefix: macos + # See the list: https://github.com/cross-rs/cross + + - build: macos + os: macos-latest target: x86_64-apple-darwin binary_postfix: "" - - os: ubuntu-latest - artifact_prefix: linux + + - build: macos-aarch64 + os: macos-latest + target: aarch64-apple-darwin + binary_postfix: "" + + - build: linux + os: ubuntu-latest target: x86_64-unknown-linux-gnu binary_postfix: "" - - os: ubuntu-20.04 - artifact_prefix: linux-musl + + - build: linux-musl + os: ubuntu-latest target: x86_64-unknown-linux-musl binary_postfix: "" + - build: aarch64-linux + os: ubuntu-latest + target: aarch64-unknown-linux-gnu + binary_postfix: "" + + # - build: aarch64-linux-musl + # os: ubuntu-latest + # target: aarch64-unknown-linux-musl + # binary_postfix: "" + + - build: aarch64-android + os: ubuntu-latest + target: aarch64-linux-android + binary_postfix: "" + + # - build: armv7-linux + # os: ubuntu-latest + # target: armv7-unknown-linux-gnueabihf + # binary_postfix: "" + env: RUST_BACKTRACE: full steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Installing Rust toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} - override: true - name: Installing needed macOS dependencies if: matrix.os == 'macos-latest' run: brew install openssl@1.1 - name: Installing needed Ubuntu dependencies - if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-20.04' + if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update --fix-missing - sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev + sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - toolchain: ${{ matrix.rust }} - args: --target ${{ matrix.target }} + - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') + run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - toolchain: ${{ matrix.rust }} - args: --target ${{ matrix.target }} + - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') + run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross + - run: cargo build --target ${{ matrix.target }} + - run: cargo test --target ${{ matrix.target }} # bench: # name: Benchmarks # runs-on: ubuntu-latest # steps: - # - uses: actions/checkout@v2 - # - uses: actions-rs/toolchain@v1 + # - uses: actions/checkout@v3 + # - uses: dtolnay/rust-toolchain@stable # with: # toolchain: stable - # profile: minimal - # override: true # # These dependencies are required for `clipboard` # - run: sudo apt-get install -y -qq libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev - # - uses: actions-rs/cargo@v1 - # with: - # command: bench - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - components: clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings - - spellcheck: - name: Spellcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: codespell-project/actions-codespell@v1 - with: - ignore_words_file: .codespellignore + # - run: cargo bench diff --git a/.gitignore b/.gitignore index 863591b..555f146 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ book/ # direnv .direnv/ + +# nix +result diff --git a/docs/en/src/sum-type.md b/docs/en/src/sum-type.md index 777aa65..cf7f654 100644 --- a/docs/en/src/sum-type.md +++ b/docs/en/src/sum-type.md @@ -89,7 +89,7 @@ have nested types in each branch. --- If you're still confused about something, or if you found an error in this -explaination, feel free to [discuss together][5]. +explanation, feel free to [discuss together][5]. [1]: https://en.wikipedia.org/wiki/Tagged_union [2]: layout.md diff --git a/flake.lock b/flake.lock index 10d2cb9..a06872f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,91 +1,6 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs", - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1676545802, - "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", - "owner": "domenkozar", - "repo": "nix", - "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "relaxed-flakes", - "repo": "nix", - "type": "github" - } - }, "nixpkgs": { - "locked": { - "lastModified": 1657693803, - "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1689422397, "narHash": "sha256-fnopownlSBGTBYxGdTdUPM215yG/UEEj3wgheBLIbHs=", @@ -102,9 +17,7 @@ }, "root": { "inputs": { - "flake-compat": "flake-compat", - "nix": "nix", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 41ab521..b3220d1 100644 --- a/flake.nix +++ b/flake.nix @@ -3,31 +3,26 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs"; - nix.url = "github:domenkozar/nix/relaxed-flakes"; - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; }; - outputs = { self, nixpkgs, nix, ... }: + outputs = inputs@{ self, nixpkgs, ... }: let - systems = [ - "x86_64-linux" - "i686-linux" - "x86_64-darwin" - "aarch64-linux" - "aarch64-linux-android" - "aarch64-darwin" - ]; - forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems); + lib = nixpkgs.lib; + + darwin = [ "x86_64-darwin" "aarch64-darwin" ]; + linux = [ "x86_64-linux" "x86_64-linux-musl" "aarch64-linux" "aarch64-linux-android" "i86_64-linux" ]; + allSystems = darwin ++ linux; + + forEachSystem = systems: f: lib.genAttrs systems (system: f system); + forAllSystems = forEachSystem allSystems; in { packages = forAllSystems (system: let pkgs = import nixpkgs { inherit system; }; in - { + rec { + # e.g. nix build .#xplr xplr = pkgs.rustPlatform.buildRustPackage rec { name = "xplr"; src = ./.; @@ -35,6 +30,14 @@ lockFile = ./Cargo.lock; }; }; + + # e.g. nix build .#cross.x86_64-linux-musl.xplr --impure + cross = forEachSystem (lib.filter (sys: sys != system) allSystems) (targetSystem: + let + crossPkgs = import nixpkgs { localSystem = system; crossSystem = targetSystem; }; + in + { inherit (crossPkgs) xplr; } + ); } ); defaultPackage = forAllSystems (system: self.packages.${system}.xplr); @@ -55,6 +58,9 @@ default = pkgs.mkShell { RUST_BACKTRACE = 1; + # For cross compilation + NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM = 1; + buildInputs = devRequirements; packages = devRequirements; }; diff --git a/src/path.rs b/src/path.rs index 1f18725..73e2c52 100644 --- a/src/path.rs +++ b/src/path.rs @@ -216,17 +216,20 @@ mod tests { #[test] fn test_relative_to_parent() { - let path = std::env::current_dir().unwrap(); + let path = std::env::current_dir().unwrap().join("docs"); let parent = path.parent().unwrap(); - let relative = relative_to(parent, NONE).unwrap(); + let base = default().with_base(path.to_str().unwrap()); + + let relative = relative_to(parent, Some(&base)).unwrap(); assert_eq!(relative, PathBuf::from("..")); - let relative = relative_to(parent, Some(&default().with_prefix_dots())).unwrap(); + let relative = + relative_to(parent, Some(&base.clone().with_prefix_dots())).unwrap(); assert_eq!(relative, PathBuf::from("..")); let relative = - relative_to(parent, Some(&default().without_suffix_dots())).unwrap(); + relative_to(parent, Some(&base.clone().without_suffix_dots())).unwrap(); assert_eq!( relative, PathBuf::from("../..").join(parent.file_name().unwrap()) @@ -234,12 +237,12 @@ mod tests { let relative = relative_to( parent, - Some(&default().with_prefix_dots().without_suffix_dots()), + Some(&base.clone().with_prefix_dots().without_suffix_dots()), ) .unwrap(); assert_eq!( relative, - PathBuf::from("../..").join(parent.file_name().unwrap()) + PathBuf::from("../..").join(parent.clone().file_name().unwrap()) ); } From 94ba22bbcc194af36490ba38e881e70179717392 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Tue, 18 Jul 2023 22:54:05 +0530 Subject: [PATCH 2/4] Upgrade --- Cargo.lock | 84 +++++++++++++++++++++++++++++++++--------------------- Cargo.toml | 8 +++--- src/ui.rs | 1 + 3 files changed, 56 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 735e9a5..8ef9e6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,9 +62,9 @@ checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayvec" @@ -110,6 +110,9 @@ name = "bitflags" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +dependencies = [ + "serde", +] [[package]] name = "bstr" @@ -205,18 +208,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.12" +version = "4.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eab9e8ceb9afdade1ab3f0fd8dbce5b1b2f468ad653baf10e771781b2b67b73" +checksum = "8f644d0dac522c8b05ddc39aaaccc5b136d5dc4ff216610c5641e3be5becf56c" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.12" +version = "4.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2763db829349bf00cfc06251268865ed4363b93a943174f638daf3ecdba2cd" +checksum = "af410122b9778e024f9e0fb35682cc09cc3f85cad5e8d3ba8f47a9702df6e73d" dependencies = [ "anstyle", "clap_lex", @@ -485,9 +488,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f94c0e13118e7d7533271f754a168ae8400e6a1cc043f2bfd53cc7290f1a1de3" +checksum = "da96524cc884f6558f1769b6c46686af2fe8e8b4cd253bd5a3cdba8181b8e070" dependencies = [ "serde", ] @@ -634,6 +637,12 @@ dependencies = [ "serde", ] +[[package]] +name = "indoc" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4" + [[package]] name = "is-terminal" version = "0.4.9" @@ -656,9 +665,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jf" @@ -739,11 +748,12 @@ dependencies = [ [[package]] name = "luajit-src" -version = "210.4.5+resty2cf5186" +version = "210.4.6+resty2cf5186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b7992a40e602786272d84c6f2beca44a588ededcfd57b48ec6f82008a7cb97" +checksum = "c45ef28e0270605b160214758b57d97cb737b8c5f92885434b17b548fe50f117" dependencies = [ "cc", + "which", ] [[package]] @@ -944,6 +954,12 @@ dependencies = [ "windows-targets 0.48.1", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "path-absolutize" version = "3.1.0" @@ -1032,31 +1048,33 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.65" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92de25114670a878b1261c79c9f8f729fb97e95bac93f6312f583c60dd6a1dfe" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5907a1b7c277254a8b15170f6e7c97cfa60ee7872a3217663bb81151e48184bb" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] [[package]] name = "ratatui" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce841e0486e7c2412c3740168ede33adeba8e154a15107b879d8162d77c7174e" +checksum = "8285baa38bdc9f879d92c0e37cb562ef38aa3aeefca22b3200186bc39242d3d5" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.3.3", "cassowary", "crossterm", + "indoc", + "paste", "serde", "unicode-segmentation", "unicode-width", @@ -1163,15 +1181,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -1184,9 +1202,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" @@ -1210,9 +1228,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -1221,9 +1239,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.22" +version = "0.9.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452e67b9c20c37fa79df53201dc03839651086ed9bbe92b3ca585ca9fdaa7d85" +checksum = "bd5f51e3fdb5b9cdd1577e1cb7a733474191b1aca6a72c2e50913241632c1180" dependencies = [ "indexmap", "itoa", @@ -1234,9 +1252,9 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b824b6e687aff278cdbf3b36f07aa52d4bd4099699324d5da86a2ebce3aa00b3" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "libc", "signal-hook-registry", @@ -1524,9 +1542,9 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "unsafe-libyaml" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "utf8parse" diff --git a/Cargo.toml b/Cargo.toml index e6078b7..cc99bbb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,13 +25,13 @@ include = ['src/**/*', 'docs/en/src/**/*', 'LICENSE', 'README.md'] libc = "0.2.147" humansize = "2.1.3" natord = "1.0.9" -anyhow = "1.0.71" -serde_yaml = "0.9.22" +anyhow = "1.0.72" +serde_yaml = "0.9.24" crossterm = { version = "0.26.1", features = [], default-features = false } ansi-to-tui = "3.1.0" regex = "1.9.1" gethostname = "0.4.3" -serde_json = "1.0.102" +serde_json = "1.0.103" path-absolutize = "3.1.0" which = "4.4.0" nu-ansi-term = "0.48.0" @@ -57,7 +57,7 @@ version = "2.0.4" default-features = false [dependencies.tui] -version = "0.21.0" +version = "0.22.0" default-features = false features = ['crossterm', 'serde'] package = 'ratatui' diff --git a/src/ui.rs b/src/ui.rs index 9b2df90..0ee812b 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -329,6 +329,7 @@ impl Into for Style { TuiStyle { fg: self.fg, bg: self.bg, + underline_color: None, add_modifier: TuiModifier::from_bits_truncate(xor(self.add_modifiers)), sub_modifier: TuiModifier::from_bits_truncate(xor(self.sub_modifiers)), } From bf7ae3f74801a7c5692afef9839152a1c00ddac4 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Wed, 19 Jul 2023 01:10:20 +0530 Subject: [PATCH 3/4] Give up on the new platforms --- .github/workflows/cd.yml | 38 +++++++++++++++-------------------- .github/workflows/ci.yml | 36 ++++++++++++++------------------- docs/en/src/install.md | 43 ---------------------------------------- 3 files changed, 31 insertions(+), 86 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 79461ca..95f396f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -19,7 +19,7 @@ jobs: - linux-musl - aarch64-linux # - aarch64-linux-musl - - aarch64-android + # - aarch64-android # - armv7-linux rust: [stable] include: @@ -28,42 +28,36 @@ jobs: - build: macos os: macos-latest target: x86_64-apple-darwin - binary_postfix: "" - build: macos-aarch64 os: macos-latest target: aarch64-apple-darwin - binary_postfix: "" - build: linux os: ubuntu-latest target: x86_64-unknown-linux-gnu - binary_postfix: "" - build: linux-musl os: ubuntu-latest target: x86_64-unknown-linux-musl - binary_postfix: "" - - build: aarch64-linux - os: ubuntu-latest - target: aarch64-unknown-linux-gnu - binary_postfix: "" + # TODO: make these work + # + # - build: aarch64-linux + # os: ubuntu-latest + # target: aarch64-unknown-linux-gnu # - build: aarch64-linux-musl # os: ubuntu-latest # target: aarch64-unknown-linux-musl - # binary_postfix: "" - - build: aarch64-android - os: ubuntu-latest - target: aarch64-linux-android - binary_postfix: "" + # - build: aarch64-android + # os: ubuntu-latest + # target: aarch64-linux-android # - build: armv7-linux # os: ubuntu-latest # target: armv7-unknown-linux-gnueabihf - # binary_postfix: "" steps: - uses: actions/checkout@v3 @@ -82,13 +76,13 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update --fix-missing - sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev - - - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') - run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross + sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev gcc musl-tools pkg-config - - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') - run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross + # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') + # run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross + # + # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') + # run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross - name: Running cargo build run: cargo build --locked --release --target ${{ matrix.target }} @@ -102,7 +96,7 @@ jobs: shell: bash run: | cd target/${{ matrix.target }}/release - BINARY_NAME=xplr${{ matrix.binary_postfix }} + BINARY_NAME=xplr strip $BINARY_NAME RELEASE_NAME=xplr-${{ matrix.build }} tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3062e6a..3ac04b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: - linux-musl - aarch64-linux # - aarch64-linux-musl - - aarch64-android + # - aarch64-android # - armv7-linux rust: [stable] include: @@ -74,42 +74,36 @@ jobs: - build: macos os: macos-latest target: x86_64-apple-darwin - binary_postfix: "" - build: macos-aarch64 os: macos-latest target: aarch64-apple-darwin - binary_postfix: "" - build: linux os: ubuntu-latest target: x86_64-unknown-linux-gnu - binary_postfix: "" - build: linux-musl os: ubuntu-latest target: x86_64-unknown-linux-musl - binary_postfix: "" - - build: aarch64-linux - os: ubuntu-latest - target: aarch64-unknown-linux-gnu - binary_postfix: "" + # TODO: make these work + # + # - build: aarch64-linux + # os: ubuntu-latest + # target: aarch64-unknown-linux-gnu # - build: aarch64-linux-musl # os: ubuntu-latest # target: aarch64-unknown-linux-musl - # binary_postfix: "" - - build: aarch64-android - os: ubuntu-latest - target: aarch64-linux-android - binary_postfix: "" + # - build: aarch64-android + # os: ubuntu-latest + # target: aarch64-linux-android # - build: armv7-linux # os: ubuntu-latest # target: armv7-unknown-linux-gnueabihf - # binary_postfix: "" env: RUST_BACKTRACE: full @@ -130,13 +124,13 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update --fix-missing - sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev - - - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') - run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross + sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev gcc musl-tools pkg-config - - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') - run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross + # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') + # run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross + # + # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') + # run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross - run: cargo build --target ${{ matrix.target }} - run: cargo test --target ${{ matrix.target }} diff --git a/docs/en/src/install.md b/docs/en/src/install.md index 40f449c..88d93f8 100644 --- a/docs/en/src/install.md +++ b/docs/en/src/install.md @@ -196,47 +196,6 @@ cargo build --locked --release --bin xplr sudo cp target/release/xplr /usr/local/bin/ ``` -## Android - -### [Termux][23] - -[![xplr-termuxfd3c398d3cf4bcbc.md.jpg][24]][25] - -> Please note that xplr isn't heavily tested on Termux, hence things might -> need a little tweaking and fixing for a smooth usage experience. - -- Install build dependencies - - ```bash - pkg install rustc cargo make - ``` - -- Install `xplr` - - ```bash - cargo install --locked --force xplr - ``` - -- Setup storage - - ```bash - termux-setup-storage - ``` - -- Setup config and runtime dir - - ```bash - export XDG_CONFIG_HOME="$PWD/storage/.config" - export XDG_RUNTIME_DIR="$PWD/storage/run" - - mkdir -p "$XDG_CONFIG_HOME" "$XDG_RUNTIME_DIR" - ``` - -- Run - ```bash - ~/.cargo/bin/xplr - ``` - [1]: #direct-download [2]: #from-cratesio [3]: #build-from-source @@ -259,8 +218,6 @@ sudo cp target/release/xplr /usr/local/bin/ [20]: https://gcc.gnu.org/ [21]: https://www.gnu.org/software/make/ [22]: https://git-scm.com/ -[23]: https://termux.com/ -[24]: https://s3.gifyu.com/images/xplr-termuxfd3c398d3cf4bcbc.md.jpg [25]: https://gifyu.com/image/tF2D [26]: https://github.com/sayanarijit/xplr/releases/latest/download/xplr-linux-musl.tar.gz [27]: https://pkgs.alpinelinux.org/packages?name=xplr From 56472998f5728bc1e3fb4dd23f248079bc28b26c Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Wed, 19 Jul 2023 03:04:44 +0530 Subject: [PATCH 4/4] Don't give up yet --- .cargo/config | 10 ++++++++ .github/workflows/cd.yml | 46 ++++++++++++++++-------------------- .github/workflows/ci.yml | 50 ++++++++++++++++++---------------------- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/.cargo/config b/.cargo/config index e82ae86..0a661cc 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,4 +1,14 @@ # Why dynamic linking? # See https://github.com/sayanarijit/xplr/issues/309 + [target.x86_64-unknown-linux-gnu] rustflags = ["-C", "link-args=-rdynamic"] + +[target.aarch64-unknown-linux-gnu] +rustflags = ["-C", "linker=aarch64-linux-gnu-gcc", "-C", "link-args=-rdynamic"] + +[target.aarch64-linux-android] +rustflags = ["-C", "linker=aarch64-linux-android-clang", "-C", "link-args=-rdynamic"] + +[target.arm-unknown-linux-gnueabihf] +rustflags = ["-C", "linker=arm-linux-gnueabihf-gcc", "-C", "link-args=-rdynamic"] diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 95f396f..e5d37d3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,10 +17,8 @@ jobs: - macos-aarch64 - linux - linux-musl - - aarch64-linux - # - aarch64-linux-musl - # - aarch64-android - # - armv7-linux + - linux-aarch64 + - linux-arm rust: [stable] include: # See the list: https://github.com/cross-rs/cross @@ -41,23 +39,13 @@ jobs: os: ubuntu-latest target: x86_64-unknown-linux-musl - # TODO: make these work - # - # - build: aarch64-linux - # os: ubuntu-latest - # target: aarch64-unknown-linux-gnu - - # - build: aarch64-linux-musl - # os: ubuntu-latest - # target: aarch64-unknown-linux-musl - - # - build: aarch64-android - # os: ubuntu-latest - # target: aarch64-linux-android + - build: linux-aarch64 + os: ubuntu-latest + target: aarch64-unknown-linux-gnu - # - build: armv7-linux - # os: ubuntu-latest - # target: armv7-unknown-linux-gnueabihf + - build: linux-arm + os: ubuntu-latest + target: arm-unknown-linux-gnueabihf steps: - uses: actions/checkout@v3 @@ -76,13 +64,19 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update --fix-missing - sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev gcc musl-tools pkg-config + sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev gcc pkg-config curl git make ca-certificates - # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') - # run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross - # - # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') - # run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross + - if: matrix.build == 'linux-musl' + run: sudo apt-get install -y musl-tools + + - if: matrix.build == 'linux-aarch64' + run: sudo apt-get install -y gcc-aarch64-linux-gnu + + - if: matrix.build == 'linux-arm' + run: | + sudo apt-get install -y gcc-multilib + sudo apt-get install -y gcc-arm-linux-gnueabihf + sudo ln -s /usr/include/asm-generic/ /usr/include/asm - name: Running cargo build run: cargo build --locked --release --target ${{ matrix.target }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ac04b6..9c69dc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,10 +63,8 @@ jobs: - macos-aarch64 - linux - linux-musl - - aarch64-linux - # - aarch64-linux-musl - # - aarch64-android - # - armv7-linux + - linux-aarch64 + - linux-arm rust: [stable] include: # See the list: https://github.com/cross-rs/cross @@ -87,23 +85,13 @@ jobs: os: ubuntu-latest target: x86_64-unknown-linux-musl - # TODO: make these work - # - # - build: aarch64-linux - # os: ubuntu-latest - # target: aarch64-unknown-linux-gnu - - # - build: aarch64-linux-musl - # os: ubuntu-latest - # target: aarch64-unknown-linux-musl - - # - build: aarch64-android - # os: ubuntu-latest - # target: aarch64-linux-android + - build: linux-aarch64 + os: ubuntu-latest + target: aarch64-unknown-linux-gnu - # - build: armv7-linux - # os: ubuntu-latest - # target: armv7-unknown-linux-gnueabihf + - build: linux-arm + os: ubuntu-latest + target: arm-unknown-linux-gnueabihf env: RUST_BACKTRACE: full @@ -124,16 +112,24 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update --fix-missing - sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev gcc musl-tools pkg-config + sudo apt-get install -y --no-install-recommends liblua5.1-0-dev libluajit-5.1-dev gcc pkg-config curl git make ca-certificates - # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'armv7') - # run: sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross - # - # - if: matrix.os == 'ubuntu-latest' && contains(matrix.build, 'aarch64') - # run: sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross + - if: matrix.build == 'linux-musl' + run: sudo apt-get install -y musl-tools + + - if: matrix.build == 'linux-aarch64' + run: sudo apt-get install -y gcc-aarch64-linux-gnu + + - if: matrix.build == 'linux-arm' + run: | + sudo apt-get install -y gcc-multilib + sudo apt-get install -y gcc-arm-linux-gnueabihf + sudo ln -s /usr/include/asm-generic/ /usr/include/asm - run: cargo build --target ${{ matrix.target }} - - run: cargo test --target ${{ matrix.target }} + + - if: matrix.build == 'macos' || matrix.build == 'linux' + run: cargo test --target ${{ matrix.target }} # bench: # name: Benchmarks