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
7ce4bd33
Commit
7ce4bd33
authored
Dec 26, 2022
by
topjohnwu
Committed by
John Wu
Dec 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy stub APK into output directory
parent
ad0e6511
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
build.py
build.py
+17
-0
Setup.kt
buildSrc/src/main/java/Setup.kt
+7
-8
No files found.
build.py
View file @
7ce4bd33
...
...
@@ -425,6 +425,19 @@ def build_app(args):
header
(
'* Building the Magisk app'
)
build_apk
(
args
,
'app'
)
# Stub building is directly integrated into the main app
# build process. Copy the stub APK into output directory.
build_type
=
'release'
if
args
.
release
else
'debug'
apk
=
f
'stub-{build_type}.apk'
source
=
op
.
join
(
'app'
,
'src'
,
'main'
,
'assets'
,
'stub.apk'
)
target
=
op
.
join
(
config
[
'outdir'
],
apk
)
cp
(
source
,
target
)
def
build_stub
(
args
):
header
(
'* Building the stub app'
)
build_apk
(
args
,
'stub'
)
def
cleanup
(
args
):
support_targets
=
{
'native'
,
'java'
}
...
...
@@ -444,6 +457,7 @@ def cleanup(args):
if
'java'
in
args
.
target
:
header
(
'* Cleaning java'
)
execv
([
gradlew
,
'app:clean'
,
'app:shared:clean'
,
'stub:clean'
])
rm_rf
(
op
.
join
(
'app'
,
'src'
,
'main'
,
'assets'
))
def
setup_ndk
(
args
):
...
...
@@ -570,6 +584,9 @@ binary_parser.set_defaults(func=build_binary)
app_parser
=
subparsers
.
add_parser
(
'app'
,
help
=
'build the Magisk app'
)
app_parser
.
set_defaults
(
func
=
build_app
)
stub_parser
=
subparsers
.
add_parser
(
'stub'
,
help
=
'build the stub app'
)
stub_parser
.
set_defaults
(
func
=
build_stub
)
avd_parser
=
subparsers
.
add_parser
(
'emulator'
,
help
=
'setup AVD for development'
)
avd_parser
.
add_argument
(
'-s'
,
'--skip'
,
action
=
'store_true'
,
...
...
buildSrc/src/main/java/Setup.kt
View file @
7ce4bd33
...
...
@@ -192,10 +192,14 @@ fun Project.setupApp() {
android
.
applicationVariants
.
all
{
val
variantCapped
=
name
.
capitalize
(
Locale
.
ROOT
)
val
variantLowered
=
name
.
toLowerCase
(
Locale
.
ROOT
)
val
stubTask
=
tasks
.
getByPath
(
":stub:package$variantCapped"
)
val
stubApk
=
stubTask
.
outputs
.
files
.
asFileTree
.
filter
{
it
.
name
.
endsWith
(
".apk"
)
}
val
syncAssets
=
tasks
.
register
(
"sync${variantCapped}Assets"
,
Sync
::
class
)
{
dependsOn
(
syncResources
)
dependsOn
(
syncResources
,
stubTask
)
inputs
.
property
(
"version"
,
Config
.
version
)
inputs
.
property
(
"versionCode"
,
Config
.
versionCode
)
into
(
"src/main/assets"
)
...
...
@@ -210,12 +214,7 @@ fun Project.setupApp() {
include
(
"kernel_data_key.vbprivk"
,
"kernel.keyblock"
)
}
}
val
task
=
tasks
.
getByPath
(
":stub:package$variantCapped"
)
dependsOn
(
task
)
val
apk
=
task
.
outputs
.
files
.
asFileTree
.
filter
{
it
.
name
.
endsWith
(
".apk"
)
}
from
(
apk
)
{
from
(
stubApk
)
{
rename
{
"stub.apk"
}
}
filesMatching
(
"**/util_functions.sh"
)
{
...
...
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