Skip to content

Commit

Permalink
Merge pull request #2454 from shadowsocks/rust
Browse files Browse the repository at this point in the history
Integrate shadowsocks-rust
  • Loading branch information
madeye committed Apr 20, 2020
2 parents 2f6319d + d7b8ef6 commit 66f01b6
Show file tree
Hide file tree
Showing 50 changed files with 320 additions and 2,513 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-29-ndk
- image: shadowsocks/android-ndk-go:v1.0
environment:
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy="in-process"
steps:
Expand All @@ -13,7 +13,7 @@ jobs:
key: jars-{{ checksum "build.gradle" }}
- run:
name: Run Build and Tests
command: ./gradlew assembleDebug check
command: ./gradlew assembleDebug check -PCARGO_PROFILE=debug
- save_cache:
paths:
- ~/.gradle
Expand Down
22 changes: 3 additions & 19 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "core/src/main/jni/shadowsocks-libev"]
path = core/src/main/jni/shadowsocks-libev
url = https://github.com/shadowsocks/shadowsocks-libev
[submodule "core/src/main/jni/badvpn"]
path = core/src/main/jni/badvpn
url = https://github.com/shadowsocks/badvpn.git
Expand All @@ -17,19 +14,6 @@
path = core/src/main/jni/redsocks
url = https://github.com/shadowsocks/redsocks.git
branch = shadowsocks-android
[submodule "core/src/main/jni/mbedtls"]
path = core/src/main/jni/mbedtls
url = https://github.com/ARMmbed/mbedtls
[submodule "core/src/main/jni/pcre"]
path = core/src/main/jni/pcre
url = https://android.googlesource.com/platform/external/pcre
[submodule "core/src/main/jni/libsodium"]
path = core/src/main/jni/libsodium
url = https://github.com/jedisct1/libsodium.git
branch = stable
[submodule "core/src/main/jni/libev"]
path = core/src/main/jni/libev
url = https://git.lighttpd.net/libev.git
[submodule "core/src/main/jni/re2"]
path = core/src/main/jni/re2
url = https://github.com/google/re2.git
[submodule "core/src/main/rust/shadowsocks-rust"]
path = core/src/main/rust/shadowsocks-rust
url = https://github.com/madeye/shadowsocks-rust
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@ If you are interested in contributing or getting involved with this project, ple

<ul>
<li>redsocks: <a href="https://github.com/shadowsocks/redsocks/blob/shadowsocks-android/README">APL 2.0</a></li>
<li>mbed TLS: <a href="https://github.com/ARMmbed/mbedtls/blob/development/LICENSE">APL 2.0</a></li>
<li>libevent: <a href="https://github.com/shadowsocks/libevent/blob/master/LICENSE">BSD</a></li>
<li>tun2socks: <a href="https://github.com/shadowsocks/badvpn/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>pcre: <a href="https://android.googlesource.com/platform/external/pcre/+/master/dist2/LICENCE">BSD</a></li>
<li>libancillary: <a href="https://github.com/shadowsocks/libancillary/blob/shadowsocks-android/COPYING">BSD</a></li>
<li>shadowsocks-libev: <a href="https://github.com/shadowsocks/shadowsocks-libev/blob/master/LICENSE">GPLv3</a></li>
<li>libev: <a href="https://github.com/shadowsocks/libev/blob/master/LICENSE">GPLv2</a></li>
<li>shadowsocks-rust: <a href="https://github.com/shadowsocks/shadowsocks-rust/blob/master/LICENSE">MIT</a></li>
<li>libsodium: <a href="https://github.com/jedisct1/libsodium/blob/master/LICENSE">ISC</a></li>
<li>OpenSSL: <a href="https://www.openssl.org/source/license-openssl-ssleay.txt">OpenSSL License</a></li>
</ul>


