Commit fa116942 authored by Max Lv's avatar Max Lv

Clean up

parent bdae2429
...@@ -13,7 +13,7 @@ jobs: ...@@ -13,7 +13,7 @@ jobs:
key: jars-{{ checksum "build.gradle" }} key: jars-{{ checksum "build.gradle" }}
- run: - run:
name: Run Build and Tests name: Run Build and Tests
command: ./gradlew assembleDebug check command: ./gradlew cargoBuild && ./gradlew assembleDebug check
- save_cache: - save_cache:
paths: paths:
- ~/.gradle - ~/.gradle
......
[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"] [submodule "core/src/main/jni/badvpn"]
path = core/src/main/jni/badvpn path = core/src/main/jni/badvpn
url = https://github.com/shadowsocks/badvpn.git url = https://github.com/shadowsocks/badvpn.git
branch = shadowsocks-android branch = shadowsocks-android
[submodule "core/src/main/jni/libancillary"]
path = core/src/main/jni/libancillary
url = https://github.com/shadowsocks/libancillary.git
branch = shadowsocks-android
[submodule "core/src/main/jni/libevent"] [submodule "core/src/main/jni/libevent"]
path = core/src/main/jni/libevent path = core/src/main/jni/libevent
url = https://github.com/shadowsocks/libevent.git url = https://github.com/shadowsocks/libevent.git
...@@ -17,22 +10,12 @@ ...@@ -17,22 +10,12 @@
path = core/src/main/jni/redsocks path = core/src/main/jni/redsocks
url = https://github.com/shadowsocks/redsocks.git url = https://github.com/shadowsocks/redsocks.git
branch = shadowsocks-android 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"] [submodule "core/src/main/jni/re2"]
path = core/src/main/jni/re2 path = core/src/main/jni/re2
url = https://github.com/google/re2.git url = https://github.com/google/re2.git
[submodule "core/shadowsocks-rust"] [submodule "core/src/main/rust"]
path = core/shadowsocks-rust path = core/src/main/rust
url = https://github.com/madeye/shadowsocks-rust url = https://github.com/madeye/shadowsocks-rust
[submodule "core/src/main/jni/libancillary"]
path = core/src/main/jni/libancillary
url = https://github.com/shadowsocks/libancillary.git
...@@ -14,6 +14,7 @@ buildscript { ...@@ -14,6 +14,7 @@ buildscript {
junitVersion = '4.13' junitVersion = '4.13'
androidTestVersion = '1.2.0' androidTestVersion = '1.2.0'
androidEspressoVersion = '3.2.0' androidEspressoVersion = '3.2.0'
ndkVersion = '21.0.6113669'
versionCode = 5000550 versionCode = 5000550
versionName = '5.0.5-nightly' versionName = '5.0.5-nightly'
resConfigs = ['ar', 'es', 'fa', 'fr', 'ja', 'ko', 'ru', 'tr', 'zh-rCN', 'zh-rTW'] resConfigs = ['ar', 'es', 'fa', 'fr', 'ja', 'ko', 'ru', 'tr', 'zh-rCN', 'zh-rTW']
......
...@@ -45,6 +45,8 @@ android { ...@@ -45,6 +45,8 @@ android {
sourceSets { sourceSets {
androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
} }
ndkVersion rootProject.ndkVersion
} }
androidExtensions { androidExtensions {
...@@ -52,7 +54,7 @@ androidExtensions { ...@@ -52,7 +54,7 @@ androidExtensions {
} }
cargo { cargo {
module = 'shadowsocks-rust' module = 'src/main/rust'
libname = 'sslocal' libname = 'sslocal'
targets = ['arm', 'arm64', 'x86', 'x86_64'] targets = ['arm', 'arm64', 'x86', 'x86_64']
profile = 'release' profile = 'release'
...@@ -66,8 +68,6 @@ cargo { ...@@ -66,8 +68,6 @@ cargo {
} }
} }
preBuild.dependsOn "cargoBuild"
def coroutinesVersion = '1.3.3' def coroutinesVersion = '1.3.3'
def roomVersion = '2.2.3' def roomVersion = '2.2.3'
def workVersion = '2.3.1' def workVersion = '2.3.1'
......
...@@ -31,7 +31,7 @@ import java.io.IOException ...@@ -31,7 +31,7 @@ import java.io.IOException
object Executable { object Executable {
const val REDSOCKS = "libredsocks.so" const val REDSOCKS = "libredsocks.so"
const val SS_LOCAL = "libss-local.so" const val SS_LOCAL = "libsslocal.so"
const val TUN2SOCKS = "libtun2socks.so" const val TUN2SOCKS = "libtun2socks.so"
private val EXECUTABLES = setOf(SS_LOCAL, REDSOCKS, TUN2SOCKS) private val EXECUTABLES = setOf(SS_LOCAL, REDSOCKS, TUN2SOCKS)
......
...@@ -115,13 +115,12 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -115,13 +115,12 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
this.configFile = configFile this.configFile = configFile
val config = profile.toJson() val config = profile.toJson()
plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString()) } plugin?.let { (path, opts) -> config.put("plugin", path).put("plugin_opts", opts.toString()) }
config.put("local_addr", DataStore.listenAddress)
config.put("local_port", DataStore.portProxy)
configFile.writeText(config.toString()) configFile.writeText(config.toString())
val cmd = service.buildAdditionalArguments(arrayListOf( val cmd = service.buildAdditionalArguments(arrayListOf(
File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath, File((service as Context).applicationInfo.nativeLibraryDir, Executable.SS_LOCAL).absolutePath,
"-b", DataStore.listenAddress,
"-l", DataStore.portProxy.toString(),
"-t", "600",
"-S", stat.absolutePath, "-S", stat.absolutePath,
"-c", configFile.absolutePath)) "-c", configFile.absolutePath))
if (extraFlag != null) cmd.add(extraFlag) if (extraFlag != null) cmd.add(extraFlag)
......
...@@ -18,93 +18,6 @@ ROOT_PATH := $(LOCAL_PATH) ...@@ -18,93 +18,6 @@ ROOT_PATH := $(LOCAL_PATH)
BUILD_SHARED_EXECUTABLE := $(LOCAL_PATH)/build-shared-executable.mk BUILD_SHARED_EXECUTABLE := $(LOCAL_PATH)/build-shared-executable.mk
########################################################
## libsodium
########################################################
include $(CLEAR_VARS)
SODIUM_SOURCE := \
crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c \
crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \
crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \
crypto_core/ed25519/ref10/ed25519_ref10.c \
crypto_core/hchacha20/core_hchacha20.c \
crypto_core/salsa/ref/core_salsa_ref.c \
crypto_generichash/blake2b/ref/blake2b-compress-ref.c \
crypto_generichash/blake2b/ref/blake2b-ref.c \
crypto_generichash/blake2b/ref/generichash_blake2b.c \
crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \
crypto_onetimeauth/poly1305/donna/poly1305_donna.c \
crypto_pwhash/crypto_pwhash.c \
crypto_pwhash/argon2/argon2-core.c \
crypto_pwhash/argon2/argon2.c \
crypto_pwhash/argon2/argon2-encoding.c \
crypto_pwhash/argon2/argon2-fill-block-ref.c \
crypto_pwhash/argon2/blake2b-long.c \
crypto_pwhash/argon2/pwhash_argon2i.c \
crypto_scalarmult/curve25519/scalarmult_curve25519.c \
crypto_scalarmult/curve25519/ref10/x25519_ref10.c \
crypto_stream/chacha20/stream_chacha20.c \
crypto_stream/chacha20/ref/chacha20_ref.c \
crypto_stream/salsa20/stream_salsa20.c \
crypto_stream/salsa20/ref/salsa20_ref.c \
crypto_verify/sodium/verify.c \
randombytes/randombytes.c \
randombytes/sysrandom/randombytes_sysrandom.c \
sodium/core.c \
sodium/runtime.c \
sodium/utils.c \
sodium/version.c
LOCAL_MODULE := sodium
LOCAL_CFLAGS += -I$(LOCAL_PATH)/libsodium/src/libsodium/include \
-I$(LOCAL_PATH)/include \
-I$(LOCAL_PATH)/include/sodium \
-I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
-DPACKAGE_NAME=\"libsodium\" -DPACKAGE_TARNAME=\"libsodium\" \
-DPACKAGE_VERSION=\"1.0.15\" -DPACKAGE_STRING=\"libsodium-1.0.15\" \
-DPACKAGE_BUGREPORT=\"https://github.com/jedisct1/libsodium/issues\" \
-DPACKAGE_URL=\"https://github.com/jedisct1/libsodium\" \
-DPACKAGE=\"libsodium\" -DVERSION=\"1.0.15\" \
-DHAVE_PTHREAD=1 \
-DSTDC_HEADERS=1 \
-DHAVE_SYS_TYPES_H=1 \
-DHAVE_SYS_STAT_H=1 \
-DHAVE_STDLIB_H=1 \
-DHAVE_STRING_H=1 \
-DHAVE_MEMORY_H=1 \
-DHAVE_STRINGS_H=1 \
-DHAVE_INTTYPES_H=1 \
-DHAVE_STDINT_H=1 \
-DHAVE_UNISTD_H=1 \
-D__EXTENSIONS__=1 \
-D_ALL_SOURCE=1 \
-D_GNU_SOURCE=1 \
-D_POSIX_PTHREAD_SEMANTICS=1 \
-D_TANDEM_SOURCE=1 \
-DHAVE_DLFCN_H=1 \
-DLT_OBJDIR=\".libs/\" \
-DHAVE_SYS_MMAN_H=1 \
-DNATIVE_LITTLE_ENDIAN=1 \
-DASM_HIDE_SYMBOL=.hidden \
-DHAVE_WEAK_SYMBOLS=1 \
-DHAVE_ATOMIC_OPS=1 \
-DHAVE_ARC4RANDOM=1 \
-DHAVE_ARC4RANDOM_BUF=1 \
-DHAVE_MMAP=1 \
-DHAVE_MLOCK=1 \
-DHAVE_MADVISE=1 \
-DHAVE_MPROTECT=1 \
-DHAVE_NANOSLEEP=1 \
-DHAVE_POSIX_MEMALIGN=1 \
-DHAVE_GETPID=1 \
-DCONFIGURED=1
LOCAL_SRC_FILES := $(addprefix libsodium/src/libsodium/,$(SODIUM_SOURCE))
include $(BUILD_STATIC_LIBRARY)
######################################################## ########################################################
## libevent ## libevent
######################################################## ########################################################
...@@ -138,87 +51,6 @@ LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE)) ...@@ -138,87 +51,6 @@ LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE))
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
########################################################
## libbloom
########################################################
include $(CLEAR_VARS)
BLOOM_SOURCE := bloom.c murmur2/MurmurHash2.c
LOCAL_MODULE := libbloom
LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libbloom \
-I$(LOCAL_PATH)/shadowsocks-libev/libbloom/murmur2
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libbloom/, $(BLOOM_SOURCE))
include $(BUILD_STATIC_LIBRARY)
########################################################
## libipset
########################################################
include $(CLEAR_VARS)
bdd_src = bdd/assignments.c bdd/basics.c bdd/bdd-iterator.c bdd/expanded.c \
bdd/reachable.c bdd/read.c bdd/write.c
map_src = map/allocation.c map/inspection.c map/ipv4_map.c map/ipv6_map.c \
map/storage.c
set_src = set/allocation.c set/inspection.c set/ipv4_set.c set/ipv6_set.c \
set/iterator.c set/storage.c
IPSET_SOURCE := general.c $(bdd_src) $(map_src) $(set_src)
LOCAL_MODULE := libipset
LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
-I$(LOCAL_PATH)/shadowsocks-libev/libcork/include
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libipset/src/libipset/,$(IPSET_SOURCE))
include $(BUILD_STATIC_LIBRARY)
########################################################
## libcork
########################################################
include $(CLEAR_VARS)
cli_src := cli/commands.c
core_src := core/allocator.c core/error.c core/gc.c \
core/hash.c core/ip-address.c core/mempool.c \
core/timestamp.c core/u128.c
ds_src := ds/array.c ds/bitset.c ds/buffer.c ds/dllist.c \
ds/file-stream.c ds/hash-table.c ds/managed-buffer.c \
ds/ring-buffer.c ds/slice.c
posix_src := posix/directory-walker.c posix/env.c posix/exec.c \
posix/files.c posix/process.c posix/subprocess.c
pthreads_src := pthreads/thread.c
CORK_SOURCE := $(cli_src) $(core_src) $(ds_src) $(posix_src) $(pthreads_src)
LOCAL_MODULE := libcork
LOCAL_CFLAGS += -I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
-DCORK_API=CORK_LOCAL
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/libcork/src/libcork/,$(CORK_SOURCE))
include $(BUILD_STATIC_LIBRARY)
########################################################
## libev
########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := libev
LOCAL_CFLAGS += -DNDEBUG -DHAVE_CONFIG_H \
-I$(LOCAL_PATH)/include/libev
LOCAL_SRC_FILES := \
libev/ev.c \
libev/event.c
include $(BUILD_STATIC_LIBRARY)
######################################################## ########################################################
## redsocks ## redsocks
######################################################## ########################################################
...@@ -241,43 +73,6 @@ LOCAL_CFLAGS := -std=gnu99 -DUSE_IPTABLES \ ...@@ -241,43 +73,6 @@ LOCAL_CFLAGS := -std=gnu99 -DUSE_IPTABLES \
include $(BUILD_SHARED_EXECUTABLE) include $(BUILD_SHARED_EXECUTABLE)
########################################################
## shadowsocks-libev local
########################################################
include $(CLEAR_VARS)
SHADOWSOCKS_SOURCES := local.c \
cache.c udprelay.c utils.c netutils.c json.c jconf.c \
acl.c http.c tls.c rule.c \
crypto.c aead.c stream.c base64.c \
plugin.c ppbloom.c \
android.c
LOCAL_MODULE := ss-local
LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES))
LOCAL_CFLAGS := -Wall -fno-strict-aliasing -DMODULE_LOCAL \
-DUSE_CRYPTO_MBEDTLS -DHAVE_CONFIG_H \
-DCONNECT_IN_PROGRESS=EINPROGRESS \
-I$(LOCAL_PATH)/include/shadowsocks-libev \
-I$(LOCAL_PATH)/include \
-I$(LOCAL_PATH)/libancillary \
-I$(LOCAL_PATH)/mbedtls/include \
-I$(LOCAL_PATH)/pcre \
-I$(LOCAL_PATH)/libsodium/src/libsodium/include \
-I$(LOCAL_PATH)/libsodium/src/libsodium/include/sodium \
-I$(LOCAL_PATH)/shadowsocks-libev/libcork/include \
-I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
-I$(LOCAL_PATH)/shadowsocks-libev/libbloom \
-I$(LOCAL_PATH)/libev
LOCAL_STATIC_LIBRARIES := libev libmbedtls libipset libcork libbloom \
libsodium libancillary libpcre
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_EXECUTABLE)
######################################################## ########################################################
## jni-helper ## jni-helper
######################################################## ########################################################
...@@ -404,57 +199,3 @@ LOCAL_LDLIBS := -ldl -llog ...@@ -404,57 +199,3 @@ LOCAL_LDLIBS := -ldl -llog
LOCAL_SRC_FILES := $(addprefix badvpn/, $(TUN2SOCKS_SOURCES)) LOCAL_SRC_FILES := $(addprefix badvpn/, $(TUN2SOCKS_SOURCES))
include $(BUILD_SHARED_EXECUTABLE) include $(BUILD_SHARED_EXECUTABLE)
########################################################
## mbed TLS
########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := mbedtls
LOCAL_C_INCLUDES := $(LOCAL_PATH)/mbedtls/include
MBEDTLS_SOURCES := $(wildcard $(LOCAL_PATH)/mbedtls/library/*.c)
LOCAL_SRC_FILES := $(MBEDTLS_SOURCES:$(LOCAL_PATH)/%=%)
include $(BUILD_STATIC_LIBRARY)
########################################################
## pcre
########################################################
include $(CLEAR_VARS)
LOCAL_MODULE := pcre
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_C_INCLUDES := $(LOCAL_PATH)/pcre/dist $(LOCAL_PATH)/pcre
libpcre_src_files := \
dist/pcre_byte_order.c \
dist/pcre_compile.c \
dist/pcre_config.c \
dist/pcre_dfa_exec.c \
dist/pcre_exec.c \
dist/pcre_fullinfo.c \
dist/pcre_get.c \
dist/pcre_globals.c \
dist/pcre_jit_compile.c \
dist/pcre_maketables.c \
dist/pcre_newline.c \
dist/pcre_ord2utf8.c \
dist/pcre_refcount.c \
dist/pcre_string_utils.c \
dist/pcre_study.c \
dist/pcre_tables.c \
dist/pcre_ucd.c \
dist/pcre_valid_utf8.c \
dist/pcre_version.c \
dist/pcre_xclass.c
LOCAL_SRC_FILES := $(addprefix pcre/, $(libpcre_src_files)) $(LOCAL_PATH)/patch/pcre/pcre_chartables.c
include $(BUILD_STATIC_LIBRARY)
libev @ 31ca40b7
Subproject commit 31ca40b7a18ed424213a4ecba0d57706ed3e56a0
Subproject commit b732443c442239c2e0184820e9b23cca0de0828c
Subproject commit 9f4f8eec93dd1f32d78e0bcceddbef0ca570e66f
pcre @ 222bbf4b
Subproject commit 222bbf4b3fb8e13c21686803e47e31aa3e4ad130
Subproject commit 6b5025bf741cff93212ba048353eb3d2c02b5c46
File moved
...@@ -54,6 +54,7 @@ android { ...@@ -54,6 +54,7 @@ android {
} }
sourceSets.main.jniLibs.srcDirs += sourceSets.main.jniLibs.srcDirs +=
new File(project(':core').buildDir, "intermediates/bundles/${getCurrentFlavor()}/jni") new File(project(':core').buildDir, "intermediates/bundles/${getCurrentFlavor()}/jni")
ndkVersion rootProject.ndkVersion
} }
androidExtensions { androidExtensions {
......
...@@ -53,6 +53,7 @@ android { ...@@ -53,6 +53,7 @@ android {
} }
sourceSets.main.jniLibs.srcDirs += sourceSets.main.jniLibs.srcDirs +=
new File(project(':core').buildDir, "intermediates/bundles/${getCurrentFlavor()}/jni") new File(project(':core').buildDir, "intermediates/bundles/${getCurrentFlavor()}/jni")
ndkVersion rootProject.ndkVersion
} }
dependencies { dependencies {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment