Skip to content

Commit 05a106f

Browse files
committed
Revert "KM-10987: Obfuscator 16kb compat (#22)"
This reverts commit 4aa3229.
1 parent 4aa3229 commit 05a106f

File tree

201 files changed

+4179
-67559
lines changed

Some content is hidden

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

201 files changed

+4179
-67559
lines changed

.github/workflows/build-android.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
run: ./gradlew clean assembleDebug --info
2222
- name: build release
2323
run: ./gradlew clean assembleRelease --info
24-
- uses: actions/upload-artifact@v4
24+
- uses: actions/upload-artifact@v3
2525
with:
2626
name: testapp-apk
2727
path: testapp/build/outputs/apk/
2828
if-no-files-found: error
29-
- uses: actions/upload-artifact@v4
29+
- uses: actions/upload-artifact@v3
3030
with:
3131
name: obfuscator-aars
3232
path: obfuscator/build/outputs/aar/

.github/workflows/semgrep.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Security / Semgrep
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
semgrep:
11+
name: Security / Semgrep
12+
runs-on: ubuntu-latest
13+
container:
14+
image: semgrep/semgrep:1.68.0
15+
if: (github.actor != 'dependabot[bot]')
16+
steps:
17+
- name: Checkout source repository
18+
uses: actions/checkout@v4
19+
- name: Scan with Semgrep
20+
env:
21+
# Connect to Semgrep Cloud Platform
22+
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
23+
run: |
24+
semgrep ci \
25+
--code \
26+
--secrets \
27+
--supply-chain \
28+
--pro \
29+
--no-suppress-errors

build.gradle.kts

Lines changed: 3 additions & 3 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 {
33
id("com.android.library") version "8.4.2" apply false
4-
id("org.jetbrains.kotlin.android") version "2.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.0.4"
1313
apply(plugin = "org.jlleitschuh.gradle.ktlint")
1414
apply(plugin = "maven-publish")
1515
}

obfuscator/build.gradle.kts

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ android {
1111
namespace = "com.kape.obfuscator"
1212
ndkVersion = sdkDirectory.resolve("ndk").listFilesOrdered().last().name
1313

14-
compileSdk = 36
14+
compileSdk = 34
1515
defaultConfig {
1616
minSdk = 24
17-
externalNativeBuild.ndkBuild {
18-
abiFilters("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
19-
arguments("-j${Runtime.getRuntime().availableProcessors()}")
17+
ndk {
18+
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
2019
}
2120
}
2221

@@ -25,6 +24,10 @@ android {
2524
targetCompatibility = JavaVersion.VERSION_17
2625
}
2726

27+
kotlinOptions {
28+
jvmTarget = "17"
29+
}
30+
2831
buildTypes {
2932
release {
3033
isMinifyEnabled = false
@@ -38,10 +41,6 @@ android {
3841
}
3942
}
4043

41-
kotlin {
42-
jvmToolchain(17)
43-
}
44-
4544
cargo {
4645
module = "src/main/rust/shadowsocks-rust"
4746
libname = "sslocal"
@@ -64,33 +63,23 @@ cargo {
6463
exec = { spec, toolchain ->
6564
run {
6665
try {
67-
Runtime.getRuntime().exec(arrayOf("python3", "-V"))
66+
Runtime.getRuntime().exec("python3 -V >/dev/null 2>&1")
6867
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python3")
69-
project.logger.lifecycle("Python 3 detected.")
7068
} 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-
}
69+
throw GradleException("Please install Python3 in order to compile.")
7970
}
80-
// https://developer.android.com/guide/practices/page-sizes#other-build-systems
81-
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")
8473
}
8574
}
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

9483
dependencies {
95-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
84+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
9685
}

obfuscator/src/main/rust/linker-wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import, print_function, unicode_literals
22

33
import os
4-
import shlex
4+
import pipes
55
import shutil
66
import subprocess
77
import sys
@@ -68,7 +68,7 @@ def posix2win(path):
6868

6969

7070
# This only appears when the subprocess call fails, but it's helpful then.
71-
printable_cmd = " ".join(shlex.quote(arg) for arg in args)
71+
printable_cmd = " ".join(pipes.quote(arg) for arg in args)
7272
print(printable_cmd)
7373

7474
code = subprocess.call(args)

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 }}

0 commit comments

Comments
 (0)