Commit graph

35698 commits

Author SHA1 Message Date
Paul Duffin
1e6f5c4e63 Separate output of flag generation from hiddenAPIFlagFileInfo
HiddenAPIFlagOutput encapsulates the paths to the files produced by the
hidden API flag generation of a single bootclasspath_fragment. It is
returned from hidden API flag generation and is embedded within the
hiddenAPIFlagFileInfo so they can be passed to other modules.

Unlike the fields it replaces in hiddenAPIFlagFileInfo the fields in
HiddenAPIFlagOutput are of type Path not Paths which makes it easier to
use.

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: I7373ba1001cac3a75eb54a23e62fa52f5013ee7f
2021-05-24 13:32:55 +01:00
Paul Duffin
438eb57a27 Separate monolithic hidden API processing from hiddenAPIFlagFileInfo
The hiddenAPIFlagFileInfo was being used for both the input and output
of bootclasspath_fragment and platform_bootclasspath and also to pass
information around to various hidden API rule methods. Supporting
multiple different uses in this way made it hard to reason about.

This change creates a separate structure for use by the
platform_bootclasspath. Follow up changes will split out other
functionality into separate types.

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: Ia5c5f65ae5645486c42819c669a8601588217f88
2021-05-24 13:32:55 +01:00
Lukacs T. Berki
c1cc3b9678 Split each test case to a different test function.
This is so that they can be individually debugged.

Test: Presubmits.
Change-Id: I7d929c4126bba7470aaa1c0def85bad65429ffdc
2021-05-23 20:41:14 +02:00
Paul Duffin
54c98f5b4a Perform hidden API encoding in bootclasspath_fragment
Previously, the apex content info was populated with hidden API encoded
dex jars retrieved directly from the java module. This change retrieves
the unencoded dex jars from the java module, encodes them and then
stores the result in the apex content info.

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: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
2021-05-23 11:21:38 +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
Martin Stjernholm
22053dcbf2 Merge "Fix indexing bug when config.Arches() returns an empty array." 2021-05-22 18:53:42 +00:00
Christopher Parsons
dbfafc0a3c Merge "Propagate unexported deps via implementation_deps" 2021-05-21 21:29:59 +00:00
Pirama Arumuga Nainar
cb56f0166f Merge "[cc/coverage] Define a macro during coverage builds" 2021-05-21 20:47:00 +00:00
Martin Stjernholm
df298b3bed Fix indexing bug when config.Arches() returns an empty array.
This happens when com.android.art.host is not disabled in
prebuilts/build-tools/build-prebuilts.sh.

Test: m nothing
Test: env OUT_DIR=out prebuilts/build-tools/build-prebuilts.sh
  on the aosp-build-tools branch
Bug: 188922057
Change-Id: Ib21d17bb627e4cf7faee320febe65e1bb4566d4e
2021-05-21 21:07:26 +01:00
Spandan Das
fc1fbc428a Merge "Adding relative_install_path field to android_app_import" 2021-05-21 16:15:38 +00:00
Colin Cross
90463fe8cb Merge "Allow missing java_sdk_library files in AllowMissingDependencies builds" 2021-05-21 15:07:49 +00:00
satayev
a4cf238f4d Merge "Populate individual classpath_fragments' classpaths.proto configs." 2021-05-21 10:21:49 +00:00
Jingwen Chen
857d037566 Merge "bp2build: generate arm toolchain flags into @soong_injection." 2021-05-21 04:14:51 +00:00
Jingwen Chen
78257e5b6b Add a comment to absolutePath on why it's not exported.
Change-Id: Ib6595e8af3d845861d4c5988750e3c43280bb697
Test: TH
2021-05-21 02:37:00 +00:00
Bill Peckham
79610d55fa Merge changes from topic "far-dep-exists"
* changes:
  Check for product variant in addition to core variant.
  Plumb through OtherModuleFarDependencyVariantExists from blueprint.
2021-05-21 01:37:21 +00:00
Colin Cross
18f840c45e Allow missing java_sdk_library files in AllowMissingDependencies builds
java_sdk_library modules in builds with AllowMissingDependencies may
be missing defaults modules that cause them to look for api files that
they normally wouldn't need.  Move the error to runtime so it doesn't
block the build unless the branch tries to build that module.

Test: prebuilts/build-tools/build-prebuilts.sh in aosp-build-tools
Change-Id: I279b0cd8493779f972c0ac02235967c10b35a5a0
2021-05-20 18:00:37 -07:00
Brian Egizi
2aded7dd55 Fix unbound variable in kzip script
Change-Id: Id7f81677389cb853da064a43f1d5d54b2271f0c0
2021-05-21 00:51:44 +00:00
Brian Egizi
c3a800f611 Merge "Update kzip script to support superproject revision environment variable" 2021-05-21 00:20:52 +00:00
Spandan Das
d1fac64807 Adding relative_install_path field to android_app_import
Test: Ran go test ./java from build/soong
Bug: 149873762
Change-Id: I4abc1fb9e2386c7319b446b84aebaabacc882fd6
2021-05-20 23:10:26 +00:00
Jingwen Chen
51a1e1cf59 bp2build: generate arm toolchain flags into @soong_injection.
Other architectures will come later.

Bug: 187084665
Test: TH
Change-Id: Ifcc6773625e56b1fc20260d840380e7ee4ecee7f
2021-05-20 22:29:39 +00:00
Bill Peckham
1d3466a019 Merge "VNDK snapshot may provide LLNDK stub libraries" 2021-05-20 21:43:44 +00:00
Brian Egizi
4aa056eb9e Update kzip script to support superproject revision environment variable
This changes the superproject sha variable to use the
SUPERPROJECT_REVISION as the default value if no explicit sha is
defined. Only sets up the new default if the revision value matches a
sha.

This change is required since the builder provides a revision for the
superproject that is either pinned to a sha or a branch name. If it is
pinned to a sha, we want to use this as the fallback source for
SUPERPROJECT_SHA

Bug: b/149248752
Change-Id: I59569b0e4d2f360243f0adc5b2587130956b6b99
2021-05-20 19:36:13 +00:00
satayev
8fab6f86af Populate individual classpath_fragments' classpaths.proto configs.
To avoid duplicates on *CLASSPATH environ variables at runtime, remove
split entries from platform-*classpath, i.e. all updatable jars that
have their own classpath fragments should not appear in the
platform-*classpath's classpaths.proto config.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: Id2759ab8e106cc183e695bf3509a6ab60ab0ef2a
Merged-In: Id2759ab8e106cc183e695bf3509a6ab60ab0ef2a
2021-05-20 20:06:03 +01:00
Bill Peckham
4016d7b53e Check for product variant in addition to core variant.
It's possible that a module will have a product variant
but not a core variant. In that case, we still need to
apply the vendor suffix to the androidmk module name.

Bug: 188720375
Bug: 187963715
Test: Build vendor image using vendor snapshot.

Change-Id: I190fdd707ca23357d1c324c1b1f3318457625f03
2021-05-20 18:57:04 +00:00
Martin Stjernholm
ecf2dc4614 Merge "Skip TestDex2oatToolDeps on Darwin." 2021-05-20 16:52:30 +00:00
Martin Stjernholm
408ffd8cca Plumb through OtherModuleFarDependencyVariantExists from blueprint.
Test: m nothing
Bug: 188398129
Change-Id: I64147293b6c51b437219e76e9e372fe56b977722
2021-05-20 16:43:04 +00:00
Chris Parsons
d6358775c8 Propagate unexported deps via implementation_deps
Test: bp2build and mixed_libc CI
Test: Manually verified that libc_bionic_ndk compilation gets the
appropriate headers (and no extra headers) from downstream

Change-Id: I79eb6e8ec1d415bd50d12105da4cf97101f95474
2021-05-20 12:05:24 -04:00
Martin Stjernholm
1b784a7caa Skip TestDex2oatToolDeps on Darwin.
This fixes https://r.android.com/1711292.

Test: m nothing
Bug: 188647117
Bug: 145934348
Bug: 172480615
Change-Id: I0c80b546a814d799562f374148eae5ca23b0e1f8
2021-05-20 15:53:00 +01:00
Liz Kammer
50d601731b Merge "Dump bazel product config in Soong" 2021-05-20 14:09:18 +00:00
Jingwen Chen
2fad43685e Merge "Add libc_nomalloc to mixed builds denylist." 2021-05-20 13:40:49 +00:00
Paul Duffin
bf4e6ec8a7 Merge "Store dex jar paths in bootclasspath_fragment's apex content info" 2021-05-20 12:46:48 +00:00
Paul Duffin
94e594c799 Merge "Move hidden API encoding after resource merging" 2021-05-20 12:45:42 +00:00
Justin Yun
dee806fd09 VNDK snapshot may provide LLNDK stub libraries
VNDK snapshots newer than v30 have LLNDK stub libraries. In that
case, the vendor variant for the BOARD_VNDK_VERSION must not be
generated from the LLNDK modules. They are already provided by the
VNDK snapshots.
Generate the vendor variant of the BOARD_VNDK_VERSION only if
BOARD_VNDK_VERSION has an integer value less than or equal to 30.

Bug: 187963715
Bug: 181815415
Test: m nothing
Change-Id: I31e90f4d7e7678c45558f6bf987f5582a4c34f78
2021-05-20 21:05:19 +09:00
Jingwen Chen
17e18c752a Add libc_nomalloc to mixed builds denylist.
Change-Id: Ie6a7675b56621e8da51dfad7b3bf62d429ea236a
Test: TH
2021-05-20 10:58:04 +00:00
Jiyong Park
6fae608181 Merge changes I4e7a7ac5,I0c73361b
* changes:
  Record the actual APEXes that a module is part of.
  Rename InApexes -> InApexVariants
2021-05-20 09:59:59 +00:00
Jingwen Chen
d685b7dcca Merge "bp2build: remove libc_nomalloc from denylist." 2021-05-20 09:54:57 +00:00
Luke Huang
4a256414e9 Merge "Fix the apex compatible issue on the platform Q" 2021-05-20 09:29:02 +00:00
Rupert Shuttleworth
e2f45d3e08 Merge "Move some implicitly shared testing code for bp2build into testing.go." 2021-05-20 09:02:10 +00:00
Paul Duffin
40aa4363cb Merge "Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath" 2021-05-20 06:58:34 +00:00
Jingwen Chen
6333b0e460 Set the default --platforms value to android_arm.
This is because the default lunch target is aosp_arm.

Change-Id: I3d99f6ea99862dc2eb579be10db123fe578f9f75
Test: TH
2021-05-20 01:38:53 +00:00
Jingwen Chen
0cc7196bc7 bp2build: remove libc_nomalloc from denylist.
Test: TH

Fixes: b/186825031
Change-Id: I596d6ea611fffb582e9161643148baf9a2f3be6a
2021-05-20 01:34:42 +00:00
Jingwen Chen
5ea6e801e4 Merge "bp2build: avoid adding deps on system_shared_libs temporarily." 2021-05-19 22:23:50 +00:00
Liz Kammer
09f947d67e Dump bazel product config in Soong
Bug: 187862880
Test: build/bazel/ci/bp2build.sh
Test: build/soong/tests/bp2build_bazel_test.sh
Change-Id: I24b09baad973e25bec4476e1ea4a7692b72b7d20
2021-05-19 17:38:56 -04:00
Paul Duffin
4483ec110d Merge "Test dex jar paths provided to apex by bootclasspath_fragment" 2021-05-19 19:49:16 +00:00
Paul Duffin
1a8010a241 Store dex jar paths in bootclasspath_fragment's apex content info
Previously, the DexBootJarPathForContentModule(module) simply called
directly through to the module to retrieve the dex jar path. This
change changes it so the bootclasspath_fragment retrieves the dex
jars from the module and stores them in the info structure for this
method to retrieve directly.

This makes it easier for the bootclasspath_fragment to stop retrieving
hidden API encoded dex jars from the module and perform the encoding
itself.

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: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
2021-05-19 16:17:30 +01:00
Rupert Shuttleworth
06559d07cb Move some implicitly shared testing code for bp2build into testing.go.
Test: go test
Change-Id: I403d703184e517dbffbdccb8007229cad00858c1
2021-05-19 09:14:26 -04: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
f2fa0b5e8e Test dex jar paths provided to apex by bootclasspath_fragment
This change adds a test to verify the existing behavior to provide a
baseline against which following changes can be compared.

Bug: 179354495
Test: m nothing
Change-Id: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
2021-05-19 13:48:25 +01:00
Martin Stjernholm
b81b29c2f6 Merge changes Ibc673303,I70317eb8
* changes:
  Don't fail if the target module is disabled in dex2oat tool dependencies.
  Use oatdump rather than oatdumpd for boot jar boot.*.oatdump.txt files.
2021-05-19 11:47:07 +00:00
Paul Duffin
7487a7abb6 Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath
The AlwaysUsePrebuiltSdks() causes all java_sdk_library_import modules
to be preferred over the source, i.e. as if they had prefer: true set.
That interacts badly with the work that is being done to integrate the
bootclasspath_fragment/platform_bootclasspath modules into the build.

It would work fine once that integration has been completed but in the
interim it causes problems. e.g. it does not cause a problem in AOSP
because those java_sdk_library_import modules that are affected have
already been integrated into the build properly.

Unfortunately, internally that is not the case because there are
java_sdk_library/java_sdk_library_import modules that still need to
be updated.

Before the java_sdk_library_import can be safely preferred each
java_sdk_library/java_sdk_library_import module that contributes to the
bootclasspath must:
* Be in the contents of matching bootclasspath_fragment and
  prebuilt_bootclasspath_fragment modules.
* Have an apex and one of a prebuilt_apex/apex_set that contains the
  dex implementation jar and lists the prebuilt_bootclasspath_fragment
  name in its exported_bootclasspath_fragments property.

Safely preferred in this context means that the whole build will
continue to work rather than the current situation which is that only
some of the build will work and some will fail if an attempt is
actually made to build it.

Unfortunately, many java_sdk_library_import modules are missing:
* The prebuilt_bootclasspath_fragment.
* The exported_bootclasspath_fragments property on the
  prebuilt_apex/apex_set that contains them.

Together these cause the following symptoms:
1. The java_sdk_library_import does not have a dex implementation jar.
2. The java_sdk_library_import does not have a myapex variant.

These workarounds will avoid Soong reporting build failures. However,
the build will still fail if an attempt is made to build anything
produced by the platform-bootclasspath, e.g. hidden API processing or
a system image.

Bug: 188505921
Bug: 179354495
Test: m TARGET_BUILD_APPS=Calendar
Change-Id: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
Merged-In: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
2021-05-19 11:42:20 +00:00