Commit graph

66 commits

Author SHA1 Message Date
Spandan Das
3a3920129d Add better error handling to bootDexJar function
aosp/2876754 missed adding error handling to one of the places which
consumes the dex jar deapexed from prebuilt apexes. This CL ensures that
when we have multiple prebuilt apexes _without_ flagging, the hiddenapi
processing code emits a more descriptive error "Multiple deapxers..."
rather than a cryptic error "<module> does not provide a dex jar"

Test: m nothing --no-skip-soong-tests

Change-Id: I80849fa7cca17d724ac53c94bb353b169175ee28
2024-01-17 20:59:43 +00:00
Colin Cross
313aa5475f Convert OtherModuleProvider to generic providers API
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
2023-12-14 16:12:22 -08:00
Cole Faust
51d7bfd9a1 Revert^2 "Only allow setting presigned without preprocessed on targetSdk < 30"
This reverts commit d293e28f52.

Reason for revert: The underlying issue was fixed in ag/24685010

Change-Id: I06810d37dba37aa12f9a1e14b0749f1e1eb41136
2023-09-07 05:31:32 +00:00
Karl Shaffer
d293e28f52 Revert "Only allow setting presigned without preprocessed on targetSdk < 30"
This reverts commit 6158528e15.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_udc-d1-dev-plus-aosp&target=aosp_bramble-trunk_staging-userdebug&lkgb=10771573&lkbb=10771600&fkbb=10771587, bug https://buganizer.corp.google.com/issues/299369971

BUG: 299369971

Change-Id: I6bf6eb5c0fb9e30197e145121adc7ed58871526f
2023-09-07 00:51:09 +00:00
Cole Faust
6158528e15 Only allow setting presigned without preprocessed on targetSdk < 30
When targetSdk is >= 30, the system verifies that you use a valid
signature V2+ certificate. Uncompressing ndk/dex files or aligning
the zip file will break a signature V2, so these apks should really
just set preprocessed: true.

Fixes: 185811447
Test: Presubmits
Change-Id: Id89c42bcd5b5daa6eda1716bff4023423298036b
2023-08-29 11:18:44 -07:00
Pratyush
faec4db56f Disable Hidden API Checks for ENG Builds
For more discussions/details, please check internal CL ag/24145146

Bug: 289409213
BUg: 285976182
Test: Look for hiddenapi calls in build trace
Change-Id: Ia2780ee419b8da1418ba1c7a7d732712b7c2a322
2023-07-30 13:57:10 +00:00
Spandan Das
8c9ae7ed67 Update min_sdk_version from SdkSpec to ApiLevel
This relands aosp/2457063. The original change broke T and U since those
branches still contain soong modules of type (kind+level). Those soong
modules have been cleaned up now

Test: Used go/abtd to test T and U branches with this change

Bug: 208456999
Change-Id: I0ef7933c055f88cb512a02108f1173e51156ef1c
2023-03-22 20:15:45 +00:00
Spandan Das
b74d1e1d91 Revert "Update min_sdk_version from SdkSpec to ApiLevel"
Revert submission 2457063

Reason for revert: Broken udc-dev

Reverted changes: /q/submissionid:2457063

Change-Id: Id6349fc1318877044af713c914a0afd437d3d2d5
2023-03-21 01:36:47 +00:00
Spandan Das
e773739787 Update min_sdk_version from SdkSpec to ApiLevel
min_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid min_sdk_version in bp
files

Will do a similar cleanup for targetSdkVersion and maxSdkVersion in a
followup CL

Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999

Change-Id: Ie6ae7e267d093c5e4787e82685daaca1021d202e
2023-03-20 16:51:32 +00:00
Cole Faust
a5f64f0396 Convert RuleBuilder to static rule in buildRuleToGenerateIndex
This saves ~34kb from the build.ninja file.

Test: Presubmits
Change-Id: I8fa4974e4f1509be7938c774e536d15a63534753
2023-02-14 17:50:31 -08:00
Paul Duffin
09817d66de hiddenapi: Prevent libraries for Q/R from include S+ flags.
The Q and R runtimes can handle Q/R flags but not S flags. So, this
change verifies that any library that can run on Q/R
(min_sdk_version <= R) by adding --max-hiddenapi-level=max-target-r
to the "hiddenapi encode" command. That will cause a failure if any
S+ flags are found in the flags to encode.

Bug: 172453495
Test: m droid && launch_cvd
      Cherry pick changes in https://r.android.com/q/topic:max-target-s
      Add @UnsupportedAppUsage maxTargetSdk=S in classes in framework-permission (for r/q)
      and framework-permission-s (nominally for S+). I had to incresed the min_sdk_version
      in the latter to 31 (S) as it was still set at 30 (R).
Change-Id: Ie0f68482603adc7b4e3d7a5c81bf203d81a84a9e
2022-04-28 18:34:48 +01:00
Colin Cross
ce56425a6b Annotate more java dependencies for licensing
Annotate more dependencies as runtime linked or toolchain.

Bug: 207445310
Test: m checkbuild
Change-Id: Ia5dc3321a1e476b16058eee94d6dc494fe1e933e
2022-01-28 15:42:06 -08:00
Martin Stjernholm
8be1e6db16 Propagate the dex jar path as an OptionalPath which is either valid or
invalid with a message.

This will allow propagating any error from the deapexer module for
prebuilt APEXes to the location where the dex jars get used. It's only
at those points that we can raise errors about not being able to
extract files from the deapexer modules if they are invalid, and this
way we avoid encoding knowledge there about why they may be invalid.

To keep the refactoring limited it intentionally does not change any of
the existing logic for when dexJarFiles are set or not (non-nil vs nil
prior to this change), although there may be opportunity to use this
for more conditions when dex jars aren't available.

The refactoring is also not extended to
dexpreopt.ClassLoaderContextMap.

Test: m nothing
Bug: 192006406
Change-Id: I68986dccd9a9b3fee4d24caa1947ea17a36caedc
2021-09-23 17:19:55 +01:00
satayev
d604b210c4 Rename UpdatableBootJars to ApexBootJars.
Note that ART apex boot jars and core-icu4j are exceptions here as they
are not part of ApexBootJars. ART apex boot jars are defined in their
own variable, while core-icu4j is treated as a regular non-updatable
boot jar.

Bug: 191127295
Test: atest CtsClasspathsTestCases
Change-Id: I3cea3d82ef521655a1a5ffa8cae2258ab9d08bfc
2021-07-22 17:35:42 +01:00
Paul Duffin
84c1cdf31f Maintain header order in merge_csv
Previously, if the --header property was not specified then merge_csv
would use a header constructed by sorting all the fields in the input
files. That required that any use of merge_csv which did not already
have headers in the required order would have to explicitly specify the
headers. That made it harder to use merge_csv as a generic tool as each
invocation needed to be aware of what headers were exported in the
output.

This change causes merge_csv to simply use the headers in the order in
which they are encountered in the input files. That removes the need to
specify the --header option when generating the index files.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-index.csv out/soong/hiddenapi/hiddenapi-unsupported.csv
      - make sure that they are not changed by this change.
Change-Id: I420b7d07aea85af6372cd7580a8be5e2cc82a513
2021-06-09 14:02:03 +01:00
Paul Duffin
0916595b1c Refactor hiddenAPIEncodeDex for use by bootclasspath_fragment
Previously, if the method was called multiple times by the same module
the resulting build rules would all use the same temporary directory
which meant that if run in parallel they would conflict with each
other. This change fixes that by providing a jar specific temporary
directory so it can be used by bootclasspath_fragment to encode its
content modules.

Also, cleans up, simplifies and improves the documentation.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Change-Id: I0ebe61abc8e16111c6e8a822eb96c57846b98461
2021-05-23 11:21:38 +01:00
Paul Duffin
4de9450433 Move hidden API encoding after resource merging
Previously, the hidden API encoding was done before resource merging.
However, hidden API modularization requires that the encoding be done
by the bootclasspath_fragment/platform_bootclasspath modules which will
be after the resource merging. Therefore, this change moves the hidden
API encoding after to match the future behavior.

It also moves the initHiddenAPI() method call after resource merging
too and passes it the result of the resource merging so it is available
for the bootclasspath modules via bootDexJar().

Although the resource merging was not always done when it was done it
would reorder the entries in the generated jar to match java ordering,
which puts the MANIFEST.MF first. This change preserves that behavior
by adding -j to the call to MergeZipCmds. This does mean that jars
which did not require resource merging now have a different order but
as both orders work that is not a significant change.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that apart from the ordering change in the jars that this does
        not change the contents of the apex files
Change-Id: If74baad5659301ca6ca9c0f6484374420dda8c34
2021-05-19 13:48:25 +01:00
Paul Duffin
1bbd0626f2 Make uncompressDex available for use through hiddenAPIModule
In order for the bootclasspath_fragment to perform dex encoding on its
contents it needs to know whether the dex file is uncompressed or not.
This change makes that information available by passing it to
initHiddenAPI, storing it in hiddenAPI struct and providing access
through the hiddenAPIModule.

Bug: 179354495
Test: m droid
Change-Id: I913416b4836766de194203fd8ed5124b61dfa3dd
2021-05-17 18:38:06 +01:00
Paul Duffin
45897dd663 Remove hiddenAPI.primary field
Now that the individual modules no longer participate in the generation
of the monolithic files it is no longer necessary to select a single
primary module to provide the information they need.

