Commit 9fc1a4e0 authored by Max Lv's avatar Max Lv

Fix the release build

parent 9bf2b4bb
......@@ -37,12 +37,6 @@ task goBuild(type: Exec) {
args "-c", "src/overture/make.bash " + minSdkVersion
}
tasks.whenTaskAdded { task ->
if (task.name == 'generateJsonModelDebug') {
task.dependsOn(goBuild)
}
}
dependencies {
api project(':plugin')
testImplementation "junit:junit:$junitVersion"
......
......@@ -38,11 +38,15 @@ android {
vectorDrawables.useSupportLibrary true
resConfigs "fa", "ja", "ko", "ru", "zh-rCN", "zh-rTW"
}
signingConfigs {
release
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
lintOptions {
......@@ -53,6 +57,18 @@ android {
sourceSets.main.jniLibs.srcDirs += new File(project(':core').projectDir, "src/main/jni/overture")
}
def propsFile = rootProject.file('local.properties')
if (propsFile.exists()) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
android.signingConfigs.release.storeFile = file(props['storeFile'])
android.signingConfigs.release.storePassword = props['storePassword']
android.signingConfigs.release.keyAlias = props['keyAlias']
android.signingConfigs.release.keyPassword = props['keyPassword']
} else {
android.buildTypes.release.signingConfig = null
}
dependencies {
implementation project(':core')
implementation "com.android.support:customtabs:$supportLibraryVersion"
......
......@@ -20,14 +20,25 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn com.google.android.gms.internal.**
-keepattributes *DatabaseField*
-keepattributes *DatabaseTable*
-keepattributes *SerializedName*
-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }
-keep class com.github.shadowsocks.** { *; }
-dontwarn com.j256.ormlite.**
-dontwarn com.google.android.gms.internal.**
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn org.xbill.**
-keep class com.github.shadowsocks.JniHelper { *; }
-dontwarn com.evernote.android.job.gcm.**
-dontwarn com.evernote.android.job.util.GcmAvailableHelper
-keep public class com.evernote.android.job.v21.PlatformJobService
-keep public class com.evernote.android.job.v14.PlatformAlarmService
-keep public class com.evernote.android.job.v14.PlatformAlarmReceiver
......
......@@ -29,12 +29,11 @@ import android.os.PersistableBundle
import android.support.v4.content.pm.ShortcutInfoCompat
import android.support.v4.content.pm.ShortcutManagerCompat
import android.support.v4.graphics.drawable.IconCompat
import android.support.v7.app.AppCompatActivity
import com.github.shadowsocks.App.Companion.app
import com.github.shadowsocks.aidl.IShadowsocksService
import com.github.shadowsocks.bg.BaseService
class QuickToggleShortcut : AppCompatActivity(), ShadowsocksConnection.Interface {
class QuickToggleShortcut : Activity(), ShadowsocksConnection.Interface {
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
if (intent.action == Intent.ACTION_CREATE_SHORTCUT) {
......
......@@ -46,15 +46,7 @@ object LocalDnsService {
super.startNativeProcesses()
val profile = data.profile!!
fun buildOvertureConfig(file: String): String {
val config = JSONObject()
.put("BindAddress", "127.0.0.1:" + DataStore.portLocalDns)
.put("RedirectIPv6Record", true)
.put("DomainBase64Decode", true)
.put("HostsFile", "hosts")
.put("MinimumTTL", 3600)
.put("CacheSize", 4096)
fun makeDns(name: String, address: String, edns: Boolean = true) = {
fun makeDns(name: String, address: String, edns: Boolean = true): JSONObject {
val dns = JSONObject()
.put("Name", name)
.put("Address", (when (address.parseNumericAddress()) {
......@@ -67,10 +59,20 @@ object LocalDnsService {
.put("Protocol", "tcp")
.put("Socks5Address", "127.0.0.1:" + DataStore.portProxy)
else dns.put("Protocol", "udp")
dns
return dns
}
fun buildOvertureConfig(file: String): String {
val config = JSONObject()
.put("BindAddress", "127.0.0.1:" + DataStore.portLocalDns)
.put("RedirectIPv6Record", true)
.put("DomainBase64Decode", true)
.put("HostsFile", "hosts")
.put("MinimumTTL", 3600)
.put("CacheSize", 4096)
val remoteDns = JSONArray(profile.remoteDns.split(",")
.mapIndexed { i, dns -> makeDns("UserDef-" + i, dns.trim())() })
.mapIndexed { i, dns -> makeDns("UserDef-" + i, dns.trim()) })
val localDns = JSONArray(arrayOf(
makeDns("Primary-1", "119.29.29.29", false),
makeDns("Primary-2", "114.114.114.114", false)
......
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