Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android build system get the source code path base on package name

I want to get package source code base on package name, eg xxx.apk

I know it could filter by grep LOCAL_PACKAGE_NAME. but the AOSP source was too large.

Is it any build system command could list all package name and path?

Regards

like image 374
Robber Pen Avatar asked Aug 06 '26 06:08

Robber Pen


1 Answers

TLDR

. build/envsetup.sh

# Show list of modules for the selected configuration.
lunch
m modules

# Grep for your module.
mgrep <module>

Explanation

After calling . build/envsetup.sh you can use mgrep to only grep build configuration files.

Be aware, that Android currently uses two build configuration types in parallel. The old makefile type files (Android.mk) will contain LOCAL_PACKAGE_NAME. However, the new Soong module files (Android.bp) have a different syntax. You better grep for the module name and not for LOCAL_PACKAGE_NAME.

You can use m modules to get a list of all modules known to the build system. This command requires you to run lunch first. Also the list returned by m modules will only contain the modules that are selected by the lunch configuration.

like image 123
Simpl Avatar answered Aug 08 '26 20:08

Simpl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!