Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
810cf4de
Commit
810cf4de
authored
Sep 07, 2021
by
vvb2060
Committed by
John Wu
Sep 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move config to buildSrc
parent
9bf835e8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
103 additions
and
120 deletions
+103
-120
build.gradle.kts
app/build.gradle.kts
+7
-3
build.gradle.kts
app/shared/build.gradle.kts
+2
-1
build.gradle.kts
build.gradle.kts
+0
-98
build.gradle.kts
buildSrc/build.gradle.kts
+5
-0
Setup.kt
buildSrc/src/main/java/Setup.kt
+68
-0
build.gradle.kts
native/build.gradle.kts
+3
-2
settings.gradle.kts
settings.gradle.kts
+10
-0
build.gradle.kts
stub/build.gradle.kts
+8
-16
No files found.
app/build.gradle.kts
View file @
810cf4de
...
...
@@ -20,6 +20,8 @@ kapt {
}
}
setupApp
()
android
{
defaultConfig
{
applicationId
=
"com.topjohnwu.magisk"
...
...
@@ -30,7 +32,7 @@ android {
}
buildTypes
{
getByName
(
"release"
)
{
release
{
isMinifyEnabled
=
true
isShrinkResources
=
true
proguardFiles
(
"proguard-rules.pro"
)
...
...
@@ -135,7 +137,9 @@ val syncResources by tasks.registering(Sync::class) {
}
}
tasks
[
"preBuild"
]
?.
dependsOn
(
syncResources
)
tasks
.
preBuild
{
dependsOn
(
syncResources
)
}
android
.
applicationVariants
.
all
{
val
keysDir
=
rootProject
.
file
(
"tools/keys"
)
...
...
@@ -203,7 +207,7 @@ dependencies {
implementation
(
"androidx.room:room-ktx:${vRoom}"
)
kapt
(
"androidx.room:room-compiler:${vRoom}"
)
val
vNav
:
String
by
rootProject
.
extra
val
vNav
=
"2.4.0-alpha07"
implementation
(
"androidx.navigation:navigation-fragment-ktx:${vNav}"
)
implementation
(
"androidx.navigation:navigation-ui-ktx:${vNav}"
)
...
...
app/shared/build.gradle.kts
View file @
810cf4de
...
...
@@ -2,9 +2,10 @@ plugins {
id
(
"com.android.library"
)
}
setupCommon
()
android
{
defaultConfig
{
vectorDrawables
.
useSupportLibrary
=
true
consumerProguardFiles
(
"proguard-rules.pro"
)
}
}
...
...
build.gradle.kts
View file @
810cf4de
import
com.android.build.gradle.BaseExtension
plugins
{
id
(
"MagiskPlugin"
)
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
{
repositories
{
google
()
mavenCentral
()
}
val
vNav
=
"2.4.0-alpha06"
extra
[
"vNav"
]
=
vNav
dependencies
{
classpath
(
"com.android.tools.build:gradle:7.0.2"
)
classpath
(
kotlin
(
"gradle-plugin"
,
version
=
"1.5.30"
))
classpath
(
"androidx.navigation:navigation-safe-args-gradle-plugin:${vNav}"
)
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
tasks
.
register
(
"clean"
,
Delete
::
class
)
{
delete
(
rootProject
.
buildDir
)
}
fun
Project
.
android
(
configuration
:
BaseExtension
.()
->
Unit
)
=
extensions
.
getByName
<
BaseExtension
>(
"android"
).
configuration
()
subprojects
{
repositories
{
google
()
mavenCentral
()
maven
{
url
=
uri
(
"https://jitpack.io"
)
}
}
afterEvaluate
{
if
(
plugins
.
hasPlugin
(
"com.android.library"
)
||
plugins
.
hasPlugin
(
"com.android.application"
)
)
{
android
{
compileSdkVersion
(
31
)
buildToolsVersion
=
"31.0.0"
ndkPath
=
"${System.getenv("
ANDROID_SDK_ROOT
")}/ndk/magisk"
defaultConfig
{
if
(
minSdk
==
null
)
minSdk
=
21
targetSdk
=
31
}
compileOptions
{
sourceCompatibility
=
JavaVersion
.
VERSION_11
targetCompatibility
=
JavaVersion
.
VERSION_11
}
}
}
if
(
plugins
.
hasPlugin
(
"java"
))
{
tasks
.
withType
<
JavaCompile
>
{
// If building with JDK 9+, we need additional flags to generate compatible bytecode
if
(
JavaVersion
.
current
()
>
JavaVersion
.
VERSION_1_8
)
{
options
.
compilerArgs
.
addAll
(
listOf
(
"--release"
,
"8"
))
}
}
}
if
(
name
==
"app"
||
name
==
"stub"
)
{
android
{
signingConfigs
{
create
(
"config"
)
{
Config
[
"keyStore"
]
?.
also
{
storeFile
=
rootProject
.
file
(
it
)
storePassword
=
Config
[
"keyStorePass"
]
keyAlias
=
Config
[
"keyAlias"
]
keyPassword
=
Config
[
"keyPass"
]
}
}
}
buildTypes
{
signingConfigs
.
getByName
(
"config"
).
also
{
getByName
(
"debug"
)
{
signingConfig
=
if
(
it
.
storeFile
?.
exists
()
==
true
)
it
else
signingConfigs
.
getByName
(
"debug"
)
}
getByName
(
"release"
)
{
signingConfig
=
if
(
it
.
storeFile
?.
exists
()
==
true
)
it
else
signingConfigs
.
getByName
(
"debug"
)
}
}
}
lintOptions
{
disable
+=
"MissingTranslation"
}
}
}
}
}
buildSrc/build.gradle.kts
View file @
810cf4de
...
...
@@ -2,6 +2,7 @@ plugins {
`
kotlin
-
dsl
`
}
repositories
{
google
()
mavenCentral
()
}
...
...
@@ -15,5 +16,9 @@ gradlePlugin {
}
dependencies
{
implementation
(
kotlin
(
"gradle-plugin"
,
"1.5.30"
))
implementation
(
"com.android.tools.build:gradle:7.0.2"
)
implementation
(
"androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0-alpha07"
)
implementation
(
"io.michaelrocks:paranoid-gradle-plugin:0.3.5"
)
implementation
(
"org.eclipse.jgit:org.eclipse.jgit:5.12.0.202106070339-r"
)
}
buildSrc/src/main/java/Setup.kt
0 → 100644
View file @
810cf4de
import
com.android.build.gradle.BaseExtension
import
org.gradle.api.Action
import
org.gradle.api.JavaVersion
import
org.gradle.api.Project
import
org.gradle.api.tasks.compile.JavaCompile
import
org.gradle.kotlin.dsl.withType
private
fun
Project
.
android
(
configure
:
Action
<
BaseExtension
>)
=
extensions
.
configure
(
"android"
,
configure
)
fun
Project
.
setupCommon
()
{
android
{
compileSdkVersion
(
31
)
buildToolsVersion
=
"31.0.0"
ndkPath
=
"${System.getenv("
ANDROID_SDK_ROOT
")}/ndk/magisk"
defaultConfig
{
minSdk
=
21
targetSdk
=
31
}
compileOptions
{
sourceCompatibility
=
JavaVersion
.
VERSION_11
targetCompatibility
=
JavaVersion
.
VERSION_11
}
}
if
(
plugins
.
hasPlugin
(
"java"
))
{
tasks
.
withType
<
JavaCompile
>
{
// If building with JDK 9+, we need additional flags to generate compatible bytecode
if
(
JavaVersion
.
current
()
>
JavaVersion
.
VERSION_1_8
)
{
options
.
compilerArgs
.
addAll
(
listOf
(
"--release"
,
"8"
))
}
}
}
}
fun
Project
.
setupApp
()
{
setupCommon
()
android
{
signingConfigs
{
create
(
"config"
)
{
Config
[
"keyStore"
]
?.
also
{
storeFile
=
rootProject
.
file
(
it
)
storePassword
=
Config
[
"keyStorePass"
]
keyAlias
=
Config
[
"keyAlias"
]
keyPassword
=
Config
[
"keyPass"
]
}
}
}
buildTypes
{
signingConfigs
.
getByName
(
"config"
).
also
{
getByName
(
"debug"
)
{
signingConfig
=
if
(
it
.
storeFile
?.
exists
()
==
true
)
it
else
signingConfigs
.
getByName
(
"debug"
)
}
getByName
(
"release"
)
{
signingConfig
=
if
(
it
.
storeFile
?.
exists
()
==
true
)
it
else
signingConfigs
.
getByName
(
"debug"
)
}
}
}
lintOptions
{
disable
+=
"MissingTranslation"
}
}
}
native/build.gradle.kts
View file @
810cf4de
...
...
@@ -2,8 +2,9 @@ plugins {
id
(
"com.android.library"
)
}
android
{
setupCommon
()
android
{
externalNativeBuild
{
ndkBuild
{
path
(
"jni/Android.mk"
)
...
...
@@ -15,7 +16,7 @@ android {
ndkBuild
{
// Pass arguments to ndk-build.
arguments
(
"B_MAGISK=1"
,
"B_INIT=1"
,
"B_BOOT=1"
,
"B_TEST=1"
,
"MAGISK_DEBUG=1"
,
"MAGISK_VERSION=debug"
,
"MAGISK_VER_CODE=INT_MAX"
)
"MAGISK_DEBUG=1"
,
"MAGISK_VERSION=debug"
,
"MAGISK_VER_CODE=INT_MAX"
)
}
}
}
...
...
settings.gradle.kts
View file @
810cf4de
@Suppress
(
"UnstableApiUsage"
)
dependencyResolutionManagement
{
repositoriesMode
.
set
(
RepositoriesMode
.
FAIL_ON_PROJECT_REPOS
)
repositories
{
google
()
mavenCentral
()
maven
(
"https://jitpack.io"
)
}
}
rootProject
.
name
=
"Magisk"
include
(
":app"
,
":app:shared"
,
":native"
,
":stub"
)
stub/build.gradle.kts
View file @
810cf4de
import
io.michaelrocks.paranoid.plugin.ParanoidExtension
import
org.gradle.internal.os.OperatingSystem
import
java.io.OutputStream
import
java.io.PrintStream
...
...
@@ -7,24 +5,16 @@ import java.nio.file.Paths
plugins
{
id
(
"com.android.application"
)
id
(
"io.michaelrocks.paranoid"
)
}
buildscript
{
repositories
{
mavenCentral
()
}
dependencies
{
classpath
(
"io.michaelrocks:paranoid-gradle-plugin:0.3.5"
)
}
}
apply
(
plugin
=
"io.michaelrocks.paranoid"
)
extensions
.
configure
<
ParanoidExtension
>(
"paranoid"
)
{
paranoid
{
obfuscationSeed
=
if
(
RAND_SEED
!=
0
)
RAND_SEED
else
null
includeSubprojects
=
true
}
setupApp
()
android
{
val
canary
=
!
Config
.
version
.
contains
(
"."
)
...
...
@@ -40,7 +30,7 @@ android {
}
buildTypes
{
getByName
(
"release"
)
{
release
{
isMinifyEnabled
=
true
isShrinkResources
=
false
proguardFiles
(
"proguard-rules.pro"
)
...
...
@@ -63,7 +53,9 @@ val ensureManifest by tasks.registering {
}
}
tasks
[
"preBuild"
]
?.
dependsOn
(
ensureManifest
)
tasks
.
preBuild
{
dependsOn
(
ensureManifest
)
}
android
.
applicationVariants
.
all
{
val
manifest
=
file
(
"src/main/AndroidManifest.xml"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment