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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "hevtunnel/src/main/jni/hev-socks5-tunnel"]
path = hevtunnel/src/main/jni/hev-socks5-tunnel
url = https://github.com/heiher/hev-socks5-tunnel
[submodule "tunnel/tools/amneziawg-tools"]
path = tunnel/tools/amneziawg-tools
url = https://github.com/amnezia-vpn/amneziawg-tools
95 changes: 59 additions & 36 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import com.android.build.api.dsl.ApplicationExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlinxSerialization)
alias(libs.plugins.ksp)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.grgit)
alias(libs.plugins.licensee)
}

android {
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}

licensee {
allowedLicenses().forEach { allow(it) }
allowedLicenseUrls().forEach { allowUrl(it) }
// foss, but missing licenses
ignoreDependencies("com.github.T8RIN.QuickieExtended")
ignoreDependencies("com.github.topjohnwu.libsu")
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs = listOf("-XXLanguage:+PropertyParamAnnotationDefaultTargetMode")
}
}

configure<ApplicationExtension> {
namespace = Constants.APP_ID
compileSdk = Constants.TARGET_SDK

Expand All @@ -22,8 +40,6 @@ android {
includeInBundle = false
}

ksp { arg("room.schemaLocation", "$projectDir/schemas") }

// fix okhttp proguard issue
packaging { resources { pickFirsts.add("okhttp3/internal/publicsuffix/publicsuffixes.gz") } }

Expand Down Expand Up @@ -119,28 +135,16 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs = listOf("-XXLanguage:+PropertyParamAnnotationDefaultTargetMode")
}
}

buildFeatures {
compose = true
buildConfig = true
resValues = true
}
packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } }
}

licensee {
allowedLicenses().forEach { allow(it) }
allowedLicenseUrls().forEach { allowUrl(it) }
// foss, but missing license
ignoreDependencies("com.github.T8RIN.QuickieExtended")
}

android.applicationVariants.all {
val variant = this
androidComponents {
onVariants { variant ->

val abiNameMap =
mapOf(
Expand All @@ -150,28 +154,50 @@ android {
"x86_64" to "x64",
)

variant.outputs.all {
val output = this as BaseVariantOutputImpl
val abi = output.getFilter("ABI")
val variantCap =
variant.name.replaceFirstChar { it.uppercase() }

tasks.register<Copy>("rename${variantCap}Apk") {

val apkFolder =
layout.buildDirectory.dir("outputs/apk/${variant.name}")

from(apkFolder)

include("*.apk")

into(layout.buildDirectory.dir("renamed-apks"))

val baseFileName = "${Constants.APP_NAME}-${variant.flavorName}-v${variant.versionName}"
rename { originalName ->

val outputFileName =
if (!abi.isNullOrEmpty()) {
val shortAbiName = abiNameMap.getOrDefault(abi, abi)
"${baseFileName}-${shortAbiName}.apk"
val abi =
abiNameMap.entries.find { entry ->
originalName.contains(entry.key)
}?.value

val versionName =
variant.outputs.single().versionName.get()

val flavorName =
variant.productFlavors.joinToString("-") { it.second }

val baseName =
"${Constants.APP_NAME}-${flavorName}-v$versionName"

if (abi != null) {
"$baseName-$abi.apk"
} else {
"${baseFileName}.apk"
"$baseName.apk"
}

output.outputFileName = outputFileName
}
}
}
}

dependencies {
implementation(project(":logcatter"))
implementation(project(":networkmonitor"))
implementation(project(":tunnel"))

// Core foundations
implementation(libs.bundles.androidx.core.full)
Expand Down Expand Up @@ -208,9 +234,6 @@ dependencies {
// State management
implementation(libs.bundles.orbit.mvi)

// Tunnel
implementation(libs.bundles.wireguard.tunnel)

// Shizuku
implementation(libs.bundles.shizuku)

Expand Down Expand Up @@ -268,7 +291,7 @@ tasks.register<Copy>("copyLicenseeJsonToAssets") {
tasks.named("preBuild") { dependsOn("copyLicenseeJsonToAssets") }

// https://gist.github.com/obfusk/61046e09cee352ae6dd109911534b12e#fix-proposed-by-linsui-disable-baseline-profiles
tasks.whenTaskAdded {
tasks.configureEach {
if (name.contains("ArtProfile")) {
enabled = false
}
Expand Down
Loading
Loading