diff --git a/.cargo/config.toml b/.cargo/config.toml index e3e5301c4..4e52ead7c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,7 @@ [env] +MACOSX_DEPLOYMENT_TARGET = "10.11" +JEMALLOC_SYS_WITH_LG_PAGE = "16" + # environment variable for tikv-jemalloc-sys # # https://jemalloc.net/jemalloc.3.html#opt.narenas diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index d6a457cb3..d37f59faa 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -21,13 +21,7 @@ jobs: rustup toolchain install stable --profile minimal rustup component add clippy - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rust - shared-key: ubuntu-latest@debug - - - name: Run sccache-cache + - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - name: Clippy @@ -44,13 +38,7 @@ jobs: rustup toolchain install nightly --profile minimal rustup component add rustfmt --toolchain nightly - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rust - shared-key: ubuntu-latest@debug - - - name: Run sccache-cache + - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - name: Rustfmt diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml index ac5ae348e..b9fca1146 100644 --- a/.github/workflows/draft.yml +++ b/.github/workflows/draft.yml @@ -26,6 +26,8 @@ jobs: - os: macos-latest target: aarch64-apple-darwin runs-on: ${{ matrix.os }} + env: + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc steps: - uses: actions/checkout@v4 @@ -33,19 +35,11 @@ jobs: if: matrix.target == 'aarch64-unknown-linux-gnu' run: | sudo apt-get update && sudo apt-get install -yq gcc-aarch64-linux-gnu - echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV - echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV - name: Setup Rust toolchain run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }} - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rust - shared-key: ${{ matrix.target }}@release - - - name: Run sccache-cache + - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - name: Build @@ -66,27 +60,21 @@ jobs: - os: windows-latest target: aarch64-pc-windows-msvc runs-on: ${{ matrix.os }} + env: + YAZI_GEN_COMPLETIONS: true + CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER: lld-link.exe + CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER: lld-link.exe steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }} - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rust - shared-key: ${{ matrix.target }}@release - - - name: Run sccache-cache + - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - name: Build - env: - YAZI_GEN_COMPLETIONS: true - run: | - cargo build -p yazi-cli --release --locked --target ${{ matrix.target }} - cargo build -p yazi-fm --release --locked --target ${{ matrix.target }} + run: cargo build --release --locked --target ${{ matrix.target }} - name: Pack artifact if: matrix.os == 'windows-latest' @@ -123,13 +111,7 @@ jobs: - name: Add musl target run: rustup target add ${{ matrix.target }} - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rust - shared-key: ${{ matrix.target }}@release - - - name: Run sccache-cache + - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - name: Build @@ -151,13 +133,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rust - shared-key: ${{ matrix.target }}@release - - - name: Run sccache-cache + - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - name: Build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5b70c305b..2d2e2d472 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,13 +23,7 @@ jobs: - name: Setup Rust toolchain run: rustup toolchain install stable --profile minimal - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rust - shared-key: ${{ matrix.os }}@debug - - - name: Run sccache-cache + - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.6 - name: Build diff --git a/scripts/build.sh b/scripts/build.sh index 5c473c96c..bc6a7ea0d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -3,7 +3,6 @@ set -euo pipefail export ARTIFACT_NAME="yazi-$1" export YAZI_GEN_COMPLETIONS=1 -export MACOSX_DEPLOYMENT_TARGET="10.11" # Build for the target cargo build --release --locked --target "$1" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a8ea3d124..58e734b37 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -26,8 +26,29 @@ parts: override-build: | craftctl default craftctl set version=$(git describe --tags --abbrev=0) - cargo install fd-find --root $CRAFT_PART_INSTALL - cargo install ripgrep --root $CRAFT_PART_INSTALL - cargo install zoxide --root $CRAFT_PART_INSTALL - git clone --depth 1 https://github.com/junegunn/fzf.git fzf - fzf/install --bin && mv fzf/bin/fzf $CRAFT_PART_INSTALL/bin/ + + wget ripgrep-14.1.1-aarch64-unknown-linux-gnu.tar.gz + tar fxz ripgrep-*.tar.gz + mv ripgrep-*/rg $CRAFT_PART_INSTALL/bin/ + + wget https://github.com/ajeetdsouza/zoxide/releases/download/v0.9.6/zoxide-0.9.6-x86_64-unknown-linux-musl.tar.gz + tar fxz zoxide-*.tar.gz + mv zoxide-*/zoxide $CRAFT_PART_INSTALL/bin/ + + wget https://github.com/sharkdp/fd/releases/download/v10.2.0/fd-v10.2.0-aarch64-unknown-linux-gnu.tar.gz + tar fxz fd-*.tar.gz + mv fd-*/fd $CRAFT_PART_INSTALL/bin/ + + wget https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64 + mv jq-linux-amd64 $CRAFT_PART_INSTALL/bin/jq + + wget https://imagemagick.org/archive/binaries/magick + mv magick $CRAFT_PART_INSTALL/bin/magick + + wget https://github.com/junegunn/fzf/releases/download/v0.56.2/fzf-0.56.2-linux_amd64.tar.gz + tar fxz fzf-*.tar.gz + mv fzf $CRAFT_PART_INSTALL/bin/ + + wget https://www.7-zip.org/a/7z2408-linux-x64.tar.xz + tar fxz 7z*.tar.xz + mv 7zz 7zzs $CRAFT_PART_INSTALL/bin/ diff --git a/yazi-plugin/src/bindings/cha.rs b/yazi-plugin/src/bindings/cha.rs index b5626d0ad..8ccca8ce4 100644 --- a/yazi-plugin/src/bindings/cha.rs +++ b/yazi-plugin/src/bindings/cha.rs @@ -1,10 +1,11 @@ use std::{ops::Deref, time::{Duration, SystemTime, UNIX_EPOCH}}; -use mlua::{ExternalError, IntoLua, Lua, Table, UserData, UserDataFields, UserDataMethods}; +use mlua::{ExternalError, FromLua, IntoLua, Lua, Table, UserData, UserDataFields, UserDataMethods}; use yazi_shared::fs::ChaKind; use crate::RtRef; +#[derive(Clone, Copy, FromLua)] pub struct Cha(yazi_shared::fs::Cha); impl Deref for Cha { diff --git a/yazi-plugin/src/file/file.rs b/yazi-plugin/src/file/file.rs index 61de7b680..e90e6990e 100644 --- a/yazi-plugin/src/file/file.rs +++ b/yazi-plugin/src/file/file.rs @@ -1,6 +1,6 @@ use mlua::{AnyUserData, Lua, Table, UserDataRef}; -use crate::{bindings::Cast, impl_file_fields, impl_file_methods}; +use crate::{bindings::{Cast, Cha}, impl_file_fields, impl_file_methods}; pub type FileRef = UserDataRef; @@ -21,7 +21,7 @@ impl File { lua.create_function(|lua, t: Table| { Self::cast(lua, yazi_shared::fs::File { url: t.raw_get::("url")?.take()?, - cha: t.raw_get::("cha")?.take()?, + cha: *t.raw_get::("cha")?, ..Default::default() }) })?,