forked from xuhaoyang/ClashForAndroid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: refactor project structure & update clash core (#1174)
* Refactor: refactor project structure * Chore: remove apply * Chore: update clash core * Fix: fix versionName & versionCode patch * Chore: update golang plugin * Fix: fix workflow build
- Loading branch information
Showing
78 changed files
with
542 additions
and
939 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
[submodule "core/src/main/golang/clash"] | ||
path = core/src/main/golang/clash | ||
[submodule "clash-foss"] | ||
path = core/src/foss/go/clash | ||
url = https://github.com/Kr328/clash.git | ||
[submodule "kaidl"] | ||
path = kaidl | ||
url = https://github.com/Kr328/kaidl.git | ||
[submodule "core/src/main/golang/tun2socket"] | ||
path = core/src/main/golang/tun2socket | ||
url = https://github.com/Kr328/tun2socket-lwip.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +1,31 @@ | ||
import java.util.* | ||
|
||
plugins { | ||
id("com.android.application") | ||
kotlin("android") | ||
kotlin("kapt") | ||
} | ||
|
||
android { | ||
compileSdk = buildTargetSdkVersion | ||
|
||
flavorDimensions(buildFlavor) | ||
|
||
defaultConfig { | ||
applicationId = "com.github.kr328.clash" | ||
|
||
minSdk = buildMinSdkVersion | ||
targetSdk = buildTargetSdkVersion | ||
|
||
versionCode = buildVersionCode | ||
versionName = buildVersionName | ||
|
||
resConfigs("zh-rCN", "zh-rHK", "zh-rTW") | ||
|
||
resValue("string", "release_name", "v$buildVersionName") | ||
resValue("integer", "release_code", "$buildVersionCode") | ||
} | ||
|
||
packagingOptions { | ||
exclude("DebugProbesKt.bin") | ||
} | ||
|
||
buildTypes { | ||
named("release") { | ||
isMinifyEnabled = true | ||
isShrinkResources = true | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
|
||
productFlavors { | ||
create("foss") { | ||
dimension = "foss" | ||
versionNameSuffix = ".foss" | ||
applicationIdSuffix = ".foss" | ||
} | ||
create("premium") { | ||
dimension = "premium" | ||
versionNameSuffix = ".premium" | ||
|
||
if (buildFlavor == "premium") { | ||
val localFile = rootProject.file("local.properties") | ||
if (localFile.exists()) { | ||
val appCenterKey = localFile.inputStream() | ||
.use { Properties().apply { load(it) } } | ||
.getProperty("appcenter.key", null) | ||
|
||
if (appCenterKey != null) { | ||
buildConfigField("String", "APP_CENTER_KEY", "\"$appCenterKey\"") | ||
} else { | ||
buildConfigField("String", "APP_CENTER_KEY", "null") | ||
} | ||
} else { | ||
buildConfigField("String", "APP_CENTER_KEY", "null") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val signingFile = rootProject.file("keystore.properties") | ||
if (signingFile.exists()) { | ||
val properties = Properties().apply { | ||
signingFile.inputStream().use { | ||
load(it) | ||
} | ||
} | ||
signingConfigs { | ||
create("release") { | ||
storeFile = rootProject.file(properties.getProperty("storeFile")!!) | ||
storePassword = properties.getProperty("storePassword")!! | ||
keyAlias = properties.getProperty("keyAlias")!! | ||
keyPassword = properties.getProperty("keyPassword")!! | ||
} | ||
} | ||
buildTypes { | ||
named("release") { | ||
signingConfig = signingConfigs["release"] | ||
} | ||
} | ||
} | ||
|
||
buildFeatures { | ||
dataBinding = true | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
splits { | ||
abi { | ||
isEnable = true | ||
isUniversalApk = true | ||
} | ||
} | ||
id("com.android.application") | ||
} | ||
|
||
dependencies { | ||
val premiumImplementation by configurations | ||
implementation(project(":core")) | ||
implementation(project(":service")) | ||
implementation(project(":design")) | ||
implementation(project(":common")) | ||
|
||
api(project(":core")) | ||
api(project(":service")) | ||
api(project(":design")) | ||
api(project(":common")) | ||
implementation(kotlin("stdlib-jdk7")) | ||
implementation(deps.kotlin.coroutine) | ||
implementation(deps.androidx.core) | ||
implementation(deps.androidx.activity) | ||
implementation(deps.androidx.fragment) | ||
implementation(deps.androidx.appcompat) | ||
implementation(deps.androidx.coordinator) | ||
implementation(deps.androidx.recyclerview) | ||
implementation(deps.google.material) | ||
|
||
premiumImplementation("com.microsoft.appcenter:appcenter-analytics:$appcenterVersion") | ||
premiumImplementation("com.microsoft.appcenter:appcenter-crashes:$appcenterVersion") | ||
val premiumImplementation by configurations | ||
|
||
implementation(kotlin("stdlib-jdk7")) | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion") | ||
implementation("androidx.core:core-ktx:$coreVersion") | ||
implementation("androidx.activity:activity:$activityVersion") | ||
implementation("androidx.appcompat:appcompat:$appcompatVersion") | ||
implementation("androidx.coordinatorlayout:coordinatorlayout:$coordinatorlayoutVersion") | ||
implementation("androidx.recyclerview:recyclerview:$recyclerviewVersion") | ||
implementation("androidx.fragment:fragment:$fragmentVersion") | ||
implementation("com.google.android.material:material:$materialVersion") | ||
premiumImplementation(deps.appcenter.analytics) | ||
premiumImplementation(deps.appcenter.crashes) | ||
} | ||
|
||
task("cleanRelease", type = Delete::class) { | ||
tasks.getByName("clean", type = Delete::class) { | ||
delete(file("release")) | ||
} | ||
|
||
afterEvaluate { | ||
tasks["clean"].dependsOn(tasks["cleanRelease"]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.