Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
run: ./gradlew clean assembleDebug --info
- name: build release
run: ./gradlew clean assembleRelease --info
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: testapp-apk
path: testapp/build/outputs/apk/
if-no-files-found: error
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: obfuscator-aars
path: obfuscator/build/outputs/aar/
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/semgrep.yaml

This file was deleted.

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

allprojects {
group = "com.kape.android"
version = "0.0.4"
version = "0.1.0"
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "maven-publish")
}
Expand Down
35 changes: 23 additions & 12 deletions obfuscator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ android {
namespace = "com.kape.obfuscator"
ndkVersion = sdkDirectory.resolve("ndk").listFilesOrdered().last().name

compileSdk = 34
compileSdk = 36
defaultConfig {
minSdk = 24
ndk {
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
externalNativeBuild.ndkBuild {
abiFilters("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
arguments("-j${Runtime.getRuntime().availableProcessors()}")
}
}

Expand All @@ -24,10 +25,6 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}

buildTypes {
release {
isMinifyEnabled = false
Expand All @@ -41,6 +38,10 @@ android {
}
}

kotlin {
jvmToolchain(17)
}

cargo {
module = "src/main/rust/shadowsocks-rust"
libname = "sslocal"
Expand All @@ -63,23 +64,33 @@ cargo {
exec = { spec, toolchain ->
run {
try {
Runtime.getRuntime().exec("python3 -V >/dev/null 2>&1")
Runtime.getRuntime().exec(arrayOf("python3", "-V"))
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python3")
project.logger.lifecycle("Python 3 detected.")
} catch (e: java.io.IOException) {
throw GradleException("Please install Python3 in order to compile.")
project.logger.lifecycle("No python 3 detected.")
try {
Runtime.getRuntime().exec(arrayOf("python", "-V"))
spec.environment("RUST_ANDROID_GRADLE_PYTHON_COMMAND", "python")
project.logger.lifecycle("Python detected.")
} catch (e: java.io.IOException) {
throw GradleException("No any python version detected. You should install the python first to compile project.")
}
}
// https://developer.android.com/guide/practices/page-sizes#other-build-systems
spec.environment("RUST_ANDROID_GRADLE_CC_LINK_ARG", "-Wl,-z,max-page-size=16384,-soname,lib$libname.so")
spec.environment("RUST_ANDROID_GRADLE_LINKER_WRAPPER_PY", "$projectDir/$module/../linker-wrapper.py")
spec.environment("RUST_ANDROID_GRADLE_TARGET", "target/${toolchain.target}/$profile/lib$libname.so")
}
}
}

tasks.whenTaskAdded {
if (this.name == "javaPreCompileDebug" || this.name == "javaPreCompileRelease") {
this.dependsOn("cargoBuild")
when (name) {
"mergeDebugJniLibFolders", "mergeReleaseJniLibFolders" -> dependsOn("cargoBuild")
}
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
}
4 changes: 2 additions & 2 deletions obfuscator/src/main/rust/linker-wrapper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import, print_function, unicode_literals

import os
import pipes
import shlex
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -68,7 +68,7 @@ def posix2win(path):


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

code = subprocess.call(args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
windows: circleci/windows@2.4.0
windows: circleci/windows@5.1.0

jobs:
build-linux:
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:

publish-github-releases:
docker:
- image: circleci/golang:1.12
- image: circleci/golang:1.17
steps:
- attach_workspace:
at: /tmp/workspace
Expand Down
21 changes: 1 addition & 20 deletions obfuscator/src/main/rust/shadowsocks-rust/.github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,4 @@ updates:
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
ignore:
- dependency-name: libc
versions:
- 0.2.92
- dependency-name: tokio
versions:
- 1.4.0
- dependency-name: bloomfilter
versions:
- 1.0.5
- dependency-name: regex
versions:
- 1.4.5
- dependency-name: serde
versions:
- 1.0.124
- dependency-name: tower
versions:
- 0.4.6
open-pull-requests-limit: 0
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: Build & Test

on:
push:
branches: [master]
pull_request:
branches: [master]
on: [push, pull_request]

env:
CARGO_TERM_COLOR: always
RUST_LOG: "trace"

jobs:
buid-test-check:
build-and-test:
strategy:
matrix:
platform:
Expand All @@ -21,8 +17,16 @@ jobs:
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
- if: ${{ matrix.platform == 'ubuntu-latest' }}
name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- if: ${{ runner.os == 'Windows' }}
uses: ilammy/setup-nasm@v1
- if: ${{ matrix.platform == 'ubuntu-latest' }}
name: Install LLVM and Clang
run: sudo apt update && sudo apt install -y clang
- name: Install Rust
run: |
rustup set profile minimal
Expand All @@ -31,6 +35,10 @@ jobs:
rustup override set stable
- name: Build & Test (Default)
run: cargo test --verbose --no-fail-fast
- name: Build & Test (full)
run: cargo test --features "full" --verbose --no-fail-fast
- name: Build & Test (full-extra)
run: cargo test --features "full-extra" --verbose --no-fail-fast
- name: Build & Test (Default) - shadowsocks
run: cargo test --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --no-fail-fast
- name: Build & Test (--no-default-features)
Expand All @@ -39,9 +47,9 @@ jobs:
run: cargo test --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --no-default-features --no-fail-fast
- name: Build with All Features Enabled (Unix)
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
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"
run: cargo build --verbose --features "full-extra local-flow-stat utility-url-outline"
- name: Build with All Features Enabled (Windows)
if: ${{ runner.os == 'Windows' }}
run: cargo build --verbose --features "local-http-rustls local-dns dns-over-tls dns-over-https stream-cipher aead-cipher-2022"
run: cargo build --verbose --features "full-extra local-flow-stat utility-url-outline winservice"
- name: Build with All Features Enabled - shadowsocks
run: cargo build --manifest-path ./crates/shadowsocks/Cargo.toml --verbose --features "stream-cipher aead-cipher-2022"
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"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- v*

jobs:
build:
build-docker-image:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -14,22 +14,22 @@ jobs:
- sslocal
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ matrix.bin }}-rust
- name: Build and release Docker images
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
platforms: linux/386,linux/amd64,linux/arm64/v8
target: ${{ matrix.bin }}
Expand Down
Loading
Loading