Commit Graph

3445 Commits

Author SHA1 Message Date
Paul Duffin
fd7610df22 Merge "Extract initHiddenAPI() from hiddenapi()" am: abe1abd224 am: 36d3011783
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1578283

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I75aeebfbfc844b45bc99b3c395b82e7c148e4a5b
2021-02-09 15:18:08 +00:00
Paul Duffin
abe1abd224 Merge "Extract initHiddenAPI() from hiddenapi()" 2021-02-09 13:57:37 +00:00
Treehugger Robot
5e33cdde3c Merge "Turn missing jarjar output files into errors" am: ed7bfd9726 am: 5df2206de0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1580883

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I73c739173cf091fb83a65f93ff91a25eb17223fc
2021-02-09 01:22:01 +00:00
Treehugger Robot
ed7bfd9726 Merge "Turn missing jarjar output files into errors" 2021-02-08 23:47:13 +00:00
Bill Peckham
6603b7ab73 Merge "Enable android_app_import to supply framework-res." am: 5c2406bde9 am: 50b395b740
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1543901

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia87c7583798ab5c053a154dd8d67b579dd65d8e7
2021-02-08 20:19:59 +00:00
Treehugger Robot
98812a68a5 Merge "Remove duplicate entries from hiddenapi files" am: c6fcf29872 am: d32e59bb54
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1575170

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If31c8c3b53942a9880266fe3623ee7cff6cb7703
2021-02-08 19:19:03 +00:00
Bill Peckham
5c2406bde9 Merge "Enable android_app_import to supply framework-res." 2021-02-08 19:15:10 +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
Colin Cross
d97cf63cdf Turn missing jarjar output files into errors
Jarjar doesn't exit with a nonzero return code when there is a syntax
error in a rules file and doesn't write the output file.  Without a
nonzero return code ninja prints a warning but continues, which leads
to stale results on incremental builds where the output file already
exists, or delayed errors on clean builds whre the output file didn't
exist.

Delete the output file before running jarjar, and then check if it
exists after running jarjar.

Fixes: 119516143
Test: m out/target/common/obj/APPS/TeleService_intermediates/classes.jar
Change-Id: I7e9f7ff34de565a986ab0dc6e375f606c91c3846
2021-02-08 10:14:04 -08:00
Paul Duffin
2229b27740 Add test for hiddenAPI index file generation am: 01289a2407 am: e510de2f58
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1575169

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7aa50863bc76dfb8f9a790b824da7fcc087626c9
2021-02-08 12:59:16 +00:00
Paul Duffin
fbd6af6226 Merge changes I9e94662d,I4b4e0dc8 am: 254aee4843 am: 3c4acc4279
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1574746

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4321f7fb64832e85399a20bea30a5a07ca6e93eb
2021-02-07 15:29:20 +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
01289a2407 Add test for hiddenAPI index file generation
The index file and the metadata file both currently include duplicate
entries due to them including both the <x> and <x>.impl libraries
created by java_sdk_library in their inputs, plus including both source
and prebuilt versions of the same named module. This change adds a test
to illustrate that behavior. A follow up change will correct the problem
and update the test accordingly.

This change only adds a test for the index file because the metadata
file depends on files from frameworks/base which makes it difficult to
test. Bug 177317659 will fix that and allow the metadata file
generation to be tested too.

Bug: 178361284
Test: m nothing
Change-Id: I33921d7267c9f4bb42726343d73f8a396d536aaa
2021-02-07 10:58:24 +00:00
Paul Duffin
254aee4843 Merge changes I9e94662d,I4b4e0dc8
* changes:
  Export implementation class jars for java_boot_libs
  Improve module filtering in hiddenapi stubFlagsRule()
2021-02-07 10:52:01 +00:00
Bill Peckham
a036da9b27 Enable android_app_import to supply framework-res.
By enabling an android_app_import module to supply the
special framework-res module, it becomes possible to
create a split build that excludes the source of over
10,000 files under frameworks/base/core/res, replacing
this source with a prebuilt. However, since other parts
of a monolithic build use the source of framework-res,
this scheme works only if your split build manifest
excludes modules that depend on framework-res source.

