This repository has been archived by the owner on Mar 17, 2024. It is now read-only.
forked from LSPosed/LSPosed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
120 lines (108 loc) · 3.95 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* 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
*/
import com.android.build.api.dsl.ApplicationDefaultConfig
import com.android.build.api.dsl.CommonExtension
import com.android.build.gradle.api.AndroidBasePlugin
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
}
cmaker {
default {
arguments.addAll(
arrayOf(
"-DEXTERNAL_ROOT=${File(rootDir.absolutePath, "external")}",
"-DCORE_ROOT=${File(rootDir.absolutePath, "core/src/main/jni")}",
"-DANDROID_STL=none"
)
)
val flags = arrayOf(
"-DINJECTED_AID=$injectedPackageUid",
"-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 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)
val androidTargetSdkVersion by extra(34)
val androidMinSdkVersion by extra(27)
val androidBuildToolsVersion by extra("34.0.0")
val androidCompileSdkVersion by extra(34)
val androidCompileNdkVersion by extra("26.1.10909125")
val androidSourceCompatibility by extra(JavaVersion.VERSION_17)
val androidTargetCompatibility by extra(JavaVersion.VERSION_17)
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
externalNativeBuild {
cmake {
version = "3.22.1+"
}
}
defaultConfig {
minSdk = androidMinSdkVersion
if (this is ApplicationDefaultConfig) {
targetSdk = androidTargetSdkVersion
versionCode = verCode
versionName = verName
}
}
lint {
abortOnError = true
checkReleaseBuilds = false
}
compileOptions {
sourceCompatibility = androidSourceCompatibility
targetCompatibility = androidTargetCompatibility
}
}
}
plugins.withType(JavaPlugin::class.java) {
extensions.configure(JavaPluginExtension::class.java) {
sourceCompatibility = androidSourceCompatibility
targetCompatibility = androidTargetCompatibility
}
}
}