Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
9fb9212b
Commit
9fb9212b
authored
May 27, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stub apk support
parent
f31a24b1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
30 deletions
+39
-30
app
app
+1
-1
build.py
build.py
+38
-29
No files found.
app
@
7b9ddc9b
Subproject commit
630f2b7d199808d54b57f22ae0d7794baed51590
Subproject commit
7b9ddc9b3b946c125af021058170f4fa9a44e07f
build.py
View file @
9fb9212b
...
@@ -163,32 +163,12 @@ def build_binary(args):
...
@@ -163,32 +163,12 @@ def build_binary(args):
error
(
'Build binaries failed!'
)
error
(
'Build binaries failed!'
)
collect_binary
()
collect_binary
()
def
build_apk
(
args
):
def
sign_apk
(
source
,
target
):
header
(
'* Building Magisk Manager'
)
mkdir
(
os
.
path
.
join
(
'app'
,
'src'
,
'main'
,
'assets'
))
for
script
in
[
'magisk_uninstaller.sh'
,
'util_functions.sh'
]:
source
=
os
.
path
.
join
(
'scripts'
,
script
)
target
=
os
.
path
.
join
(
'app'
,
'src'
,
'main'
,
'assets'
,
script
)
cp
(
source
,
target
)
if
args
.
release
:
if
not
os
.
path
.
exists
(
'release-key.jks'
):
error
(
'Please generate a java keystore and place it in
\'
release-key.jks
\'
'
)
proc
=
subprocess
.
run
(
'{} app:assembleRelease'
.
format
(
os
.
path
.
join
(
'.'
,
'gradlew'
)),
shell
=
True
)
if
proc
.
returncode
!=
0
:
error
(
'Build Magisk Manager failed!'
)
unsigned
=
os
.
path
.
join
(
'app'
,
'build'
,
'outputs'
,
'apk'
,
'release'
,
'app-release-unsigned.apk'
)
aligned
=
os
.
path
.
join
(
'app'
,
'build'
,
'outputs'
,
'apk'
,
'release'
,
'app-release-aligned.apk'
)
release
=
os
.
path
.
join
(
config
[
'outdir'
],
'app-release.apk'
)
# Find the latest build tools
# Find the latest build tools
build_tool
=
os
.
path
.
join
(
os
.
environ
[
'ANDROID_HOME'
],
'build-tools'
,
build_tool
=
os
.
path
.
join
(
os
.
environ
[
'ANDROID_HOME'
],
'build-tools'
,
sorted
(
os
.
listdir
(
os
.
path
.
join
(
os
.
environ
[
'ANDROID_HOME'
],
'build-tools'
)))[
-
1
])
sorted
(
os
.
listdir
(
os
.
path
.
join
(
os
.
environ
[
'ANDROID_HOME'
],
'build-tools'
)))[
-
1
])
proc
=
subprocess
.
run
([
os
.
path
.
join
(
build_tool
,
'zipalign'
),
'-vpf'
,
'4'
,
unsigned
,
aligned
],
stdout
=
subprocess
.
DEVNULL
)
proc
=
subprocess
.
run
([
os
.
path
.
join
(
build_tool
,
'zipalign'
),
'-vpf'
,
'4'
,
source
,
target
],
stdout
=
subprocess
.
DEVNULL
)
if
proc
.
returncode
!=
0
:
if
proc
.
returncode
!=
0
:
error
(
'Zipalign Magisk Manager failed!'
)
error
(
'Zipalign Magisk Manager failed!'
)
...
@@ -201,25 +181,54 @@ def build_apk(args):
...
@@ -201,25 +181,54 @@ def build_apk(args):
if
not
apksigner
:
if
not
apksigner
:
error
(
'Cannot find apksigner.jar in Android SDK build tools'
)
error
(
'Cannot find apksigner.jar in Android SDK build tools'
)
proc
=
subprocess
.
run
(
'java -jar {} sign --ks release-key.jks --ks-pass pass:{} --key-pass pass:{} --out
{} {}'
.
format
(
proc
=
subprocess
.
run
(
'java -jar {} sign --ks release-key.jks --ks-pass pass:{} --key-pass pass:
{} {}'
.
format
(
apksigner
,
config
[
'keyStorePass'
],
config
[
'keyPass'
],
release
,
aligned
),
shell
=
True
)
apksigner
,
config
[
'keyStorePass'
],
config
[
'keyPass'
],
target
),
shell
=
True
)
if
proc
.
returncode
!=
0
:
if
proc
.
returncode
!=
0
:
error
(
'Release sign Magisk Manager failed!'
)
error
(
'Release sign Magisk Manager failed!'
)
def
build_apk
(
args
):
header
(
'* Building Magisk Manager'
)
mkdir
(
os
.
path
.
join
(
'app'
,
'src'
,
'full'
,
'assets'
))
for
script
in
[
'magisk_uninstaller.sh'
,
'util_functions.sh'
]:
source
=
os
.
path
.
join
(
'scripts'
,
script
)
target
=
os
.
path
.
join
(
'app'
,
'src'
,
'full'
,
'assets'
,
script
)
cp
(
source
,
target
)
if
args
.
release
:
if
not
os
.
path
.
exists
(
'release-key.jks'
):
error
(
'Please generate a java keystore and place it in
\'
release-key.jks
\'
'
)
proc
=
subprocess
.
run
(
'{} app:assembleRelease'
.
format
(
os
.
path
.
join
(
'.'
,
'gradlew'
)),
shell
=
True
)
if
proc
.
returncode
!=
0
:
error
(
'Build Magisk Manager failed!'
)
unsigned
=
os
.
path
.
join
(
'app'
,
'build'
,
'outputs'
,
'apk'
,
'full'
,
'release'
,
'app-full-release-unsigned.apk'
)
release
=
os
.
path
.
join
(
config
[
'outdir'
],
'app-release.apk'
)
sign_apk
(
unsigned
,
release
)
header
(
'Output: '
+
release
)
rm
(
unsigned
)
rm
(
unsigned
)
rm
(
aligned
)
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
)
header
(
'Output: '
+
release
)
rm
(
unsigned
)
else
:
else
:
proc
=
subprocess
.
run
(
'{} app:assembleDebug'
.
format
(
os
.
path
.
join
(
'.'
,
'gradlew'
)),
shell
=
True
)
proc
=
subprocess
.
run
(
'{} app:assembleDebug'
.
format
(
os
.
path
.
join
(
'.'
,
'gradlew'
)),
shell
=
True
)
if
proc
.
returncode
!=
0
:
if
proc
.
returncode
!=
0
:
error
(
'Build Magisk Manager failed!'
)
error
(
'Build Magisk Manager failed!'
)
source
=
os
.
path
.
join
(
'app'
,
'build'
,
'outputs'
,
'apk'
,
'
debug'
,
'app
-debug.apk'
)
source
=
os
.
path
.
join
(
'app'
,
'build'
,
'outputs'
,
'apk'
,
'
full'
,
'debug'
,
'app-full
-debug.apk'
)
target
=
os
.
path
.
join
(
config
[
'outdir'
],
'app-debug.apk'
)
target
=
os
.
path
.
join
(
config
[
'outdir'
],
'app-debug.apk'
)
mv
(
source
,
target
)
mv
(
source
,
target
)
header
(
'Output: '
+
target
)
header
(
'Output: '
+
target
)
source
=
os
.
path
.
join
(
'app'
,
'build'
,
'outputs'
,
'apk'
,
'stub'
,
'debug'
,
'app-stub-debug.apk'
)
target
=
os
.
path
.
join
(
config
[
'outdir'
],
'stub-debug.apk'
)
mv
(
source
,
target
)
header
(
'Output: '
+
target
)
def
build_snet
(
args
):
def
build_snet
(
args
):
proc
=
subprocess
.
run
(
'{} snet:assembleRelease'
.
format
(
os
.
path
.
join
(
'.'
,
'gradlew'
)),
shell
=
True
)
proc
=
subprocess
.
run
(
'{} snet:assembleRelease'
.
format
(
os
.
path
.
join
(
'.'
,
'gradlew'
)),
shell
=
True
)
if
proc
.
returncode
!=
0
:
if
proc
.
returncode
!=
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment