Commit Graph

3435 Commits

Author SHA1 Message Date
Treehugger Robot
f828c49069 Merge changes Iba57c949,Ief43ff51,Ib1809a4d,I2ab64f36 am: b08a091502 am: 3f57de54b2 am: a088bff723 am: 6c4cdb0bb2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480605

Change-Id: Ie0876cdaf142dbd75c094f9e680849efb4105b28
2020-11-18 23:35:27 +00:00
Colin Cross
dcc3c42355 Merge "Move genrule on top of RuleBuilder" am: d4a63eaeb7 am: 9fffe4cd19 am: e2732d4c9d am: dea73f7535
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498170

Change-Id: I798a24001dd1e8e0bcc6fb0d2770294bed384dea
2020-11-18 21:23:22 +00:00
Treehugger Robot
b08a091502 Merge changes Iba57c949,Ief43ff51,Ib1809a4d,I2ab64f36
* changes:
  Store ndkKnownLibs in the config
  Register the kythe singleton on the Context instead of globally
  Store ninja file deps from PackageVarContext in the config
  Store SingletonMakeVarsProviders in the config
2020-11-18 20:00:31 +00:00
Colin Cross
d4a63eaeb7 Merge "Move genrule on top of RuleBuilder" 2020-11-18 18:44:19 +00:00
Dan Shi
cf10c9c69d Merge "Add unit_test test option in test configs" am: ebb51503a4 am: fdd23ce534 am: b71498a327 am: d95774301f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498167

Change-Id: I9b1a21f70ed9e615ab4ef2bbf2b0138d8c7c8665
2020-11-18 05:59:01 +00:00
Dan Shi
ebb51503a4 Merge "Add unit_test test option in test configs" 2020-11-18 04:40:37 +00:00
Colin Cross
3d68051218 Move genrule on top of RuleBuilder
In preparation for more complicated sandboxing support in sbox, use
a single implementation of the sbox sandboxing by moving genrule to
use RuleBuilder's sbox support instead of creating an sbox rule
directly.

Also move genrule's input list hash support into RuleBuilder.

Test: genrule_test.go
Test: rule_builder_test.go
Change-Id: I292184d02743c7e6887ebbcd232ba565db2ab0cc
2020-11-17 11:23:45 -08:00
Colin Cross
95f1ca07ce Store ndkKnownLibs in the config
Storing ndkKnownLibs prevents multiple tests from running in parallel
as one may be writing to the list while another is reading from it.
Store it in the config so each test has its own copy.

Test: go test -race ./apex
Change-Id: Iba57c9494012c9e0ae9e5ffaa63b9b2bd2c77492
2020-11-17 10:50:19 -08:00
Colin Cross
06fa588d1a Store SingletonMakeVarsProviders in the config
Store SingletonMakeVarsProviders in the config instead of a global
variable to avoid races between tests running in parallel.

Test: all soong tests
Change-Id: I2ab64f368b5ac673fd985399d4421ed018abc562
2020-11-17 10:47:24 -08:00
Ulyana Trafimovich
cdcfd6e711 Merge changes Iebfbf2ff,Ibd974268 am: d8d8e726a5 am: c4232f60d6 am: f0c0057668 am: cd1d3a2141
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1478656

Change-Id: I128e7ce333b29eb55c478e1df7010cb196701dc1
2020-11-17 12:23:17 +00:00
Ulyana Trafimovich
d8d8e726a5 Merge changes Iebfbf2ff,Ibd974268
* changes:
  Rename fields and methods to reflect class loader context changes.
  Do not add dependencies of shared SDK libraries to manifest_fixer.
2020-11-17 10:22:00 +00:00
Colin Cross
17f97caac1 Merge "Revert "Annotate dependency tags for dependencies of installed files"" am: e3d308b5a5 am: 1e9bf4a2d4 am: 1c4a64d945 am: e0d4766afe
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1500597

Change-Id: Ic89cbe63f9c323d64d5f937ee8f8d9ec08da1af8
2020-11-17 07:55:11 +00:00
Colin Cross
e3d308b5a5 Merge "Revert "Annotate dependency tags for dependencies of installed files"" 2020-11-17 06:32:57 +00:00
Colin Cross
b5ae193b8f Revert "Annotate dependency tags for dependencies of installed files"
This reverts commit 62a0cfd054.

Reason for revert: b/173475545

Change-Id: I4e834200c8e68dfa1b8144dfd1fa95ca68554980
2020-11-17 06:32:06 +00:00
Joseph Murphy
9103539bf5 Merge "Adds a workaround to fix version inconsistency" am: bac4ee008b am: 10fa2d924e am: bb47531ab0 am: 905594face
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1402212

Change-Id: I267d32ba8da5c933dd2fa9719a6d2e4a4e06100a
2020-11-17 03:23:02 +00:00
Colin Cross
b1ed155759 Merge "Replace android.WriteFile rule with android.WriteFileRule" am: 1af783fae7 am: e37a8e2d51 am: 104085c573 am: ba9cb68851
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498169

Change-Id: I46cf9e2375924e1ac47f2163587f87aa70e2c940
2020-11-17 01:49:26 +00:00
Colin Cross
fcd0274015 Merge changes Ic22603a5,I5330b571 am: f15c0558bf am: 6ae2d3dc85 am: 24e1b2cff9 am: b8ef5aa2aa
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1494957

Change-Id: Idfa7e78b42d6dcab2cee46fdf7f4a9ddd5ab20e6
2020-11-17 01:48:55 +00:00
Joseph Murphy
bac4ee008b Merge "Adds a workaround to fix version inconsistency" 2020-11-17 01:23:39 +00:00
Colin Cross
1af783fae7 Merge "Replace android.WriteFile rule with android.WriteFileRule" 2020-11-16 23:11:41 +00:00
Colin Cross
f15c0558bf Merge changes Ic22603a5,I5330b571
* changes:
  Annotate dependency tags for dependencies of installed files
  Use the the preferred architecture symlink as the tool path if it exists
2020-11-16 23:11:10 +00:00
Ulyana Trafimovich
1d32f9e847 Merge "Add nested class loader subcontext at the proper hierarchy level." am: 0066864a02 am: c5bb9fe652 am: ce8cd22021 am: c5e7aed796
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1486218

Change-Id: I370f20ee9533c0383a7b58abaa3d277200bf5563
2020-11-16 21:17:03 +00:00
Dan Shi
d79572f73e Add unit_test test option in test configs
This change allows a test (native, java, rust or python) to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 172006742
Test: m host-unit-tests
Change-Id: I69d3eb5b51198c549e2e6914ceac3a4fc33c3cf2
2020-11-16 11:05:00 -08:00
Ulyana Trafimovich
0066864a02 Merge "Add nested class loader subcontext at the proper hierarchy level." 2020-11-16 17:17:29 +00:00
Ulyana Trafimovich
2372c183d4 Merge "Rework class loader context implementation." am: af335a4694 am: 2084c86c1f am: 0d8cbed1b3 am: 250f8f4eb0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1450818

Change-Id: I70e28401eda541bd43af48ac72fa81968255901a
2020-11-16 16:13:47 +00:00
Ulya Trafimovich
b23d28c6e2 Rename fields and methods to reflect class loader context changes.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
2020-11-16 14:59:07 +00:00
Ulya Trafimovich
a8c28e27bc Do not add dependencies of shared SDK libraries to manifest_fixer.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: Ibd9742684fa6a8f1353ca0e513f7fa814a6ec9fc
2020-11-16 14:58:11 +00:00
Ulya Trafimovich
18554243de Add nested class loader subcontext at the proper hierarchy level.
When adding a subcontext in a class loader context tree, there are two
possible cases: 1) the root of the subcontext is itself a <uses-library>
and should be present as a node in the tree, or 2) the root is not a
<uses-library>, but some of its dependencies are -- in that case they
should be disconnected from the root, and the resulting forrest should
be added at the top-level.

Example:

  1) C is a <uses-library>:

     A
     ├── B
     └── C
         ├── D
         └── E
             └── F

  2) C is not a <uses-library>:

     A
     ├── B
     ├── D
     └── E
         └── F

