Commit graph

3454 commits

Author SHA1 Message Date
Jaewoong Jung
8431282af4 Fix the releax_check flag format verb.
%b prints base 2 numbers. %t is the right one to use for booleans.

Test: TreeHugger
Change-Id: Ifbae0170ba03583182ae848bcfc6bb104f1be7e0
2021-02-24 21:09:10 -08:00
Paul Duffin
eafc16bf14 Allow pre-singleton types to be registered in RegistrationContext
Bug: 181070625
Test: m droid
Change-Id: I708b78ed0b42ec55b0442307f40531cfe1233c2b
2021-02-24 10:17:19 +00:00
Christoffer Quist Adamsen
a72571f0d1 Merge "Allow missing classes in R8 builds" 2021-02-24 07:25:18 +00:00
Treehugger Robot
9a4279309f Merge "Update soong copy of java binaries when Make copy is installed" 2021-02-23 21:35:20 +00:00
Treehugger Robot
7eacdbf8a6 Merge "Add non-fatal mode for verify_uses_libraries check." 2021-02-23 20:45:42 +00:00
Colin Cross
44b85d01c9 Update soong copy of java binaries when Make copy is installed
m <modulename> is handled by Make and installs the Make copy of a host
java binary in out/host/linux-x86/bin, and doesn't depend on the Soong
copy in out/soong/host/linux-x86/bin.  That can leave a stale binary
in the Soong directory, and since the Soong directory is first in the
path set up by envsetup.sh, can result in confusing behavior to end
users.

cc_binary already has the Make binary depend on the Soong binary
so that they are both updated.  Do the same for java_binary.

Fixes: 180405155
Test: m metalava
Change-Id: Ic84a131a2851cc4a18ce3725da3c4067137d6120
2021-02-23 11:19:57 -08:00
Paul Duffin
ece454400d Merge changes from topic "hiddenapi_additional_annotations"
* changes:
  Sort hiddenapi monolithic files by signature
  Remove duplicates in monolithic hidden API files
  Remove implicit dependency from <x> -> <x>-hiddenapi
2021-02-23 12:48:24 +00:00
Jiyong Park
d4cbf34032 Fix infinite recursion when printing unrecognized linktype
Bug: N/A
Test: remove some cases from String() so that some linktypes go to the
default path. Then run m nothing. No infinite recursion. Error is
correctly shown.
PANIC=String method: unrecognized linktype: 5
Change-Id: I424755bc89871fc2144ff22d6391f57157cd434d

Change-Id: Ice791025dc50f44ffabd1050bafc5ea35023d32c
2021-02-23 04:02:23 +00:00
Treehugger Robot
277303f042 Merge "Add ctx to AndroidMkExtraEntriesFunc" 2021-02-22 22:40:31 +00:00
Treehugger Robot
a61a042fa6 Merge "Limit the number of the Java source files in a single compilation unit" 2021-02-22 19:54:00 +00:00
Ulya Trafimovich
8c35fcf4d5 Add non-fatal mode for verify_uses_libraries check.
The new mode is enabled with environment variable
RELAX_USES_LIBRARY_CHECK. If the variable is set to true, then a
verify_uses_libraries check failure does not fail the build, instead it
sets a special compiler filter "extract" for dexpreopt, which means that
the DEX file will be extracted, but it won't be compiled to native code.
Class loader context will be set to empty in this case (not &, as it is
going to be deprecated soon).

If the variable RELAX_USES_LIBRARY_CHECK is unset or set to something
other than "true", then the old behaviour of the verify_uses_libraries
check is preserved.

The intended use case for this flag is to have a smoother migration path
for the Java modules that need to add <uses-library> information in
the build files. The flag allows to quickly silence build errors. This
flag should be used with caution and only as a temporary measure, as it
masks real errors and affects performance.

verify_uses_libraries check is reworked so that it writes the error
message to a status file (which is used instead of the former timestamp
file). Currently the stored error message is not used, but it may be
used later to produce a warning. Dexpreopt command checks if the status
file exists and is nonempty; if that is the case, then compiler filter
is set to "extract".
Bug: 132357300

