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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 23 additions & 28 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,7 @@ android {
}
}

sourceSets {
named("main") {
res {
srcDirs("src/common/res")
}
}
}
sourceSets { named("main") { res { srcDirs("src/common/res") } } }
namespace = defaultManagerPackageName
}

Expand All @@ -88,27 +82,28 @@ autoResConfig {

materialThemeBuilder {
themes {
for ((name, color) in listOf(
"Red" to "F44336",
"Pink" to "E91E63",
"Purple" to "9C27B0",
"DeepPurple" to "673AB7",
"Indigo" to "3F51B5",
"Blue" to "2196F3",
"LightBlue" to "03A9F4",
"Cyan" to "00BCD4",
"Teal" to "009688",
"Green" to "4FAF50",
"LightGreen" to "8BC3A4",
"Lime" to "CDDC39",
"Yellow" to "FFEB3B",
"Amber" to "FFC107",
"Orange" to "FF9800",
"DeepOrange" to "FF5722",
"Brown" to "795548",
"BlueGrey" to "607D8F",
"Sakura" to "FF9CA8"
)) {
for ((name, color) in
listOf(
"Red" to "F44336",
"Pink" to "E91E63",
"Purple" to "9C27B0",
"DeepPurple" to "673AB7",
"Indigo" to "3F51B5",
"Blue" to "2196F3",
"LightBlue" to "03A9F4",
"Cyan" to "00BCD4",
"Teal" to "009688",
"Green" to "4FAF50",
"LightGreen" to "8BC3A4",
"Lime" to "CDDC39",
"Yellow" to "FFEB3B",
"Amber" to "FFC107",
"Orange" to "FF9800",
"DeepOrange" to "FF5722",
"Brown" to "795548",
"BlueGrey" to "607D8F",
"Sakura" to "FF9CA8",
)) {
create("Material$name") {
lightThemeFormat = "ThemeOverlay.Light.%s"
darkThemeFormat = "ThemeOverlay.Dark.%s"
Expand Down
88 changes: 46 additions & 42 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ import org.gradle.api.provider.ValueSourceParameters
import org.gradle.process.ExecOperations

plugins {
alias(libs.plugins.lsplugin.cmaker)
alias(libs.plugins.lsplugin.jgit)
alias(libs.plugins.agp.lib) apply false
alias(libs.plugins.agp.app) apply false
alias(libs.plugins.nav.safeargs) apply false
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.ktfmt)
}
Expand Down Expand Up @@ -64,43 +61,9 @@ abstract class GitLatestTagValueSource : ValueSource<String, ValueSourceParamete
val versionCodeProvider by extra(providers.of(GitCommitCountValueSource::class.java) {})
val versionNameProvider by extra(providers.of(GitLatestTagValueSource::class.java) {})

val repo = jgit.repo()
val commitCount = (repo?.commitCount("refs/remotes/origin/master") ?: 1) + 4200
val latestTag = repo?.latestTag?.removePrefix("v") ?: "1.0"

val injectedPackageName by extra("com.android.shell")
val injectedPackageUid by extra(2000)

val defaultManagerPackageName by extra("org.lsposed.manager")
val verCode by extra(commitCount)
val verName by extra(latestTag)

cmaker {
default {
arguments.addAll(
arrayOf("-DVECTOR_ROOT=${rootDir.absolutePath}", "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON")
)
val flags =
arrayOf(
"-DINJECTED_UID=$injectedPackageUid",
"-DVERSION_CODE=${verCode}",
"-DVERSION_NAME='\"${verName}\"'",
"-Wno-gnu-string-literal-operator-template",
"-Wno-c++2b-extensions",
)
cFlags.addAll(flags)
cppFlags.addAll(flags)
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
}
buildTypes {
if (it.name == "release") {
arguments +=
"-DDEBUG_SYMBOLS_PATH=${
layout.buildDirectory.dir("symbols").get().asFile.absolutePath
}"
}
}
}

val androidTargetSdkVersion by extra(36)
val androidMinSdkVersion by extra(27)
Expand All @@ -110,15 +73,14 @@ val androidCompileNdkVersion by extra("29.0.13113456")
val androidSourceCompatibility by extra(JavaVersion.VERSION_21)
val androidTargetCompatibility by extra(JavaVersion.VERSION_21)

tasks.register("Delete", Delete::class) { delete(rootProject.layout.buildDirectory) }

subprojects {
plugins.withType(AndroidBasePlugin::class.java) {
extensions.configure(CommonExtension::class.java) {
compileSdk = androidCompileSdkVersion
ndkVersion = androidCompileNdkVersion
buildToolsVersion = androidBuildToolsVersion

buildFeatures { buildConfig = true }
externalNativeBuild {
cmake {
version = "3.29.8+"
Expand All @@ -128,10 +90,47 @@ subprojects {

defaultConfig {
minSdk = androidMinSdkVersion
ndk { abiFilters.addAll(listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")) }

if (this is ApplicationDefaultConfig) {
targetSdk = androidTargetSdkVersion
versionCode = verCode
versionName = verName

versionCode = versionCodeProvider.get().toInt()
versionName = versionNameProvider.get()
}

val flags =
listOf(
"-DVERSION_CODE=${versionCodeProvider.get()}",
"-DVERSION_NAME='\"${versionNameProvider.get()}\"'",
)

val args =
listOf(
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DVECTOR_ROOT=${rootDir.absolutePath}",
)

externalNativeBuild {
cmake {
cFlags.addAll(flags)
cppFlags.addAll(flags)
arguments.addAll(args)
}
}
}

buildTypes {
getByName("release") {
externalNativeBuild {
cmake {
arguments.add(
"-DDEBUG_SYMBOLS_PATH=${
layout.buildDirectory.dir("symbols").get().asFile.absolutePath
}"
)
}
}
}
}

Expand All @@ -156,7 +155,12 @@ subprojects {

tasks.register<KtfmtFormatTask>("format") {
source = project.fileTree(rootDir)
include("*.gradle.kts", "*/build.gradle.kts")
include(
"*.gradle.kts",
"*/build.gradle.kts",
"hiddenapi/*/build.gradle.kts",
"services/*-service/build.gradle.kts",
)
dependsOn(":xposed:ktfmtFormat")
dependsOn(":zygisk:ktfmtFormat")
}
Expand Down
37 changes: 6 additions & 31 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2021 - 2022 LSPosed Contributors
*/
val versionCodeProvider: Provider<String> by rootProject.extra
val versionNameProvider: Provider<String> by rootProject.extra

val verName: String by rootProject.extra
val verCode: Int by rootProject.extra

plugins {
alias(libs.plugins.agp.lib)
}
plugins { alias(libs.plugins.agp.lib) }

android {
namespace = "org.lsposed.lspd.core"

buildFeatures {
androidResources = false
buildConfig = true
}
androidResources { enable = false }

defaultConfig {
consumerProguardFiles("proguard-rules.pro")

buildConfigField("String", "FRAMEWORK_NAME", """"${rootProject.name}"""")
buildConfigField("String", "VERSION_NAME", """"$verName"""")
buildConfigField("long", "VERSION_CODE", """$verCode""")
buildConfigField("String", "VERSION_NAME", """"${versionCodeProvider.get()}"""")
buildConfigField("long", "VERSION_CODE", versionCodeProvider.get())
}

buildTypes {
Expand Down
37 changes: 0 additions & 37 deletions core/src/main/java/org/lsposed/lspd/nativebridge/HookBridge.java

This file was deleted.

25 changes: 0 additions & 25 deletions core/src/main/java/org/lsposed/lspd/nativebridge/NativeAPI.java

This file was deleted.

This file was deleted.

Loading
Loading