Bug: 179354495
Test: m droid
Change-Id: If09796de710927e3e3f2ccecad0b57ca5fce5dc9
2021-05-17 18:38:06 +01:00
Paul Duffin
74d18d1d6f Merge initHiddenAPI and hiddenAPIUpdatePaths
These two methods did very similar jobs and merging them together
simplifies the behavior.

Bug: 179354495
Test: m droid
Change-Id: Ibe1a23d54105e6a0e5693079cd8743679301fc85
2021-05-17 18:38:06 +01:00
Paul Duffin
66cdbf07ef Remove configurationName from java library and hidden API
The configurationName was intended to separate the name of the module
from the name used in configuration (such as BootJars) so that the
child implementation library of a java_sdk_library on the bootclasspath
would have hidden API encoding performed on it just as for the main
java_library embedded within the java_sdk_library.

While that did use to work it no longer does as the test added in the
preceding change proves. It is not surprising that this regression does
not appear to have caused any issues as the the child implementation
library is only a build time artifact and not used at runtime.

In future the only modules that will require hidden API encoding are
those that are part of a bootclasspath module so there is no point in
maintaining this capability.

Bug: 179354495
Test: m droid
Change-Id: Ief8136fa9e98600cdd8d36108ec22edc2ebd7c69
2021-05-17 18:38:06 +01:00
Paul Duffin
b6f53c064e Refactor special handling of hidden API encoding for master-art
Instead of encoding the hidden API with an empty set of flags when the
monolithic flags are not available this simply disables encoding
altogether which should have the same behavior at runtime.

This change also removes the unused flags field in hiddenAPISingleton
which was set but never read.

Bug: 179354495
Test: m nothing
Change-Id: I32d5825e5271829993dd4e5be4d4ee1b22fa7b22
2021-05-14 15:57:10 +01:00
Paul Duffin
afaa47c74a Stop generating unnecessary hidden API rules
The rules to extract hidden API information from an individual module
in order to create module specific files are no longer necessary as
the monolithic files are created directly from the module's class jars
and not the module specific files.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I573ac17f3ea5da5a2a7e4f08718160dacca71c0c
2021-05-14 15:57:10 +01:00
Paul Duffin
537ea3d04c Generate monolithic hidden API files direct from class jars
Previously, the monolithic hidden API files, e.g. hiddenapi-index.csv
file, were generated in two steps. First, each module created its own
files using the information in its class jars. Then, the monolithic
files were created by merging those module specific files into a larger
file.

This change switches to generating the monolithic files directly from
the class jar files and bypassing the intermediate files.

In order to ensure that this change did not change the monolithic files
it is necessary for the hiddenapi-metadata.csv to go through a
reformatting step. Hopefully, this will be able to be removed in a
follow up change.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I5a78e747516014b7c0f402a4b4431b14be6a84b2
2021-05-14 15:57:04 +01:00
Paul Duffin
850e61f234 Dedup hidden API rule generation
Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I54b677c97712a7573ff5eed017c1b2198b80bc51
2021-05-14 14:53:19 +01:00
Paul Duffin
001e606e5c Populate hiddenAPI structure even when not active
The modular hidden API processing needs access to the classesJarPaths
and bootDexJarPath fields of the hiddenAPI structure even if the
modules are not themselves considered to be active participants in the
existing hidden API processing.

This change moves the initialization of those fields to before inactive
modules are ignored.

Bug: 179354495
Test: m art-module-sdk out/soong/hiddenapi/hiddenapi-flags.csv
Change-Id: I06f96d39d0b413295d3e2af50453ebe7e4d3e9c8
2021-05-14 01:45:42 +01:00
Paul Duffin
d504c3ac83 Fix build failure when building unbundled apps (second try)
The previous attempt, which simply skipped the hidden API processing
altogether when unbundled builds were enabled failed when attempting to
build module snapshots as while they enabled an unbundled build they
actually need the hidden API processing to be performed.

This change just checks whether missing dependencies are allowed and if
so it fakes up any missing files so that the build will only fail if
they are not present AND they are used.

Bug: 186695448
Bug: 185828824
Test: tapas Calendar
      m -j60

Change-Id: Ie13fed05af0aba51f45f6791fce944d0e4285037
2021-04-30 13:42:44 +01:00
Paul Duffin
36187b2cf3 Export classesJars initialized in hiddenAPIExtractInformation
This exports classesJars constructed in hiddenAPIExtractInformation
through the hiddenAPIIntf interface for use by the
bootclasspath_fragment module type.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: Ic32f02a69229d9518772fe6b2a329501dd8cd849
2021-04-23 09:32:14 +01:00
Paul Duffin
894546d301 Skip initHiddenAPI check of prebuilt's boot dex jar for APEX modules
There is a check in initHiddenAPI that makes sure that if the source
module has been replaced by a prebuilt the prebuilt provides a boot dex
jar. The check was added to try and detect an issue with hidden API
processing early at build time rather than at runtime.