Test: Manually add some mismatch between the libraries in the Android.bp
      and Android.mk files for dexpreopted apps, build with
      RELAX_USES_LIBRARY_CHECK=true and obsserve that the build doesn't
      fail and they are compiled with compiler-filter "extract".
      Unset RELAX_USES_LIBRARY_CHECK and observe that the build fails.

Change-Id: Ibb5d993a25b1df1d2e70b7d5aafc6997f9d64e67
2021-02-22 15:41:03 +00:00
Christoffer Quist Adamsen
e850737ee4 Allow missing classes in R8 builds
Bug: 180878971
Bug: 72683872
Test: TARGET_PRODUCT=aosp_arm64 m -j core-oj
Change-Id: I663220567eb8f034d3efccc60228aef91c716e8e
2021-02-22 12:09:01 +00:00
Treehugger Robot
f0a869847a Merge "Remove EnforceRROExemptedTargets" 2021-02-20 01:47:43 +00:00
Colin Cross
aa2555387d Add ctx to AndroidMkExtraEntriesFunc
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-02-19 23:05:40 +00:00
Jeongik Cha
cee5ba973d Remove EnforceRROExemptedTargets
There is no more target relying on EnforceRROExemptedTargets

Bug: 150820813
Test: m
Change-Id: If50d22c0e4f99e8c50d6a30cb94a0c3a5646b6fa
2021-02-19 12:16:12 +09:00
Pedro Loureiro
8a75058d3f Merge "Add support for lint baseline files" 2021-02-18 15:53:13 +00:00
Treehugger Robot
ca52bfcf0f Merge "Further simplify the link type check routine" 2021-02-18 13:54:27 +00:00
Jiyong Park
4941e4b9d1 Merge "Linktype check error message becomes more correct" 2021-02-18 11:32:03 +00:00
Jiyong Park
7f87e1ab49 Further simplify the link type check routine
Bug: 180477804
Test: m nothing
Change-Id: I216be96cf844fe42ba0cec467eea8520ff4ef4f2
2021-02-18 20:29:05 +09:00
Pedro Loureiro
5d190cc24e Add support for lint baseline files
Test: m droid
Test: go test ^TestJavaLint # (from soong/build/java)

Change-Id: I249a0a0597b0bf8495460ed283b476ad2eb36edc
2021-02-18 11:15:30 +00:00
Anton Hansson
3de06eae5b Merge "Use genrule instead of filegroup for api files" 2021-02-18 09:28:01 +00:00
Jiyong Park
670e0f62a6 Linktype check error message becomes more correct
The type linkType has String() method and the error message is created
using it.

Bug: 180477804
Test: m nothing
Change-Id: I74fe9c93b74904177dbe9d29cd3aa3304b67ba4f
2021-02-18 13:10:18 +09:00
Anton Hansson
c79d412b8a Use genrule instead of filegroup for api files
filegroups have the unfortunate limitation that they don't create phony
targets for building them in a convenient way. Also, having a single
output file fits better with the genrule concept.

Test: m framework-sdkextensions.api.public.latest
Change-Id: I229410658b04403ff1ff6abd4116a65aaa02b83b
2021-02-17 17:16:43 +00:00
Martin Stjernholm
0a9dae6e9a Move the logic to add jacocoagent in instrumentation builds to make.
Test: m nothing
Test: m nothing EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true
Bug: 180325915
Change-Id: Ieec8c8a122ff930e14cef4b5a0a2f9fc9e3b70ad
2021-02-17 14:41:07 +00:00
Treehugger Robot
b913011777 Merge changes from topic "mkboot"
* changes:
  prebuilt_etc is OutputFileProducer
  Revert "`data` dependency of java_test_host can be arch-specific"
2021-02-16 23:27:32 +00:00
Sasha Smundak
b0addafd93 Limit the number of the Java source files in a single compilation unit
KYTHE_JAVA_SOURCE_BATCH_SIZE environment variable controls this setting.
The limit is 1000 if this variable is not set.

Fixes: 179932118
Test: run prebuilts/build-tools/build-prebuilts.sh, use it to build kzips, check
Change-Id: I9ad57dfd1d2c2dce5cff755b1bd61cf933420bd3
2021-02-16 15:14:52 -08: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
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
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
Jiyong Park
2b0e4908c2 Revert "data dependency of java_test_host can be arch-specific"
This reverts commit cdd9b8392d.