Bug: 176851898
Test: lunch aosp_arm64-userdebug && m nothing
Test: new TestAndroidAppImportExportPackageResources
Test: local build without prebuilt framework-res
Test: local build with prebuilt framework-res
Change-Id: If00d9dbc656c8406c038448d09f93f767c1e06d1
2021-02-05 14:30:46 -08:00
Liz Kammer
595abf120a Merge "bp2build: convert paths/module refs to Bazel label" am: b7eab01167 am: 6d5454d0f9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1564272

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I850a7a72980cd003afbb696ff0ae1beba110995a
2021-02-05 15:00:27 +00:00
Liz Kammer
b7eab01167 Merge "bp2build: convert paths/module refs to Bazel label" 2021-02-05 13:39:08 +00:00
Paul Duffin
22ff0aaf51 Export implementation class jars for java_boot_libs
Hiddenapi processing currently requires access to the class
implementation jars for libraries on the bootclasspath which means that
they need to be provided as part of the prebuilts. This change modifies
the java_boot_libs property on the sdk to make those files available.

Modularization of the hiddenapi processing will hopefully remove the
need for these to be exported so this should be temporary.

Bug: 178361284
Test: m art-module-sdk
      check generated snapshot zip contains implementation jars
Change-Id: I9e94662dddb0ddb85a477ae6d27e533085147e88
2021-02-05 13:35:25 +00:00
Paul Duffin
dd63d6d7bd Improve module filtering in hiddenapi stubFlagsRule()
Previously, it ignored any module that was not a platform apex variant
however that required every module that was referenced from the boot
jars to have a platform variant which is not the case when building
from prebuilts.

This change switches it to explicitly check that the variant is for
either the appropriate apex or the platform depending on what is
configured in the BootJars or UpdatableBootJars.

It partially duplicates some logic from the getBootImageJar() function.
It intentionally does not refactor the getBootImageJar() to allow for
reuse because coupling the hiddenapi and dexpreopt logic would make
refactoring either of them more difficult. Any duplicated code will be
deduped once they have both been refactored.

Bug: 178361284
Test: m droid
Change-Id: I4b4e0dc8ee40c1ba1713d7ef72df13d175e84af6
2021-02-05 13:33:25 +00:00
Ulyana Trafimovich
8c723918ee Merge "Don't write nonexistent DEX file paths to dexpreopt.config files." am: 9b91082452 am: 1fdefc2c57
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1574745

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9f39d40678f0d818403c2ab2c6d015e34860e928
2021-02-05 12:24:15 +00:00
Ulyana Trafimovich
9b91082452 Merge "Don't write nonexistent DEX file paths to dexpreopt.config files." 2021-02-05 11:10:03 +00:00
Paul Duffin
b00bde6fb0 Merge "Detect empty apex in ConfiguredJarList" am: b8887127ba am: 6664c04ce9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1574743

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I42edc356e4a6cc4ec548c36a023a4fee6d5d94dd
2021-02-05 10:50:07 +00:00
Paul Duffin
b8887127ba Merge "Detect empty apex in ConfiguredJarList" 2021-02-05 09:30:15 +00:00
Treehugger Robot
ef8d0e264a Merge "data dependency of java_test_host can be arch-specific" am: f860a2ab66 am: 685daa0dd9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1574806

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib39fd01d7c7f0a3360d71262e9d9819fca576090
2021-02-05 05:01:57 +00:00
Liz Kammer
356f7d45c1 bp2build: convert paths/module refs to Bazel label
This currently expands all globs, still need to support converting glob
syntax.

Test: go build_conversion_test
Test: GENERATE_BAZEL_FILES=true m nothing
Test: m nothing
Bug: 165114590
Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
2021-02-04 13:45:56 -05:00
Jiyong Park
cdd9b8392d data dependency of java_test_host can be arch-specific
This allows java_test_host to have arch-specific data files. Currently,
VirtualizationHostTestCases needs this to have arch-specific kernels as
its data.