Before the patch subcontexts for transitive dependencies were added
before the subcontext for the direct dependency (even if it was a
<uses-library>, resulting in case-2 hierarchy when case-1 should have
been used. Previosuly this didn't matter because class loader context
was a flat set of libraries, but now it matters because class loader
context is a tree.

This patch changes the order in which libraries are added, so that
direct dependencies are added before transitive ones. The context adding
method now accepts an "implicit root" parameter, so that when adding
transitive dependencies it can check if the corresponding direct
dependency is a <uses-library> and already present in the context.

Partially constructed class loader context is now propagated top-down
into aapt.buildActions, so that the method can use existing part of the
context to decide where the missing part should be connected.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I649aff9e27494306885a4f4fc90226c399636b57
2020-11-16 14:57:05 +00:00
Ulyana Trafimovich
af335a4694 Merge "Rework class loader context implementation." 2020-11-16 14:50:11 +00:00
Colin Cross
cf371cc1f7 Replace android.WriteFile rule with android.WriteFileRule
The android.WriteFile rule takes careful escaping to produce the
right contents.  Wrap it in an android.WriteFileRule that handles
the escaping.

Test: compare all android.WriteFile outputs
Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
2020-11-14 16:26:00 -08:00
Colin Cross
62a0cfd054 Annotate dependency tags for dependencies of installed files
Soong currently assumes that installed files should depend on
installed files of all transitive dependencies, which results
in extra installed file dependencies through genrules, static
libs, etc.

Annotate dependency tags for dependencies for which the
installed files are necessary such as shared libraries
and JNI libraries.

This avoids extra installed files, and is also a first step
towards genrules using their own copy of tools instead of
the installed copy.

Bug: 124313442
Test: m checkbuild
Test: java.TestBinary
Test: cc.TestInstallSharedLibs
Test: deptag_test.go
Change-Id: Ic22603a5c0718b5a21686672a7471f952b4d1017
2020-11-14 16:24:10 -08:00
Treehugger Robot
5789a1b32f Merge "Pass Config to NewTestContext instead of ctx.Register" am: ceed6be00d am: 748ecd135f am: b8316056fe am: 5f3bbae64b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480601

Change-Id: Ib69b3a789c2de2c83be8a299eafa0740af306081
2020-11-14 07:18:40 +00:00
Colin Cross
ae8600b507 Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing
Config to NewTestContext and NewContext instead of to ctx.Register.
This will enable a followup change to store SingletonMakeVarsProviders
registered on the Context in the Config, which is necessary to run
multiple tests in parallel without data races.

Test: all soong tests
Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-12 10:07:49 -08:00
Paul Duffin
c459dc8c02 Merge "Switch boot jars package check to using dex jars" am: 68ecbaf614 am: aa50b67217 am: d54bddbda2 am: cb606c48f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1479315

Change-Id: If8e9c34e194fbbab52e33993792ff375bff28e2b
2020-11-11 14:34:30 +00:00
Paul Duffin
68ecbaf614 Merge "Switch boot jars package check to using dex jars" 2020-11-11 12:53:23 +00:00
Mathew Inwood
660ed8cb7d Merge "Temporarily move APIs to blocked list." am: 82d5b6726b am: 1917bee275 am: 1c7d02ef58 am: d5afd757e3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1494179

Change-Id: I44e7a1dbc9a21eafe7614f44e41cc99750c26fe2
2020-11-11 10:46:08 +00:00
Mathew Inwood
82d5b6726b Merge "Temporarily move APIs to blocked list." 2020-11-11 09:13:48 +00:00
Paul Duffin
a975cb25ec Merge "Remove support for droidstubs in sdk/module_exports" am: 99a7622885 am: 14301ccfd1 am: 4fc198029d am: 9f3d5d7d11
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1492857

Change-Id: I1cabd47542a339da717a2d858668f11a4b544ddd
2020-11-10 19:57:18 +00:00
Paul Duffin
2d8e1a7e59 Switch boot jars package check to using dex jars
The switch to use dex jars instead of class jars means that a boot jar
that is defined by a dex_import module will now be checked against the
package_allowed_list.txt so it is possible that it will detect
previously unreported problems.

Test: m check-boot-jars - for failing and passing cases
Bug: 171479578
Bug: 125517186
Change-Id: Ie614898dade0fb43c9418d7afb9138169db6f097
2020-11-10 17:37:43 +00:00
Paul Duffin
99a7622885 Merge "Remove support for droidstubs in sdk/module_exports" 2020-11-10 17:34:00 +00:00
Anton Hansson
45ab2c48f4 Merge "Remove dead code" am: a1b3314286 am: 00d7ec3375 am: ab2ebb04ba am: 989e7e6daa
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1488756

Change-Id: Ided08e856716c584c0e61ccd7c04a4b1b65f565d
2020-11-10 15:35:30 +00:00
Paul Duffin
aa78948155 Merge "Use glob for java_sdk_library_import stub_srcs" am: 37fa489a9e am: 0b578e9241 am: a3f456e3d0 am: 6f1e1ff0a6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1492856

Change-Id: I4aa7bfcb1c5743013af784a31944a05e143a6134
2020-11-10 15:35:23 +00:00
Anton Hansson
a1b3314286 Merge "Remove dead code" 2020-11-10 14:35:13 +00:00
Paul Duffin
a3cb6cf2e5 Remove support for droidstubs in sdk/module_exports
The droidstubs support in sdk/module_exports was a temporary measure
to work around the fact that some APIs were being defined by direct use
of droidstubs instead of java_sdk_library.

This change removes that support as those APIs have all been switched
from droidstubs to use java_sdk_library so droidstubs support is no
longer needed.

Bug: 168301990
Test: m nothing
Change-Id: I3517bed29b030438a0423a6cb8c248992a988222
2020-11-10 13:55:17 +00:00
Paul Duffin
37fa489a9e Merge "Use glob for java_sdk_library_import stub_srcs" 2020-11-10 13:54:23 +00:00
Mathew Inwood
59093e3769 Temporarily move APIs to blocked list.
Bug: 170729553
Test: m

Change-Id: I62db78941785fd1bd336cfe81c8e9763e08a0eb0
2020-11-10 13:08:58 +00:00
Paul Duffin
7f97957ded Use glob for java_sdk_library_import stub_srcs
Some java_sdk_library modules do not have any stubs for some API
scopes. That results in an empty ".srcjar" being created for them which
ends up not creating a directory for the stubs sources when that
snapshot is unzipped. Previously, that would cause a build failure as
the generated java_sdk_library_import module used the directory, which
did not exist, in its stub_srcs property.

This change switches the stubs_srcs property to use a glob pattern of
"**/*.java" relative to the directory instead of using the directory
directly. When the directory does not exist the glob pattern is
resolved to an empty set of paths and does not break the build.

Bug: 172811712
Test: Add sdkextensions-sdk sdk module (local patch)
      m sdk-extensions (local patch)
      unpack generated snapshot
      m nothing - results in build failure due to missing directory
      Make this change and repeat above except this time the build works.
Change-Id: I691ffbfdc01ba89bbcaf647dcbb7dfebc3c8aec2
2020-11-09 17:42:52 +00:00
Anton Hansson
30a4c9d665 Remove dead code
I removed the last use of this method in r.android.com/1450117.

Bug: 169395887
Test: m nothing
Change-Id: I3bbb600d92dac8d9c3dec0eee14c45cdfd320ce0
2020-11-05 10:49:45 +00:00
Ulya Trafimovich
8cbc5d269b Rework class loader context implementation.
The old representation consisted of a list of libraries (UsesLibraries),
a list of optional libraries (OptionalUsesLibraries) and a mapping from
library name to its build/install paths (LibraryPaths). The separation
into lists and map was necessary because of special handling of
compatibility libraries, which is now unified with normal libraries.

The new representation is a mapping from target SDK version to a tree
structure ClassLoaderContext. Each node of the tree represents a library
and contains library name, build/install paths and a slice of
subcontexts for dependencies. The same library may occur in the tree
multiple times in case it is a dependency of multiple libraries. The
order in which libraries are added matters (the resulting tree shape may
be different).

Test results have to be updated, as the resulting <uses-library> list is
reodered (previously it was a sorted list of map keys, and now it is
formed by a depth-first preorder traversal of the class loader tree).

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: I11be8cd2967f004fd58753d7c5fb99fed179cd63
2020-11-03 15:15:46 +00:00
Jingwen Chen
f27c766051 Merge "Add ctx.ModuleDir and top level module dirs of input sources to JDK9 --patch-module lookup." am: 366c7d3a74 am: bb24d6d16c am: ad37e4010f am: e23a79a717
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480608

Change-Id: I0e00a1969b710fdfd81c11a12ecccf504d009688
2020-11-03 05:53:23 +00:00
Jingwen Chen
5136a6e5aa Add ctx.ModuleDir and top level module dirs of input sources to JDK9
--patch-module lookup.

javac --patch-module accepts a list of directories and/or jars for JDK9
module patching (see bug for more details). In Bazel-Ninja execution,
Bazel executes the javac action in its own execution root working
directory, unlike Ninja, which works in the Android top level directory.
The Bazel execution root is formed of a symlink forest of top level
directories. This symlink forest is a problem for javac because it
doesn't traverse into symlinks.

To support Bazel executing these javac actions, we explicitly encode the
module directory, and the top level directory of any other source file
inputs into the --patch-module javac flag.

For example, the "core-all" libcore module compiles into `java.base`,
and depends on filegroups outside of `libcore` (`tools`). This CL adds
`tools` to the --patch-module lookup dir, on top of `libcore`.

See java_test.go for more details.

Bug: 150878007
Fixes: 150878007
Test: m
Test: bazel build droid (aosp_flame)
Change-Id: Id95b0a9a675fc75678f7b5e600344b4403f0c518
2020-11-02 17:49:57 -05:00