Reason: this doesn't work. java_test_host is a multi target module.
Therefore, `arch.<arhc>.data` is not collapsed to `data` by the arch
mutator.

Bug: N/A
Test: N/A
Change-Id: I755b06718bacfe1513f6ad1e734e5a0d0ac57cd8
2021-02-16 06:58:53 +09:00
Anton Hansson
404adeefdc Merge "Fix api_fingerprint.txt generation" 2021-02-15 11:31:37 +00:00
Colin Cross
b87f4b4cab Merge "Convert java.Dependency to JavaInfo provider" 2021-02-13 00:39:24 +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
e7975ff77c Ensure that <x>-hiddenapi modules are included in hiddenapi-index.csv
Adds a test that makes sure that <x>-hiddenapi modules that provide
additional annotations for the <x> boot jar module are included when
generating the hiddenapi-index.csv file.

Bug: 178361284
Test: m nothing
Change-Id: I866916c9275af17954e0634347d183228d4ddc17
2021-02-11 15:43:28 +00:00
Anton Hansson
973d31c757 Fix api_fingerprint.txt generation
Use the generated txt files as input instead
of globbing for now non-existent files.

Also add the system server api txt to the hash.

Bug: 179807354
Test: verify out/soong/api_fingerprint.txt changes now
Test: verify the command in the ninja file looks ok:
      grep api_fingerprint out/soong/build.ninja
Change-Id: I7a49ca134eb93b22537a4f3054285eb15f8c4256
2021-02-11 09:17:10 +00:00
Treehugger Robot
b68036f44b Merge "Add LOCAL_LICENSE_KINDS to build/soong" 2021-02-10 07:18:29 +00:00
Bob Badour
a3348295d4 Merge "Allow cross-cutting dependencies like licenses." 2021-02-10 02:46:40 +00:00
Colin Cross
dcf71b299c Convert java.Dependency to JavaInfo provider
Export information about java dependencies through a Provider
instead of accessing the module directly.

Test: java_test.go
Test: no changes to build.ninja
Change-Id: Ifc5d566bf6f6ebc0ad399e948effaa1ef6a22876
2021-02-09 15:36:25 -08:00
Treehugger Robot
a6cfcac727 Merge "Add android_test_helper_app properties to java_defaults" 2021-02-09 21:10:27 +00:00
Colin Cross
cbce0b0dbd Add android_test_helper_app properties to java_defaults
Allows android_test_helper_apps to get their test_suites and
auto_gen_config properties from a java_defaults module.

Fixes: 179744452
Test: m checkbuild
Change-Id: Ifa09f9fd0a51d3a9682401e4c6bd2f82cd4f1b8a
2021-02-09 10:38:30 -08:00
Paul Duffin
937c91c406 Merge "Move hiddenapi tools used by build/soong from frameworks/base" 2021-02-09 15:17:42 +00:00
Paul Duffin
320e170675 Merge "Allow dex jars from prebuilt_apex to be used by hiddenapi" 2021-02-09 13:58:12 +00:00
Paul Duffin
b71a8de0d5 Merge "Refactor the hiddenAPI() method for reusability" 2021-02-09 13:57:52 +00:00
Paul Duffin
abe1abd224 Merge "Extract initHiddenAPI() from hiddenapi()" 2021-02-09 13:57:37 +00:00
Paul Duffin
fdada68320 Move hiddenapi tools used by build/soong from frameworks/base
Also, creates a python_binary_host module for generate_hiddenapi_lists
and uses that when constructing the build rule rather than using the
file directly.

Bug: 177317659
Test: m droid
      Verified that hiddenapi files (both aggregated ones and for the
      individual modules) are not affected by this change.
Change-Id: Ia11bb203ce5a74740d35f1b7e86716e15aad336e
2021-02-09 10:46:36 +00:00
Treehugger Robot
ed7bfd9726 Merge "Turn missing jarjar output files into errors" 2021-02-08 23:47:13 +00:00
Bill Peckham
5c2406bde9 Merge "Enable android_app_import to supply framework-res." 2021-02-08 19:15:10 +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