Commit Graph

3 Commits

Author SHA1 Message Date
Remi NGUYEN VAN 0bd90f10b9 Use conventional args style for gen_jarjar
gen_jarjar supported multi-valued arguments via space-separated lists,
like "--apistubs foo bar". This is unusual, as "bar" would generally be
interpreted as a positional argument instead.

Change the usage to "--apistubs foo --apistubs bar", which is more
conventional. Also remove the "--jars" switch to have the jars be
positional arguments instead, and change the "--unsupportedapi"
arguments to be a column-separated list (like java classpath), instead
of space-separated. For --unsupportedapi, this allows providing a list
of files via minimal modifications in the genrule usage.

Test: m
Change-Id: Id67ad16de2ea6682fee402540f464ed3b5b0cca9
2022-08-25 06:42:54 +00:00
Remi NGUYEN VAN 3ba00cb6f8 Do not jarjar classes in the target package
Update the jarjar generator to avoid jarjaring the target package, as
classes inside it do not need to be moved to it, and update integration
tests to match new class names.

Test: atest CtsNetTestCasesLatestSdk FrameworksNetIntegrationTests
Change-Id: I60ffb9f4769b4b86d9205d92c3d8b3f6637d4560
2022-08-10 15:28:14 +09:00
Remi NGUYEN VAN 11f162b5f8 Add jarjar rules generator
(This rolls forward part of a previous change, now that jarjar was fixed
to not get very slow when the number of rules increases).

Jarjar rules are hard to keep in sync with code, and hard to maintain
manually as the distinction between what should and should not be
jarjared is not always clear. This results in unsafe binaries that are
manually maintained, and developer frustration when something fails due
to incorrect jarjar rules.

Add utility to autogenerate jarjar rules, which can be run at build time
time (via a genrule) instead. The generator scans pre-jarjar
intermediate artifacts, and outputs jarjar rules for every class to put
it in a package specific to the module. The only exceptions are:

 - Classes that are API (module-lib API is the largest API surface of
   the module, so module-lib API stubs would typically be used)
 - Classes that have unsupportedappusage symbols
 - Classes that are excluded manually (for example, because they have
   hardcoded external references, like for
   ConnectivityServiceInitializer in SystemServer).

Bug: 217129444
Test: atest jarjar-rules-generator-test;

Change-Id: I3493957e39a661b6c2e330944e7c3023b8f3203e
2022-06-14 09:11:27 +00:00