That check relies on the source module having a PrebuiltDepTag
dependency on the prebuilt module that is preferred and will be used by
hidden API processing. That is true for modules that are not in an APEX
but doesn't work for modules that are in an APEX.

The issue is that an APEX variant of a source module depends on the
non-APEX variant of the corresponding prebuilt module. However, that
variant of the prebuilt is not the one that will be used by hidden API
processing; it will use the APEX variant of the prebuilt module which
is the one that has access to the boot dex jar.

That results in the initHiddenAPI check giving a false negative as it
states that the boot dex jar is not available when it may be.

This change simply skips the check is the source module is an APEX
variant. This is a temporary work around as the hidden API processing
is being modularized for each APEX at which point initHiddenAPI will
either be removed entirely or just skipped for APEXes altogether.

Bug: 179354495
Bug: 185828824
Test: m nothing
Change-Id: I2dc3654c9aa476541855b3f0f243a181ddf8d723
2021-04-21 12:53:58 +01:00
Paul Duffin
1ba246732d Ensure boot jar modules have been initialized properly for hidden API
Checks to make sure that every module that is part of the platform
bootclasspath has been initialized property for hidden API processing.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Ic4368963f2011784b537b8aebf5ef97ea22b2db5
2021-04-14 09:08:02 +01:00
Paul Duffin
ec0fe1775b Avoid hiddenapi ignoring prebuilt with missing dex implementation jar
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
2021-03-01 12:58:28 +00:00
Paul Duffin
2c36f24082 Sort hiddenapi monolithic files by signature
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
2021-02-16 17:38:08 +00:00
Paul Duffin
82b3fcf123 Remove duplicates in monolithic hidden API files
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
2021-02-16 13:28:26 +00:00
Paul Duffin
f8f4af8f1a Remove implicit dependency from <x> -> <x>-hiddenapi
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
2021-02-16 13:28:26 +00:00
Paul Duffin
031d8693b3 Allow explicitly specified additional annotations for hiddenapi
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
2021-02-16 13:28:26 +00:00
Paul Duffin
f75e527c2b Move logic for selecting the primary module into initHiddenAPI()
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
2021-02-11 15:43:28 +00:00
Paul Duffin
9d67ca6ab7 Allow dex jars from prebuilt_apex to be used by hiddenapi
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
2021-02-08 19:10:50 +00:00
Paul Duffin
4fd997bc13 Refactor the hiddenAPI() method for reusability
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
2021-02-08 19:10:50 +00:00
Paul Duffin
4103e92c4b Extract initHiddenAPI() from hiddenapi()
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
2021-02-08 19:10:50 +00:00
Paul Duffin
219b177279 Remove duplicate entries from hiddenapi files
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
2021-02-07 10:58:24 +00:00
Paul Duffin
612e610063 Switch hiddenapi to use OutputPath instead of ModuleOutPath
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
2021-02-02 14:42:05 +00:00
Paul Duffin
34982f1096 Move creation of paths into hiddenAPIGenerateCSV
A minor refactoring to simplify the generation of the CSV files.

Test: m nothing
Bug: 178361284
Change-Id: If79d21c7cebc6643a404973d3e0e5f174d7b0bb1
2021-01-29 13:22:31 +00:00
Paul Duffin
ff774a04ad Add documentation for the different files created by hiddenapi
Test: m nothing
Bug: 178361284
Change-Id: Id55646b9d4b7bc1acdb4ed6a6dd4456b746eb54c
2021-01-29 13:19:51 +00:00
Colin Cross
f1a035e6be Pass pctx and ctx to NewRuleBuilder
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
2020-12-01 16:22:16 -08:00
Andrei Onea
23fea04e27 Rename class2greylist
Use a more inclusive name (go/hiddenapi-list-renaming).
Bug: 163797539
Test: atest class2nonsdklisttest

Change-Id: I1b72c243746dde9926a11d5a559b84e753e8fd4f
2020-08-13 17:33:14 +01:00
Colin Cross
d783bbbace Use unzip -DD
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
2020-07-12 05:37:46 +00:00
Paul Duffin
a2058f8b7d Apply hiddenapi encoding to java_sdk_library .impl
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)
2020-06-29 19:05:19 +01:00
Paul Duffin
c495d2bfed Add --no-force-assign-all for java_sdk_library
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)
2020-05-20 08:19:56 +01:00
Jiyong Park
139fa4320f Merge changes Ibaf383c4,I2b1c0736
* changes:
  Expect added members for instrumented modules
  Reland "Turn on the instrumentation by default for the java code in APEXes"
2020-02-25 07:02:33 +00:00
Jiyong Park
93e57a0b86 Expect added members for instrumented modules
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
2020-02-25 07:01:18 +00:00