Previously, when a prebuilt was preferred but did not provide a
suitable boot dex jar both the source and the prebuilt were silently
ignored which meant that the "hiddenapi list" command was not given a
complete set of boot dex jars. That could either lead to incorrect
hiddenapi flags being set or the "hiddenapi list" command failing if it
could not find a class. Debugging the cause of either of those cases
can be very time consuming so this change fails early and makes the
cause very explicit.
Bug: 181267622
Test: m nothing
Change-Id: I6763ddb9ba90ed2e501d0cf7984f6655237e905d
Adds a new --key_field option to merge_csv.py which specifies the name
of the field that should be used to sort the input. If specified it
causes that field to be the first in each row and performs the merge
operation of a merge sort on the input files. That assumes that each
input file is already sorted into the same order.
Modifies the rules that use merge_csv.py to pass in:
--key_field signature
to sort the rows by signature.
Bug: 180387396
Test: Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change other than
changing the order.
Change-Id: Idcd5f0fea373b520b604889e1c280f21ed495660
Previously, multiple APEX variants of some boot jars were being
processed by hiddenapi to extract information which resulted in
duplicate entries in the monolithic hidden API files.
This change applies the same filter that was previously used to ensure
that the hiddenapi-flags.csv file did not include any duplicates to all
sources of hidden API information.
Bug: 180102243
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change other than
removing some duplicates entries.
Change-Id: I9ffc8586d5d6efea4e3440be2dfd5424790665c8
It can be removed as all implicit dependencies have been replaced with
explicit ones so it is no longer needed.
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change.
Change-Id: I3da5fcb3b244a295502f2cacc94a504250d4d616
Adds the hiddenapi_additional_annotations to allow a library to list
the libraries that provided additional hiddenapi related annotations
for a library.
Modifies merge_csv.py so it can process multiple zip files at the same
time and uses that to merge the embedded .uau files from a module and
those it depends upon.
Bug: 180102243
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change.
Change-Id: I796520021c7357398a9e2a09f1029e4a578b05b3
Bug: 178361284
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change.
Also verified that the hiddenapi files created when using the
prebuilts (using SOONG_CONFIG_art_module_source_build=false) are
the same as when using the source. There is a slight difference
in the order but otherwise identical.
Change-Id: I831da5fa41eb7668b07bbdc4dd08ec2cdb8803d0
Invokes hiddenAPIExtractInformation() on the dex jar provided by the
deapexer (on behalf of prebuilt_apex) so that hiddenAPI can extract the
information it needs, if anything, from the dex file (and accompanying
classes implementation file).
The dex file provided by deapexer has already had the hiddenapi
information encoded into it so it does not need to do that again.
This change adds the primary parameter to hiddenAPIExtractInformation()
and checks it (and also the hiddenAPI.active property) before it does
anything. That ensures that it behaves correctly when called directly
as well as when called from hiddenAPIExtractAndEncode().
Bug: 178361284
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change.
Also verified that the hiddenapi files created when using the
prebuilts (using SOONG_CONFIG_art_module_source_build=false) are
the same as when using the source. There is a slight difference
in the order but otherwise identical.
Change-Id: I7abb63fd310bb94787ab7f4821e5fd283dc03046
A follow up change needs to be able to contribute to the information
the hiddenapi process collates without having a dex file encoded. This
change pushes all the functionality related to information gathering
into the hiddenAPIGenerateCSV() method and then renames it and the
hiddenAPI() method to make it clearer what they do.
Bug: 178361284
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change.
Change-Id: I04417720216a0fbadcd88e6185e7de6570af6216
Previously, the hiddenapi() method combined both checks to determine
whether a module contributed to/was modified by the hiddenapi process
and logic to create ninja rules to perform those tasks. This change
separates the former out into a new initHiddenAPI() method.
The main purpose of this is to simplify the process of allowing the
CSV generation to be separated from the encoding. That is required
because when a java_import retrieves its dex file from the apex it
has already been encoded.
The initHiddenAPI() method is only called for java.Library (and
indirectly for java.SdkLibrary) and java.Import modules which means
that the hiddenapi() method does nothing for any other module type.
That is consistent with the previous behaviour because while the
hiddenapi() method is called for other module types they fail because
the boot image jars only support java_library, java_sdk_library,
and java_import at the moment. While it will need to support
java_sdk_library_import once any of the libraries that are currently
provided as java_sdk_library modules switches to providing prebuilts
that is outside the scope of this work.
Bug: 178361284
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change.
Change-Id: Iaa91e0a8e2bffec03296dd894e9662556f4464c0
Prevents the hiddenapi files index and metadata files from including
duplicate entries.
Bug: 178361284
Test: m droid
Compared hiddenapi files before and after change
Verified that the only differences were due to the removal of duplicates
Used sort -u to remove duplicates from before file and compared with after file
Change-Id: I0b9e420aec42cdcf4584099a7ffd2ed9c3715d6d
In order to allow the hiddenapi code which expects its inputs to be
ModuleOutPath to consume the output from the deapexer module type (used
by prebuilt_apex) this change converts the hiddenapi from using
ModuleOutPath to use OutputPath instead.
This is part of a general cleanup to remove ModuleOutPath that is
separated out in order to avoid having the hiddenapi work dependent
upon and possibly delayed by issues with that general cleanup.
Bug: 178361284
Bug: 179124768
Test: m droid
Change-Id: I890f775bf5e33528dbaa62b95fa4198185ff8bf8
Enable the RuleBuilder and RuleBuilderCommand methods to access
the BuilderContext by passing it to NewRuleBuilder instead of
RuleBuilder.Build.
Test: genrule_test.go
Test: rule_builder_test.go
Test: m checkbuild
Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
Use a more inclusive name (go/hiddenapi-list-renaming).
Bug: 163797539
Test: atest class2nonsdklisttest
Change-Id: I1b72c243746dde9926a11d5a559b84e753e8fd4f
We put reproducible timestamps in zip files so that the artifacts
are consistent, but that leads to old timestamps in the output
directory if they are unzipped as part of the build. Use
unzip -DD when unzipping to update the timestamps.
Bug: 161015009
Test: touch -d 2020-01-01 ref; find $OUT/system -not -newer ref
Change-Id: I70407a627cb070e24be510faa6a774e3d9eae3a8
Adds a ConfigurationName property, and ConfigurationName() method that
allows a library to separate its name (e.g. framework-tethering.impl)
from the name used in the build configuration,
e.g. ctx.Config().BootJars().
Updates hiddenapi processing to use ConfigurationName() instead of
ctx.ModuleName().
Changes java_sdk_library to set the ConfigurationName property
of the implementation library to the name of the module instead of
<module>.impl so that it will match the name in the boot jars list.
Bug: 159683330
Test: m framework-tethering
dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l
Verify that there are >0 hiddenapi entries.
Add java_sdk_library_import prefer=true for framework-tethering
and repeat the above to verify that there are 0 hiddenapi entries.
Apply this change, repeat above and verify that there are the same # of entries as before.
Remove the prebuilt for framework-tethering
Repeat the above and verify that there is no change to the # of entries
Merged-In: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
(cherry picked from commit c4422106a7)
Previously, the flag was only added for java_library modules that were
being instrumented. This will also add if for java_sdk_library modules
too.
Bug: 156705688
Test: TARGET_BUILD_VARIANT=userdebug PRODUCT=mainline_modules_x86 EMMA_INSTRUMENT=true NATIVE_COVERAGE=true ./vendor/google/build/build_unbundled_coverage_mainline_module.sh -j8
Merged-In: I5d06ec037007b1770748df24a2e2e8691f177f4f
Change-Id: I5d06ec037007b1770748df24a2e2e8691f177f4f
(cherry picked from commit 31b84c83bf)
hiddenapi expects that all members in a class to have corresponding hidden
API flags. However, this can't be satisfied when the java module having
the class is instrumented; JaCoCo added a few number of synthetic
members. In this case, give 'no-force-assign-all' option to the hidden
api tool so that it doesn't complain about the synthetic methods.
Also, disabling instrumenting jacocoagent itself, because it doesn't
make sense.
Exempt-From-Owner-Approval: PS3 fixes a typo in a comment. PS2 got ORV.
Bug: 149353192
Test: SKIP_ABI_CHECKS=true EMMA_INSTRUMENT=true
EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true m
out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/hiddenapi/unaligned/unaligned.jar
Change-Id: Ibaf383c439945ab664e885af319548b56e2c8cb6
Flow:
1. Annotation processor generates a CSV file per class as a CLASS_OUTPUT resource.
2. hiddenapi.go extracts individual .csv files and merges them into an index.csv file per module.
3. hiddenapi_singleton.go merges individual index.csv files into a combined .csv file.
In a follow up hiddenapi-index.csv would replace unsupportedappusage_index.csv
Bug: 145132366
Change-Id: I87d92f9c8d4b1cc1df526fc576ee3c2101116b58
Test: diff unsupportedappusage_index.csv hiddenapi-index.csv
Rather than have a special white list to contain the names of modules
that provide additional hiddenapi for modules on the bootclasspath
this defines a convention that such modules must have a name which is
of the format <x>-hiddenapi, where <x> is the name of the module on the
bootclasspath.
Bug: 73711752
Test: make droid && flashall -w && atest -p cts/tests/signature
Change-Id: Ib2d69dea9541b60a9bb81496f00edb65036d1ebb
This reverts commit e5b5657f87.
The reverted change was added in order to gather the information about
the hiddenapi that is needed for the runtime to enforce the hiddenapi
accessibility rules. Without it the build broke with the following
error when the android.test.base library was not in the
PRODUCT_BOOT_JARS list:
AssertionError: Error processing: frameworks/base/config/hiddenapi-greylist.txt
The following entries were unexpected:
Ljunit/framework/TestSuite;->isPublicTestMethod(Ljava/lang/reflect/Method;)Z
Landroid/test/AndroidTestCase;->setTestContext(Landroid/content/Context;)V
Landroid/test/InstrumentationTestCase;->runMethod(Ljava/lang/reflect/Method;I)V
Landroid/test/AndroidTestCase;->getTestContext()Landroid/content/Context;
Ljunit/framework/TestCase;->fName:Ljava/lang/String;
Ljunit/framework/TestSuite;->isTestMethod(Ljava/lang/reflect/Method;)Z
Please visit go/hiddenapi for more information.
However, it turns out that the runtime does not currently enforce
access to the hiddenapi of libraries that are not on the
PRODUCT_BOOT_JARS list. Gathering hiddenapi information for a library
not on the PRODUCT_BOOT_JARS list breaks the
CtsHiddenApiBlacklistApi27TestCases and
CtsHiddenApiBlacklistApi28TestCases test modules which use that
information to ensure that correct runtime behavior.
This change is being reverted simply because it does not work.
Bug: 126519737
Bug: 73711752
Test: make REMOVE_ATB_FROM_BCP=true droid and make droid
Change-Id: I1b4a7786b1061effa0e2d37832afa8570953a06e
There are no more Make paths being used in Soong now that
dexpreopting and hiddenapi are in Soong. Use the Path types
in the inputs to RuleBuilder, and fix all users of RuleBuilder.
This reapplies I886f803d9a3419a43b2cae412537645f94c5dfbf with
fixes to disable preopt for Soong-only builds when the global
dexpreopt.config doesn't exist.
Test: all soong tests
Test: m checkbuild
Change-Id: I4dae9ecd5de22f062f9478ec8f0747f099cf8190
There are no more Make paths being used in Soong now that
dexpreopting and hiddenapi are in Soong. Use the Path types
in the inputs to RuleBuilder, and fix all users of RuleBuilder.
Test: all soong tests
Test: m checkbuild
Change-Id: I886f803d9a3419a43b2cae412537645f94c5dfbf
The build assumes (apart from one minor exception) that only modules
that are in the PRODUCT_BOOT_JARS list require processing as part of
the hiddenapi. Unfortunately, that is not true for android.test.base,
at least not when REMOVE_ATB_FROM_BCP=true.
This change adds a white list (containing android.test.base) of
additional modules that should be processed as part of the hiddenapi
and updates the hiddenapi.go file to use it.
It does not matter that android.test.base is a boot jar and in the
white list, the behavior is the same as it would be if it was only
in one.
Bug: 73711752
Test: make REMOVE_ATB_FROM_BCP=true droid and make droid
Change-Id: I1c64272f444e6866136c65fb7c48910d55811844
Move the rules that build hiddenapi-stubs-flags.txt,
hiddenapi-flags.csv and hiddenapi-greylist.csv into Soong.
Bug: 123645297
Test: m checkbuild
Test: m UNSAFE_DISABLE_HIDDEN_API_FLAGS=true
Change-Id: I90bf58710f6153ee8565994f799d3ec5699bc7fa
Add an opaque OnceKey type and use it for all calls to Once in
build/soong. A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.
Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
Move dexpreopt.Script to android.RuleBuilder so that the builder
style can be used in more places. Also add tests for it.
Test: rule_builder_test.go
Change-Id: I92a963bd112bf033b08899e930094b908acfcdfd
Master-art configurations do not have frameworks/base and therefore do
not have hidden API flags. Pass --no-force-assign-all to `hiddenapi`
when frameworks/base does not exist to disable the corresponding
assertion. This enables us to enforce the assertion on non-master-art
builds and also get rid of logspam about missing flags on ART buildbots.
Test: art/tools/buildbot-build.sh on master-art
Bug: 123143676
Change-Id: I074d9554fb11dab3eef904016375730520107ec2
Also preserve the alignment with hiddenapi.
Test: conscrypt apex has its conscrypt.jar zipaligned.
Change-Id: I43cc0eadb9548c3d8055e12c077fb7bbe1935fe6
`hiddenapi` is being refactored to work with a single CSV file as
opposued to a multitude of text files (one per flag). This patch
changes the singleton rule for listing public/private APIs from
stubs to expect a CSV as an output.
Bug: 119068555
Test: compiles, hiddenapi-flags.csv unchanged
Change-Id: I622521d59979a6b01ecc8065a278412fedf7b9bc
hiddenapi encode unzips and rezips the dex jar. Pass uncompressDex
into it so that it doesn't make classes.dex compressed in the dex
jar when it was previously uncompressed.
Bug: 123100239
Test: m checkbuild
Test: zipinfo $OUT/system/framework/conscrypt.jar shows uncompressed classes.dex
Change-Id: If36cde330eb0bcb1e1db3c582452c5faebc8ff29
It got broken with the move to hiddenapi to Soong.
Test: UNSAFE_DISABLE_HIDDENAPI_FLAGS=true m -j32
Change-Id: Id369bfae8e118907b1f12faa7e4207494904edda
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong. This fixes an issue where dexpreopting was happening on
a different jar than was being installed.
Bug: 122856783
Test: m checkbuild
Test: no change out/target/common/obj/PACKAGING/hiddenapi-flags.csv
Test: only ordering change to out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Test: cts/tests/signature/runSignatureTests.sh
Change-Id: I4fc481efc29e73cb2bdaacf672e86d5f6f0075ae