From d697fe0e407bbf25afbb9bdcd171e81ab26f6325 Mon Sep 17 00:00:00 2001 From: iHsin Date: Wed, 6 Nov 2024 10:34:47 +0800 Subject: [PATCH 1/7] ci: add android target --- .github/workflows/ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b21d59b3..048730d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,6 +182,23 @@ jobs: cross: false extra-args: -F "shadowsocks, tuic, onion" rustflags: "-Ctarget-feature=+crt-static --cfg tokio_unstable" + # Android + - os: ubuntu-latest + target: aarch64-linux-android + cross: true + extra-args: -F "shadowsocks, tuic, onion" + - os: ubuntu-latest + target: armv7-linux-androideabi + cross: true + extra-args: -F "shadowsocks, tuic, onion" + - os: ubuntu-latest + target: x86_64-linux-android + cross: true + extra-args: -F "shadowsocks, tuic, onion" + - os: ubuntu-latest + target: i686-linux-android + cross: true + extra-args: -F "shadowsocks, tuic, onion" # Linux mips: tier-3, pity # Windows gnu: tokio dont work # Windows aarch: todo From fcf6ca10ae69345d4f8f88325194a1d5e50079e1 Mon Sep 17 00:00:00 2001 From: iHsin Date: Wed, 6 Nov 2024 19:54:41 +0800 Subject: [PATCH 2/7] ci: use latest cross --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 048730d7..5a0d0042 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -226,7 +226,10 @@ jobs: toolchain: ${{ matrix.toolchain || 'nightly' }} target: ${{ matrix.target }} components: ${{ matrix.components || 'rustfmt, clippy' }} - + - name: Install cross + if: ${{ matrix.cross }} + run: | + cargo install cross --git https://github.com/cross-rs/cross - name: Install Protoc uses: arduino/setup-protoc@v3 with: From 8f1744db8e24ccc85ef09cbdc551a0b6c2e400d2 Mon Sep 17 00:00:00 2001 From: iHsin Date: Wed, 6 Nov 2024 22:23:56 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20ci.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a0d0042..6e7836f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -229,6 +229,7 @@ jobs: - name: Install cross if: ${{ matrix.cross }} run: | + rm -f ~/.cargo/bin/cross cargo install cross --git https://github.com/cross-rs/cross - name: Install Protoc uses: arduino/setup-protoc@v3 From aa591ad192524dc1a34850e79768bff94f1453ba Mon Sep 17 00:00:00 2001 From: iHsin Date: Wed, 6 Nov 2024 23:12:58 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20ci.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e7836f6..f9264cfc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -229,7 +229,7 @@ jobs: - name: Install cross if: ${{ matrix.cross }} run: | - rm -f ~/.cargo/bin/cross + rm -f ~/.cargo/bin/cross* cargo install cross --git https://github.com/cross-rs/cross - name: Install Protoc uses: arduino/setup-protoc@v3 From 7a4d8d0bc74f8ee664b9d95826c30cd03907dd1f Mon Sep 17 00:00:00 2001 From: iHsin Date: Wed, 6 Nov 2024 23:32:24 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20ci.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9264cfc..1219a1d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -245,7 +245,6 @@ jobs: - name: Cargo fmt uses: clechasseur/rs-cargo@v2 with: - use-cross: ${{ matrix.cross }} command: fmt args: --all -- --check env: From 9d7f299656645959c13a7f19e25fd9b8e41671ba Mon Sep 17 00:00:00 2001 From: dev0 Date: Fri, 8 Nov 2024 01:53:38 +1100 Subject: [PATCH 6/7] up --- clash_lib/src/proxy/utils/test_utils/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clash_lib/src/proxy/utils/test_utils/mod.rs b/clash_lib/src/proxy/utils/test_utils/mod.rs index c54336b3..cb0bd1e2 100644 --- a/clash_lib/src/proxy/utils/test_utils/mod.rs +++ b/clash_lib/src/proxy/utils/test_utils/mod.rs @@ -34,7 +34,7 @@ pub async fn ping_pong_test( let sess = Session { destination: ( - if cfg!(target_os = "linux") { + if cfg!(any(target_os = "linux", target_os = "android")) { "127.0.0.1".to_owned() } else { "host.docker.internal".to_owned() @@ -152,7 +152,7 @@ pub async fn ping_pong_udp_test( .try_into() .unwrap_or_else(|_| panic!("")); let dst: SocksAddr = ( - if cfg!(target_os = "linux") { + if cfg!(any(target_os = "linux", target_os = "android")) { "127.0.0.1".to_owned() } else { "host.docker.internal".to_owned() From fa84a2cb1ec734f6f550b1df98896210d98a347e Mon Sep 17 00:00:00 2001 From: dev0 Date: Fri, 8 Nov 2024 02:11:48 +1100 Subject: [PATCH 7/7] up --- clash_lib/src/app/dns/resolver/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clash_lib/src/app/dns/resolver/mod.rs b/clash_lib/src/app/dns/resolver/mod.rs index d5aabf26..db5efa28 100644 --- a/clash_lib/src/app/dns/resolver/mod.rs +++ b/clash_lib/src/app/dns/resolver/mod.rs @@ -1,9 +1,9 @@ mod enhanced; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] #[path = "system_linux.rs"] mod system; -#[cfg(not(target_os = "linux"))] +#[cfg(all(not(target_os = "linux"), not(target_os = "android")))] #[path = "system_non_linux.rs"] mod system;