Greatly reduce Gradle sync time and frequency

This commit is contained in:
topjohnwu 2017-12-04 22:21:19 +08:00
parent bb97cc594d
commit fd8dbe3eff
4 changed files with 9 additions and 6 deletions

View File

@ -88,8 +88,8 @@ def build_all(args):
def build_binary(args):
header('* Building Magisk binaries')
# Force update Android.mk timestamp to trigger recompilation
os.utime(os.path.join('core', 'jni', 'Android.mk'))
# Force update logging.h timestamp to trigger recompilation
os.utime(os.path.join('core', 'jni', 'include', 'logging.h'))
debug_flag = '' if args.release else '-DMAGISK_DEBUG'
cflag = 'MAGISK_FLAGS=\"-DMAGISK_VERSION=\\\"{}\\\" -DMAGISK_VER_CODE={} {}\"'.format(args.versionString, args.versionCode, debug_flag)
@ -385,7 +385,8 @@ def cleanup(args):
if 'binary' in args.target:
header('* Cleaning binaries')
subprocess.run(ndk_build + ' -C core COMPILEALL=true clean', shell=True)
subprocess.run(ndk_build + ' -C core PRECOMPILE=true clean', shell=True)
subprocess.run(ndk_build + ' -C core clean', shell=True)
for arch in ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']:
shutil.rmtree(os.path.join('out', arch), ignore_errors=True)

View File

@ -13,7 +13,7 @@ android {
externalNativeBuild {
ndkBuild {
// Passes an optional argument to ndk-build.
arguments "COMPILEALL=true"
arguments "GRADLE=true"
}
}
}

View File

@ -14,7 +14,7 @@ LIBFDT := $(EXT_PATH)/dtc/libfdt
# Binaries
########################
ifneq "$(or $(PRECOMPILE), $(COMPILEALL))" ""
ifneq "$(or $(PRECOMPILE), $(GRADLE))" ""
# magisk main binary
include $(CLEAR_VARS)
@ -115,6 +115,7 @@ LOCAL_LDLIBS := -lz
include $(BUILD_EXECUTABLE)
# 32-bit static binaries
ifndef GRADLE # Do not run gradle sync on these binaries
ifneq ($(TARGET_ARCH_ABI), x86_64)
ifneq ($(TARGET_ARCH_ABI), arm64-v8a)
# b64xz
@ -129,6 +130,7 @@ include $(BUILD_EXECUTABLE)
include jni/external/busybox/Android.mk
endif
endif
endif
# Precompile
endif

View File

@ -40,7 +40,7 @@ static void usage() {
" -c print current binary version\n"
" -v print running daemon version\n"
" -V print running daemon version code\n"
" --list list all availible applets\n"
" --list list all available applets\n"
" --install [SOURCE] DIR symlink all applets to DIR. SOURCE is optional\n"
" --createimg IMG SIZE create ext4 image. SIZE is interpreted in MB\n"
" --imgsize IMG report ext4 image used/total size\n"