Expand Down
16 changes: 10 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ apply plugin: 'com.github.ben-manes.versions'
buildscript {
ext {
javaVersion = JavaVersion.VERSION_1_8
kotlinVersion = '1.3.61'
kotlinVersion = '1.3.72'
minSdkVersion = 21
sdkVersion = 29
compileSdkVersion = 29
lifecycleVersion = '2.2.0'
desugarLibsVersion = '1.0.4'
desugarLibsVersion = '1.0.5'
junitVersion = '4.13'
androidTestVersion = '1.2.0'
androidEspressoVersion = '3.2.0'
Expand All @@ -25,14 +25,18 @@ buildscript {
maven {
url 'https://maven.fabric.io/public'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-alpha09'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
classpath 'com.android.tools.build:gradle:4.0.0-beta04'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.28.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.9.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.11.1'
classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.8.3'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
Expand Down
35 changes: 26 additions & 9 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'

android {
compileSdkVersion rootProject.compileSdkVersion
Expand Down Expand Up @@ -50,27 +51,43 @@ androidExtensions {
experimental = true
}

def coroutinesVersion = '1.3.3'
def roomVersion = '2.2.3'
def workVersion = '2.3.1'
cargo {
module = 'src/main/rust/shadowsocks-rust'
libname = 'sslocal'
targets = ['arm', 'arm64', 'x86', 'x86_64']
profile = findProperty('CARGO_PROFILE') ?: 'release'
targetIncludes = ["lib${libname}.so"]
extraCargoBuildArguments = ['--bin', 'sslocal']
features {
noDefaultBut "sodium", "rc4", "aes-cfb", "aes-ctr", "camellia-cfb", "openssl-vendored", "local-flow-stat", "local-dns-relay"
}
exec { spec, toolchain ->
spec.environment("RUSTFLAGS", "-C lto=no -C link-arg=-o -C link-arg=target/${toolchain.target}/$profile/lib${libname}.so")
}
}

preBuild.dependsOn "cargoBuild"

def coroutinesVersion = '1.3.5'
def roomVersion = '2.2.5'
def workVersion = '2.3.4'
dependencies {
api project(':plugin')
api 'androidx.fragment:fragment-ktx:1.2.1'
api 'androidx.fragment:fragment-ktx:1.2.4'
api "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
api "androidx.lifecycle:lifecycle-livedata-core-ktx:$lifecycleVersion"
api 'androidx.preference:preference:1.1.0'
api 'androidx.preference:preference:1.1.1'
api "androidx.room:room-runtime:$roomVersion"
api "androidx.work:work-runtime-ktx:$workVersion"
api "androidx.work:work-gcm:$workVersion"
api 'com.crashlytics.sdk.android:crashlytics:2.10.1'
api 'com.google.android.gms:play-services-oss-licenses:17.0.0'
api 'com.google.code.gson:gson:2.8.6'
api 'com.google.firebase:firebase-analytics:17.2.2'
api 'com.google.firebase:firebase-config:19.1.1'
api 'dnsjava:dnsjava:2.1.9'
api 'com.google.firebase:firebase-analytics:17.3.0'
api 'com.google.firebase:firebase-config:19.1.3'
api 'dnsjava:dnsjava:3.0.2'
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
api "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion"
api 'org.connectbot.jsocks:jsocks:1.0.0'
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugarLibsVersion"
kapt "androidx.room:room-compiler:$roomVersion"
testImplementation "junit:junit:$junitVersion"
Expand Down
5 changes: 0 additions & 5 deletions core/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,3 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# https://issuetracker.google.com/issues/147972078#comment4
-keepclasseswithmembers class * extends androidx.lifecycle.ViewModel {
<init>();
}

This file was deleted.

1 change: 0 additions & 1 deletion core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<provider android:name="com.google.firebase.provider.FirebaseInitProvider"
tools:node="remove"/>
<service android:name="androidx.room.MultiInstanceInvalidationService"
android:directBootAware="true"
android:process=":bg"/>
<!-- https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/work/workmanager/src/main/AndroidManifest.xml -->
<provider android:name="androidx.work.impl.WorkManagerInitializer"
Expand Down
101 changes: 0 additions & 101 deletions core/src/main/java/com/github/shadowsocks/acl/AclMatcher.kt

This file was deleted.

Loading

0 comments on commit 66f01b6

Please sign in to comment.