mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-21 15:05:28 +00:00
Migrate to AGP 4.1.0
This commit is contained in:
parent
468796c23d
commit
a079966f97
6
app/proguard-rules.pro
vendored
6
app/proguard-rules.pro
vendored
@ -35,12 +35,6 @@
|
||||
void onResponse(org.json.JSONObject);
|
||||
}
|
||||
|
||||
# Fragments
|
||||
# TODO: Remove when AGP 4.1 release
|
||||
# https://issuetracker.google.com/issues/142601969
|
||||
-keep,allowobfuscation class * extends androidx.fragment.app.Fragment
|
||||
-keepnames class androidx.navigation.fragment.NavHostFragment
|
||||
|
||||
# Strip Timber verbose and debug logging
|
||||
-assumenosideeffects class timber.log.Timber.Tree {
|
||||
public void v(**);
|
||||
|
@ -37,7 +37,7 @@ 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",
|
||||
"processed_res", "release", "out", "resources-release.ap_")
|
||||
"shrunk_processed_res", "release", "resources-release-stripped.ap_")
|
||||
val optimized = File("${zip}.opt")
|
||||
val cmd = exec {
|
||||
commandLine(aapt2, "optimize", "--collapse-resource-names",
|
||||
@ -45,6 +45,7 @@ fun Task.applyOptimize() = doLast {
|
||||
isIgnoreExitValue = true
|
||||
}
|
||||
if (cmd.exitValue == 0) {
|
||||
zip.toFile().delete()
|
||||
optimized.renameTo(zip.toFile())
|
||||
}
|
||||
}
|
||||
@ -63,6 +64,7 @@ subprojects {
|
||||
android.apply {
|
||||
compileSdkVersion(30)
|
||||
buildToolsVersion = "30.0.2"
|
||||
ndkPath = "${System.getenv("ANDROID_HOME")}/ndk/magisk"
|
||||
|
||||
defaultConfig {
|
||||
if (minSdkVersion == null)
|
||||
@ -87,8 +89,8 @@ subprojects {
|
||||
}
|
||||
|
||||
tasks.whenTaskAdded {
|
||||
if (name == "processReleaseResources") {
|
||||
finalizedBy(tasks.create("optimizeReleaseResources").applyOptimize())
|
||||
if (name == "shrinkReleaseRes") {
|
||||
finalizedBy(tasks.create("optimizeReleaseRes").applyOptimize())
|
||||
}
|
||||
}
|
||||
|
||||
|
17
build.py
17
build.py
@ -55,8 +55,8 @@ arch64 = ['arm64-v8a', 'x86_64']
|
||||
support_targets = ['magisk', 'magiskinit', 'magiskboot', 'magiskpolicy', 'resetprop', 'busybox', 'test']
|
||||
default_targets = ['magisk', 'magiskinit', 'magiskboot', 'busybox']
|
||||
|
||||
ndk_ver = '21c'
|
||||
ndk_ver_full = '21.2.6472646'
|
||||
ndk_ver = '21d'
|
||||
ndk_ver_full = '21.3.6528147'
|
||||
|
||||
ndk_root = op.join(os.environ['ANDROID_HOME'], 'ndk')
|
||||
ndk_path = op.join(ndk_root, 'magisk')
|
||||
@ -285,8 +285,8 @@ def dump_bin_headers():
|
||||
def build_binary(args):
|
||||
# Verify NDK install
|
||||
props = parse_props(op.join(ndk_path, 'source.properties'))
|
||||
if 'Pkg.Revision.orig' not in props or props['Pkg.Revision.orig'] != ndk_ver_full:
|
||||
error('Incorrect NDK. Please setup NDK with "build.py ndk"')
|
||||
if props['Pkg.Revision'] != ndk_ver_full:
|
||||
error('Incorrect NDK. Please install/upgrade NDK with "build.py ndk"')
|
||||
|
||||
if args.target:
|
||||
args.target = set(args.target) & set(support_targets)
|
||||
@ -550,15 +550,6 @@ def setup_ndk(args):
|
||||
for path in copy_tree(src_dir, lib_dir):
|
||||
vprint(f'Replaced {path}')
|
||||
|
||||
# Rewrite source.properties
|
||||
src_prop = op.join(ndk_path, 'source.properties')
|
||||
props = parse_props(src_prop)
|
||||
props['Pkg.Revision.orig'] = props['Pkg.Revision']
|
||||
props['Pkg.Revision'] = '99.99.99'
|
||||
with open(src_prop, 'w') as p:
|
||||
for key, val in props.items():
|
||||
print(f'{key} = {val}', file=p)
|
||||
|
||||
|
||||
def build_all(args):
|
||||
vars(args)['target'] = []
|
||||
|
@ -4,8 +4,6 @@ plugins {
|
||||
|
||||
android {
|
||||
|
||||
ndkVersion = "99.99.99"
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path("jni/Android.mk")
|
||||
|
Loading…
Reference in New Issue
Block a user