Skip to content

Commit d11fa21

Browse files
committed
chore: add matrix build for debug/release and zygisk options
1 parent f5d6903 commit d11fa21

5 files changed

Lines changed: 31 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616

17+
strategy:
18+
matrix:
19+
profile: [debug, release]
20+
zygisk: [true, false]
21+
1722
steps:
1823
- name: Checkout
1924
uses: actions/checkout@v6
@@ -37,4 +42,12 @@ jobs:
3742
run: cargo install bpf-linker
3843

3944
- name: Build
40-
run: just build-release
45+
run: just build-${{ matrix.profile }} ${{ matrix.zygisk == false && 'no-zygisk' || '' }}
46+
47+
- name: Upload artifact
48+
uses: actions/upload-artifact@v6
49+
with:
50+
name: zynx-${{ matrix.profile }}-${{ matrix.zygisk == false && 'no' || '' }}zygisk
51+
path: |
52+
target/aarch64-linux-android/${{ matrix.profile }}/zynx
53+
target/aarch64-linux-android/${{ matrix.profile }}/zynx.dwp

justfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ HOST_TAG := (if os() == "macos" { "darwin" } else { os() }) + "-x86_64"
77

88
export CC := env("ANDROID_NDK") / "toolchains/llvm/prebuilt" / HOST_TAG / "bin" / ("aarch64-linux-android" + TARGET_SDK + "-clang")
99

10-
build-debug:
10+
build-debug features="":
1111
cargo build \
1212
--target aarch64-linux-android \
13-
--config target.aarch64-linux-android.linker=\"{{CC}}\"
13+
--config target.aarch64-linux-android.linker=\"{{CC}}\" \
14+
{{ if features == "no-zygisk" { "--no-default-features" } else { "" } }}
1415
15-
build-release:
16+
build-release features="":
1617
PROFILE=release cargo build \
1718
--target aarch64-linux-android \
1819
--config target.aarch64-linux-android.linker=\"{{CC}}\" \
19-
--release
20+
--release \
21+
{{ if features == "no-zygisk" { "--no-default-features" } else { "" } }}
2022
2123
run-emulator: build-debug
2224
adb push target/aarch64-linux-android/debug/zynx /data/local/tmp/zynx

src/bridge-shared/src/remote_lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use anyhow::{Context, Error, Result, anyhow, bail};
22
use jni::JNIEnv;
3-
use jni::objects::{GlobalRef, JClass, JObject, JString, JValue};
3+
use jni::objects::{GlobalRef, JClass, JObject, JValue};
44
use jni::strings::JavaStr;
55
use log::{info, warn};
6-
use nix::libc::{RTLD_NOW, c_int, off64_t, size_t, PROT_READ, MAP_PRIVATE, MAP_FAILED};
6+
use nix::libc;
7+
use nix::libc::{MAP_FAILED, MAP_PRIVATE, PROT_READ, RTLD_NOW, c_int, off64_t, size_t};
78
use std::ffi::{CStr, CString, c_void};
89
use std::fs::File;
910
use std::os::fd::{AsRawFd, FromRawFd, OwnedFd, RawFd};
1011
use std::ptr;
11-
use nix::libc;
1212

1313
mod system {
1414
use crate::remote_lib::DlextInfo;
@@ -170,7 +170,11 @@ impl JavaLibrary {
170170
let fd = self.fd.take().context("duplicate called")?;
171171
let file: File = fd.into();
172172

173-
info!("loading java library: {}, fd = {}", self.name, file.as_raw_fd());
173+
info!(
174+
"loading java library: {}, fd = {}",
175+
self.name,
176+
file.as_raw_fd()
177+
);
174178

175179
let file_size = file.metadata()?.len() as usize;
176180
let mut file_data = vec![0; file_size];
@@ -182,7 +186,7 @@ impl JavaLibrary {
182186
PROT_READ,
183187
MAP_PRIVATE,
184188
file.as_raw_fd(),
185-
0
189+
0,
186190
);
187191

188192
if addr == MAP_FAILED {

src/bridge/src/injector.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::collections::HashMap;
99
use zynx_bridge_shared::injector::ProviderHandler;
1010
use zynx_bridge_shared::remote_lib::Libraries;
1111
use zynx_bridge_shared::zygote::{ProviderType, SpecializeArgs};
12+
#[cfg(feature = "zygisk")]
1213
use zynx_zygisk_compat::ZygiskProviderHandler;
1314

1415
#[allow(clippy::type_complexity)]

src/core/src/injector/app/policy.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ mod zygisk;
66
use crate::android::packages::PackageInfoListLocked;
77
use crate::injector::app::policy::debugger::DebuggerPolicyProvider;
88
use crate::injector::app::policy::liteloader::LiteLoaderPolicyProvider;
9+
#[cfg(feature = "zygisk")]
910
use crate::injector::app::policy::zygisk::ZygiskPolicyProvider;
1011
use anyhow::{Result, anyhow};
1112
use async_trait::async_trait;

0 commit comments

Comments
 (0)