Skip to content

Commit 00e7967

Browse files
KM-11358: Fix shadowsocks binary not available in bundle (#23)
* Revert "KM-10987: Obfuscator 16kb compat (#22)" This reverts commit 4aa3229. * KM-11358: Fix binary not available in bundle
1 parent 4aa3229 commit 00e7967

File tree

199 files changed

+4147
-67552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+4147
-67552
lines changed

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id("com.android.library") version "8.4.2" apply false
4-
id("org.jetbrains.kotlin.android") version "2.2.0" apply false
3+
id("com.android.library") version "8.2.0" apply false
4+
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
55
id("org.jlleitschuh.gradle.ktlint") version "11.5.1" apply true
6-
id("org.mozilla.rust-android-gradle.rust-android") version "0.9.6" apply false
6+
id("org.mozilla.rust-android-gradle.rust-android") version "0.9.3" apply false
77
id("maven-publish") apply true
88
}
99

1010
allprojects {
1111
group = "com.kape.android"
12-
version = "0.1.0"
12+
version = "0.1.1"
1313
apply(plugin = "org.jlleitschuh.gradle.ktlint")
1414
apply(plugin = "maven-publish")
1515
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Tue Dec 12 13:54:33 CET 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

obfuscator/build.gradle.kts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ plugins {
1010
android {
1111
namespace = "com.kape.obfuscator"
1212
ndkVersion = sdkDirectory.resolve("ndk").listFilesOrdered().last().name
13+
// ndkVersion = "26.1.10909125"
1314

14-
compileSdk = 36
15+
compileSdk = 34
1516
defaultConfig {
1617
minSdk = 24
17-
externalNativeBuild.ndkBuild {
18-
abiFilters("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
19-
arguments("-j${Runtime.getRuntime().availableProcessors()}")
18+
ndk {
19+
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
2020
}
2121
}
2222

@@ -38,16 +38,14 @@ android {
3838
}
3939
}
4040

41-
kotlin {
42-
jvmToolchain(17)
43-
}
44-
4541
cargo {
4642
module = "src/main/rust/shadowsocks-rust"
4743
libname = "sslocal"
4844
targets = listOf("arm", "arm64", "x86", "x86_64")
4945
profile = "release"
5046
extraCargoBuildArguments = listOf("--bin", libname!!)
47+
cargoCommand = "${System.getProperty("user.home")}/.cargo/bin/cargo"
48+
rustcCommand = "${System.getProperty("user.home")}/.cargo/bin/rustc"
5149
features {
5250
noDefaultBut(
5351
arrayOf(
@@ -64,20 +62,11 @@ cargo {
6462
exec = { spec, toolchain ->
6563
run {
6664
try {
67-
Runtime.getRuntime().exec(arrayOf("python3", "-V"))
65+
Runtime.getRuntime().exec("python3 -V >/dev/null 2>&1")
6866
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python3")
69-
project.logger.lifecycle("Python 3 detected.")
7067
} catch (e: java.io.IOException) {
71-
project.logger.lifecycle("No python 3 detected.")
72-
try {
73-
Runtime.getRuntime().exec(arrayOf("python", "-V"))
74-
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python")
75-
project.logger.lifecycle("Python detected.")
76-
} catch (e: java.io.IOException) {
77-
throw GradleException("No any python version detected. You should install the python first to compile project.")
78-
}
68+
throw GradleException("Please install Python3 in order to compile.")
7969
}
80-
// https://developer.android.com/guide/practices/page-sizes#other-build-systems
8170
spec.environment("RUST_ANDROID_GRADLE_CC_LINK_ARG", "-Wl,-z,max-page-size=16384,-soname,lib$libname.so")
8271
spec.environment("RUST_ANDROID_GRADLE_LINKER_WRAPPER_PY", "$projectDir/$module/../linker-wrapper.py")
8372
spec.environment("RUST_ANDROID_GRADLE_TARGET", "target/${toolchain.target}/$profile/lib$libname.so")
@@ -86,11 +75,15 @@ cargo {
8675
}
8776

8877
tasks.whenTaskAdded {
89-
when (name) {
90-
"mergeDebugJniLibFolders", "mergeReleaseJniLibFolders" -> dependsOn("cargoBuild")
78+
if (this.name == "javaPreCompileDebug" || this.name == "javaPreCompileRelease") {
79+
this.dependsOn("cargoBuild")
9180
}
9281
}
9382

83+
kotlin {
84+
jvmToolchain(17)
85+
}
86+
9487
dependencies {
95-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
88+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
9689
}

obfuscator/src/main/rust/shadowsocks-rust/.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
windows: circleci/windows@5.1.0
4+
windows: circleci/windows@2.4.0
55

66
jobs:
77
build-linux:
@@ -186,7 +186,7 @@ jobs:
186186

187187
publish-github-releases:
188188
docker:
189-
- image: circleci/golang:1.17
189+
- image: circleci/golang:1.12
190190
steps:
191191
- attach_workspace:
192192
at: /tmp/workspace

obfuscator/src/main/rust/shadowsocks-rust/.github/dependabot.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,23 @@ updates:
44
directory: "/"
55
schedule:
66
interval: weekly
7-
open-pull-requests-limit: 0
7+
open-pull-requests-limit: 10
8+
ignore:
9+
- dependency-name: libc
10+
versions:
11+
- 0.2.92
12+
- dependency-name: tokio
13+
versions:
14+
- 1.4.0
15+
- dependency-name: bloomfilter
16+
versions:
17+
- 1.0.5
18+
- dependency-name: regex
19+
versions:
20+
- 1.4.5
21+
- dependency-name: serde
22+
versions:
23+
- 1.0.124
24+
- dependency-name: tower
25+
versions:
26+
- 0.4.6
Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name: Build & Test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
48

59
env:
610
CARGO_TERM_COLOR: always
711
RUST_LOG: "trace"
812

913
jobs:
10-
build-and-test:
14+
buid-test-check:
1115
strategy:
1216
matrix:
1317
platform:
@@ -17,16 +21,8 @@ jobs:
1721
runs-on: ${{ matrix.platform }}
1822

1923
steps:
20-
- if: ${{ matrix.platform == 'ubuntu-latest' }}
21-
name: Free Disk Space (Ubuntu)
22-
uses: jlumbroso/free-disk-space@main
23-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v3
2425
- uses: Swatinem/rust-cache@v2
25-
- if: ${{ runner.os == 'Windows' }}
26-
uses: ilammy/setup-nasm@v1
27-
- if: ${{ matrix.platform == 'ubuntu-latest' }}
28-
name: Install LLVM and Clang
29-
run: sudo apt update && sudo apt install -y clang
3026
- name: Install Rust
3127
run: |
3228
rustup set profile minimal
@@ -35,10 +31,6 @@ jobs:
3531
rustup override set stable
3632
- name: Build & Test (Default)
3733
run: cargo test --verbose --no-fail-fast
38-
- name: Build & Test (full)
39-
run: cargo test --features "full" --verbose --no-fail-fast
40-
- name: Build & Test (full-extra)
41-
run: cargo test --features "full-extra" --verbose --no-fail-fast
4234
- name: Build & Test (Default) - shadowsocks
4335
run: cargo test --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --no-fail-fast
4436
- name: Build & Test (--no-default-features)
@@ -47,9 +39,9 @@ jobs:
4739
run: cargo test --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --no-default-features --no-fail-fast
4840
- name: Build with All Features Enabled (Unix)
4941
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
50-
run: cargo build --verbose --features "full-extra local-flow-stat utility-url-outline"
42+
run: cargo build --verbose --features "local-http-rustls local-redir local-dns local-tun dns-over-tls dns-over-https stream-cipher aead-cipher-2022"
5143
- name: Build with All Features Enabled (Windows)
5244
if: ${{ runner.os == 'Windows' }}
53-
run: cargo build --verbose --features "full-extra local-flow-stat utility-url-outline winservice"
45+
run: cargo build --verbose --features "local-http-rustls local-dns dns-over-tls dns-over-https stream-cipher aead-cipher-2022"
5446
- name: Build with All Features Enabled - shadowsocks
55-
run: cargo build --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --features "stream-cipher aead-cipher-extra aead-cipher-2022 aead-cipher-2022-extra security-replay-attack-detect"
47+
run: cargo build --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --features "stream-cipher aead-cipher-2022"

obfuscator/src/main/rust/shadowsocks-rust/.github/workflows/build-docker-image.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- v*
66

77
jobs:
8-
build-docker-image:
8+
build:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
@@ -14,22 +14,22 @@ jobs:
1414
- sslocal
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v3
1818
- name: Setup Docker Buildx
19-
uses: docker/setup-buildx-action@v3
19+
uses: docker/setup-buildx-action@v2
2020
- name: Login to GitHub Container Registry
21-
uses: docker/login-action@v3
21+
uses: docker/login-action@v2
2222
with:
2323
registry: ghcr.io
2424
username: ${{ github.repository_owner }}
2525
password: ${{ secrets.GITHUB_TOKEN }}
2626
- name: Docker metadata
2727
id: metadata
28-
uses: docker/metadata-action@v5
28+
uses: docker/metadata-action@v4
2929
with:
3030
images: ghcr.io/${{ github.repository_owner }}/${{ matrix.bin }}-rust
3131
- name: Build and release Docker images
32-
uses: docker/build-push-action@v6
32+
uses: docker/build-push-action@v3
3333
with:
3434
platforms: linux/386,linux/amd64,linux/arm64/v8
3535
target: ${{ matrix.bin }}

obfuscator/src/main/rust/shadowsocks-rust/.github/workflows/build-msrv.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)