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
09a294c2
Commit
09a294c2
authored
May 12, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix release builds
parent
408399ea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
27 deletions
+6
-27
build.gradle.kts
app/build.gradle.kts
+2
-0
build.gradle.kts
build.gradle.kts
+4
-27
No files found.
app/build.gradle.kts
View file @
09a294c2
...
@@ -183,6 +183,8 @@ android.applicationVariants.all {
...
@@ -183,6 +183,8 @@ android.applicationVariants.all {
dependencies
{
dependencies
{
implementation
(
fileTree
(
mapOf
(
"dir"
to
"libs"
,
"include"
to
listOf
(
"*.jar"
))))
implementation
(
fileTree
(
mapOf
(
"dir"
to
"libs"
,
"include"
to
listOf
(
"*.jar"
))))
implementation
(
kotlin
(
"stdlib"
))
implementation
(
kotlin
(
"stdlib"
))
// Some dependencies request JDK 8 stdlib, specify manually here to prevent version mismatch
implementation
(
kotlin
(
"stdlib-jdk8"
))
implementation
(
project
(
":app:shared"
))
implementation
(
project
(
":app:shared"
))
implementation
(
"com.github.topjohnwu:jtar:1.0.0"
)
implementation
(
"com.github.topjohnwu:jtar:1.0.0"
)
...
...
build.gradle.kts
View file @
09a294c2
import
com.android.build.gradle.BaseExtension
import
com.android.build.gradle.BaseExtension
import
java.nio.file.Paths
plugins
{
plugins
{
id
(
"MagiskPlugin"
)
id
(
"MagiskPlugin"
)
...
@@ -30,24 +29,8 @@ tasks.register("clean", Delete::class) {
...
@@ -30,24 +29,8 @@ tasks.register("clean", Delete::class) {
delete
(
rootProject
.
buildDir
)
delete
(
rootProject
.
buildDir
)
}
}
val
Project
.
android
get
()
=
extensions
.
getByName
<
BaseExtension
>(
"android"
)
fun
Project
.
android
(
configuration
:
BaseExtension
.()
->
Unit
)
=
extensions
.
getByName
<
BaseExtension
>(
"android"
).
configuration
()
fun
Task
.
applyOptimize
()
=
doLast
{
val
aapt2
=
Paths
.
get
(
project
.
android
.
sdkDirectory
.
path
,
"build-tools"
,
project
.
android
.
buildToolsVersion
,
"aapt2"
)
val
zip
=
Paths
.
get
(
project
.
buildDir
.
path
,
"intermediates"
,
"shrunk_processed_res"
,
"release"
,
"resources-release-stripped.ap_"
)
val
optimized
=
File
(
"${zip}.opt"
)
val
cmd
=
exec
{
commandLine
(
aapt2
,
"optimize"
,
"--collapse-resource-names"
,
"--shorten-resource-paths"
,
"-o"
,
optimized
,
zip
)
isIgnoreExitValue
=
true
}
if
(
cmd
.
exitValue
==
0
)
{
zip
.
toFile
().
delete
()
optimized
.
renameTo
(
zip
.
toFile
())
}
}
subprojects
{
subprojects
{
repositories
{
repositories
{
...
@@ -59,7 +42,7 @@ subprojects {
...
@@ -59,7 +42,7 @@ subprojects {
afterEvaluate
{
afterEvaluate
{
if
(
plugins
.
hasPlugin
(
"com.android.library"
)
||
if
(
plugins
.
hasPlugin
(
"com.android.library"
)
||
plugins
.
hasPlugin
(
"com.android.application"
))
{
plugins
.
hasPlugin
(
"com.android.application"
))
{
android
.
apply
{
android
{
compileSdkVersion
(
30
)
compileSdkVersion
(
30
)
buildToolsVersion
=
"30.0.3"
buildToolsVersion
=
"30.0.3"
ndkPath
=
"${System.getenv("
ANDROID_SDK_ROOT
")}/ndk/magisk"
ndkPath
=
"${System.getenv("
ANDROID_SDK_ROOT
")}/ndk/magisk"
...
@@ -86,14 +69,8 @@ subprojects {
...
@@ -86,14 +69,8 @@ subprojects {
}
}
}
}
tasks
.
whenTaskAdded
{
if
(
name
==
"shrinkReleaseRes"
)
{
finalizedBy
(
tasks
.
create
(
"optimizeReleaseRes"
).
applyOptimize
())
}
}
if
(
name
==
"app"
||
name
==
"stub"
)
{
if
(
name
==
"app"
||
name
==
"stub"
)
{
android
.
apply
{
android
{
signingConfigs
{
signingConfigs
{
create
(
"config"
)
{
create
(
"config"
)
{
Config
[
"keyStore"
]
?.
also
{
Config
[
"keyStore"
]
?.
also
{
...
...
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