Add entrypoint to build test

Just for convenience, nothing special here
This commit is contained in:
topjohnwu 2019-04-01 02:46:09 -04:00
parent 1b0c36dbd5
commit 08a70f033a
4 changed files with 21 additions and 4 deletions

View File

@ -102,7 +102,7 @@ def zip_with_msg(zip_file, source, target):
def collect_binary():
for arch in archs + arch64:
mkdir_p(os.path.join('native', 'out', arch))
for bin in ['magisk', 'magiskinit', 'magiskinit64', 'magiskboot', 'busybox']:
for bin in ['magisk', 'magiskinit', 'magiskinit64', 'magiskboot', 'busybox', 'test']:
source = os.path.join('native', 'libs', arch, bin)
target = os.path.join('native', 'out', arch, bin)
mv(source, target)
@ -183,14 +183,14 @@ def run_ndk_build(flags):
def build_binary(args):
support_targets = {'magisk', 'magiskinit', 'magiskboot', 'busybox'}
support_targets = {'magisk', 'magiskinit', 'magiskboot', 'busybox', 'test'}
if args.target:
args.target = set(args.target) & support_targets
if not args.target:
return
else:
# If nothing specified, build everything
args.target = support_targets
args.target = ['magisk', 'magiskinit', 'magiskboot', 'busybox']
header('* Building binaries: ' + ' '.join(args.target))
@ -230,6 +230,9 @@ def build_binary(args):
if 'magiskboot' in args.target:
run_ndk_build('B_BOOT=1')
if 'test' in args.target:
run_ndk_build('B_TEST=1')
def build_apk(args, module):
build_type = 'Release' if args.release else 'Debug'

View File

@ -12,7 +12,7 @@ android {
externalNativeBuild {
ndkBuild {
// Pass arguments to ndk-build.
arguments('B_MAGISK=1', 'B_INIT64=1', 'B_BOOT=1',
arguments('B_MAGISK=1', 'B_INIT64=1', 'B_BOOT=1', 'B_TEST=1',
'MAGISK_DEBUG=1', 'MAGISK_VERSION=debug', 'MAGISK_VER_CODE=INT_MAX')
}
}

1
native/jni/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
test.cpp

View File

@ -121,6 +121,19 @@ include $(BUILD_EXECUTABLE)
endif
ifdef B_TEST
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_STATIC_LIBRARIES := libutils
LOCAL_C_INCLUDES := \
jni/include \
$(LIBUTILS)
LOCAL_SRC_FILES := test.cpp
include $(BUILD_EXECUTABLE)
endif
ifdef B_BB
include jni/external/busybox/Android.mk