Bug: N/A
Test: m VirtualizationHostTestCases
Change-Id: Ib5680ef48b613955ad92c9bc212184ac75900d3e
2021-02-05 00:29:47 +09:00
Ulya Trafimovich
c0f64799da Don't write nonexistent DEX file paths to dexpreopt.config files.
A path to an nonexistent file caused dex2oat to write an empty path in
the class loader context stored inside of the OAT/ODEX file, which
resulted in class loader context mistmatch and a failure to load
dexpreopt code on device.

An example of a faulty class loader context for GoogleDialer, can be
seen either with oatdump or by grepping logcat for class loader context
mimatch messages (the first empty PCL[] is expected, note the second
empty PCL[] in the subcontext for shared libraries):

  PCL[]{PCL[]#PCL[/system/framework/org.apache.http.legacy.jar*22205474]

This CL removes the nonexistent path from the generated dexpreopt.config
file, which works in conjunction with a change in makefiles that stops
using the removed config field. This is possible because makefiles can
access DEX files using a module name and "intermediates-dir-for" macro.

Bug: 132357300
Test: lunch cf_x86_64_phone-userdebug && m && launch_cvd \
      adb wait-for-device && adb root && adb logcat \
      | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
      # empty grep output, no errors
Change-Id: I8d16f77c6f76ad6234cc4114ad3545cbe572ef13
2021-02-04 12:14:51 +00:00
Paul Duffin
9c3ac96f1f Detect empty apex in ConfiguredJarList
Previously, ConfiguredJarList would accept an empty apex name,
e.g. ":jar" which makes no sense as every apex has to have a non-empty
name. This change makes an empty apex invalid.

In order to improve the test coverage of the TestConfiguredJarList test
this change also changes the implementation of
CreateTestConfiguredJarList([]string) to marshal the supplied strings
into a json list and then unmarshal into a ConfiguredJarList which more
closely matches how it is used at runtime.

Bug: 178361284
Test: m nothing
Change-Id: I7dfec6b4cc1923aa99746e976da0393922ef0791
2021-02-04 10:07:41 +00:00
Paul Duffin
f553a9f40d Merge "Switch hiddenapi to use OutputPath instead of ModuleOutPath" am: e1f9b35d92 am: 5a648cf0df
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1571202

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9a1e1890545da1fd16918831567f22f03e73cf65
2021-02-03 11:10:01 +00:00
Paul Duffin
e1f9b35d92 Merge "Switch hiddenapi to use OutputPath instead of ModuleOutPath" 2021-02-03 10:02:36 +00:00
Tobias Thierer
dec7caec15 Merge "go/Android.bp: Clarify sdk_version documentation." am: dadc62cdb4 am: 922e7f941a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1518598

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie46c8ea7ea179f2e87fe6f1a6741c0035cb87766
2021-02-02 19:34:48 +00:00
Tobias Thierer
dadc62cdb4 Merge "go/Android.bp: Clarify sdk_version documentation." 2021-02-02 18:19:38 +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
3e9ce4716a Merge "Move creation of paths into hiddenAPIGenerateCSV" am: 8705ba06bf am: 9031379011
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1564637

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I37d8002f30b31451dc683ce72156d50f2e55ac64
2021-02-01 19:49:23 +00:00
Paul Duffin
8705ba06bf Merge "Move creation of paths into hiddenAPIGenerateCSV" 2021-02-01 17:28:20 +00:00
Paul Duffin
2c1c3cac9e Merge "Fix some minor issues with boot_image" am: aded43c808 am: 92db324beb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1566176

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I54537d03a79ad26895ecbee9be0e64fbde575c0f
2021-02-01 11:02:35 +00:00
Paul Duffin
4694cf7c81 Merge "Add boot_images to apex" am: 4a838dfb3f am: 4849ec99b9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1560278

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I61aa45660665daf63e98ff1d51c2171ba76e0aa8
2021-02-01 11:02:23 +00:00
Ulyana Trafimovich
136d087a8e Merge "Write module dexpreopt.config for Make." am: a4fce3b488 am: 682808f0ad
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1541538

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4c0696bbcf536ddbf875c9e6c9e43bbc602b4b3f
2021-02-01 11:02:14 +00:00
Paul Duffin
4c73a0d554 Merge "Add documentation for the different files created by hiddenapi" am: 523bb85995 am: e3b48e4034
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1564636

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I442b5bfd65dbb863d79926c562dbe81205518501
2021-02-01 11:02:07 +00:00
Paul Duffin
aded43c808 Merge "Fix some minor issues with boot_image" 2021-02-01 10:21:34 +00:00
Paul Duffin
4a838dfb3f Merge "Add boot_images to apex" 2021-02-01 10:21:21 +00:00
Ulyana Trafimovich
a4fce3b488 Merge "Write module dexpreopt.config for Make." 2021-02-01 10:16:57 +00:00
Paul Duffin
5bbfef8718 Fix some minor issues with boot_image
Mistakenly used HostAndDeviceDefault (which builds host and device
variants by default) instead of HostAndDeviceSupported which only
builds a device variant by default.

Moved the test definitions of art and framework boot images from being
defined in all Java related tests into the test where they belong. This
is needed in order to improve the ART and framework boot image specific
testing.

Bug: 177892522
Test: m droid
Change-Id: I16771f09bd789033e18c58ae6dd4b6b9e865d831
2021-01-30 12:57:26 +00:00
Paul Duffin
a1d6025a49 Add boot_images to apex
Previously, the apex module had to hard code behavior specific to the
art apex module in order to include the art boot image. This change
adds support to the apex module to allow the boot images to be
specified per apex.

In combination with a change to add the "art-boot-image" to the ART
apex this allows the custom code for handling the art boot image in
apex to be removed.

That custom apex code also included the logic to ensure that the
GlobalSoongConfig was initialized for use by the dex_bootjars
singleton. That logic has been moved from the APEX to the boot_image
module. That ensures that it will be run if and only if a boot_image
module is present in the checked out repos. So, limited manifest
checkouts which do not contain the art or frameworks/base repos (which
is where the boot_image modules are defined) will not attempt to run
this logic, which would fail because dex2oat would not be present.

Bug: 177892522
Test: m droid
Change-Id: I02d25fbef6e864e31eb5e0f4eb50358c79486db0
2021-01-30 12:45:07 +00:00
Martin Stjernholm
8784b2fe5d Merge "Fix boot jar handling when both source and prebuilt APEXes and modules are present." am: c4e17317d1 am: d593a73257
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1553594

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia050858ba2a5810b0e708f61a12fe536b571af7f
2021-01-29 23:43:27 +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
Martin Stjernholm
c4e17317d1 Merge "Fix boot jar handling when both source and prebuilt APEXes and modules are present." 2021-01-29 13:15:02 +00:00
Tobias Thierer
1b3e949d14 go/Android.bp: Clarify sdk_version documentation.
The documentation was unclear because there are at least three
different ways (codename, version, API level) to refer to each
version, see https://source.android.com/setup/start/build-numbers
It is further complicated by the fact that this value is taken
as a String even though the API level it refers to is normally
an integer. To disambiguate, this CL adds an example.

Test: Treehugger only.
Change-Id: I40c13104a87d16c84c2098f36f7f63447d3dda4d
2021-01-28 21:55:37 +00:00
Martin Stjernholm
1dc0d6d7f2 Fix boot jar handling when both source and prebuilt APEXes and modules
are present.

1) The boot jar to APEX mapping is maintained by the base names for
both of them. When building with prebuilt modules and APEXes, that
means we need to take care to compare them without regard to any
"prebuilt_" prefixes.

2) VisitAllModules can visit disabled modules and both source and
prebuilt modules, so they need some conditions to skip modules that
aren't applicable for boot jars.

Test: `m droid`
Test: `m droid SOONG_CONFIG_art_module_source_build=false`
  with fresh ART Module prebuilts in place
Bug: 171061220
Change-Id: Iced269d29127bc8b8f9b3171adb60a97d115628b
2021-01-28 20:09:24 +00:00