Commit 08a70f03 authored by topjohnwu's avatar topjohnwu

Add entrypoint to build test

Just for convenience, nothing special here
parent 1b0c36db
......@@ -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'
......
......@@ -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')
}
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment