Question

I'm building custom module in Android source using the mm command.

When I run mm clean, it seems that the whole project is cleaned.

How can I restrict the clean to just the current module?

Was it helpful?

Solution

Use mm -B, it will rebuild all, equivalent to clean and then make.

OTHER TIPS

Another way to do without mm is to give make clean-<target name> from root of Android source.

Similarly you can build the required module alone with make <target name>

On older make-based AOSP build system, use

mm -B

to rebuild the module.

On newer Ninja+Soong based AOSP build systems, it seems that -B no longer works. It gives the error Unknown option: -B.

One possible alternative is to use the NINJA_ARGS environment variable to pass additional Ninja arguments to underlying build engine.

For example, the following command removes all output and intermediate files:

NINJA_ARGS="-t clean" mm

In this case clean is an extra tool to the Ninja build system. See https://ninja-build.org/manual.html#_extra_tools for other tools.

One thing to notice is that the clean tool seems to clear all the dependencies of the module, instead of the module itself. I haven't found a way to assign a rule to limit the clean scope to the module only.

references: https://android.googlesource.com/platform/build/soong/+/HEAD/docs/best_practices.md

make <lib> 2>&1 | grep -e "install"

This will make the and print all the libs that were re-compiled.

Prefixing "clean-" to the module name will do the clean build in Android

For ex, m clean-libskia

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top