mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Split stub APK to new task
This commit is contained in:
parent
d4568aa0a7
commit
075f0458f7
52
build.py
52
build.py
@ -264,28 +264,17 @@ def build_apk(args):
|
|||||||
cp(source, target)
|
cp(source, target)
|
||||||
|
|
||||||
if args.release:
|
if args.release:
|
||||||
proc = execv([gradlew, 'app:assembleRelease'])
|
proc = execv([gradlew, 'app:assembleFullRelease'])
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
error('Build Magisk Manager failed!')
|
error('Build Magisk Manager failed!')
|
||||||
|
|
||||||
unsigned = os.path.join('app', 'build', 'outputs', 'apk', 'full', 'release', 'app-full-release-unsigned.apk')
|
source = os.path.join('app', 'build', 'outputs', 'apk', 'full', 'release', 'app-full-release-unsigned.apk')
|
||||||
release = os.path.join(config['outdir'], 'app-release.apk')
|
target = os.path.join(config['outdir'], 'app-release.apk')
|
||||||
sign_apk(unsigned, release)
|
sign_apk(source, target)
|
||||||
header('Output: ' + release)
|
header('Output: ' + target)
|
||||||
rm(unsigned)
|
rm(source)
|
||||||
|
|
||||||
unsigned = os.path.join('app', 'build', 'outputs', 'apk', 'stub', 'release', 'app-stub-release-unsigned.apk')
|
|
||||||
release = os.path.join(config['outdir'], 'stub-release.apk')
|
|
||||||
sign_apk(unsigned, release)
|
|
||||||
header('Output: ' + release)
|
|
||||||
rm(unsigned)
|
|
||||||
# Dump the stub APK to header
|
|
||||||
mkdir(os.path.join('native', 'out'))
|
|
||||||
with open(os.path.join('native', 'out', 'binaries.h'), 'w') as out:
|
|
||||||
with open(release, 'rb') as src:
|
|
||||||
binary_dump(src, out, 'manager_xz');
|
|
||||||
else:
|
else:
|
||||||
proc = execv([gradlew, 'app:assembleDebug'])
|
proc = execv([gradlew, 'app:assembleFullDebug'])
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
error('Build Magisk Manager failed!')
|
error('Build Magisk Manager failed!')
|
||||||
|
|
||||||
@ -294,11 +283,35 @@ def build_apk(args):
|
|||||||
mv(source, target)
|
mv(source, target)
|
||||||
header('Output: ' + target)
|
header('Output: ' + target)
|
||||||
|
|
||||||
|
def build_stub(args):
|
||||||
|
header('* Building stub Magisk Manager')
|
||||||
|
|
||||||
|
if args.release:
|
||||||
|
proc = execv([gradlew, 'app:assembleStubRelease'])
|
||||||
|
if proc.returncode != 0:
|
||||||
|
error('Build stub Magisk Manager failed!')
|
||||||
|
|
||||||
|
source = os.path.join('app', 'build', 'outputs', 'apk', 'stub', 'release', 'app-stub-release-unsigned.apk')
|
||||||
|
target = os.path.join(config['outdir'], 'stub-release.apk')
|
||||||
|
sign_apk(source, target)
|
||||||
|
header('Output: ' + target)
|
||||||
|
rm(source)
|
||||||
|
else:
|
||||||
|
proc = execv([gradlew, 'app:assembleStubDebug'])
|
||||||
|
if proc.returncode != 0:
|
||||||
|
error('Build stub Magisk Manager failed!')
|
||||||
|
|
||||||
source = os.path.join('app', 'build', 'outputs', 'apk', 'stub', 'debug', 'app-stub-debug.apk')
|
source = os.path.join('app', 'build', 'outputs', 'apk', 'stub', 'debug', 'app-stub-debug.apk')
|
||||||
target = os.path.join(config['outdir'], 'stub-debug.apk')
|
target = os.path.join(config['outdir'], 'stub-debug.apk')
|
||||||
mv(source, target)
|
mv(source, target)
|
||||||
header('Output: ' + target)
|
header('Output: ' + target)
|
||||||
|
|
||||||
|
# Dump the stub APK to header
|
||||||
|
mkdir(os.path.join('native', 'out'))
|
||||||
|
with open(os.path.join('native', 'out', 'binaries.h'), 'w') as out:
|
||||||
|
with open(target, 'rb') as src:
|
||||||
|
binary_dump(src, out, 'manager_xz');
|
||||||
|
|
||||||
def build_snet(args):
|
def build_snet(args):
|
||||||
proc = execv([gradlew, 'snet:assembleRelease'])
|
proc = execv([gradlew, 'snet:assembleRelease'])
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
@ -469,6 +482,9 @@ binary_parser.set_defaults(func=build_binary)
|
|||||||
apk_parser = subparsers.add_parser('apk', help='build Magisk Manager APK')
|
apk_parser = subparsers.add_parser('apk', help='build Magisk Manager APK')
|
||||||
apk_parser.set_defaults(func=build_apk)
|
apk_parser.set_defaults(func=build_apk)
|
||||||
|
|
||||||
|
stub_parser = subparsers.add_parser('stub', help='build stub Magisk Manager APK')
|
||||||
|
stub_parser.set_defaults(func=build_stub)
|
||||||
|
|
||||||
snet_parser = subparsers.add_parser('snet', help='build snet extention for Magisk Manager')
|
snet_parser = subparsers.add_parser('snet', help='build snet extention for Magisk Manager')
|
||||||
snet_parser.set_defaults(func=build_snet)
|
snet_parser.set_defaults(func=build_snet)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user