Commit graph

3454 commits

Author SHA1 Message Date
Treehugger Robot
e63ab5ea02 Merge "java link time error improve" 2020-11-19 18:38:16 +00:00
Julien Desprez
70898c4006 Use java host unit tests template for unit tests
Test: make aoa-helper-tests
Bug: 172961860
Change-Id: I2eaee277961f29adfd22e7c65248c9403bd69b81
2020-11-19 09:44:39 -08:00
Paul Duffin
1a39332cf6 Fix prebuilt_stubs_sources to work with no stubs sources
The framework-sdkextension java_sdk_library module defines an API for
public, system and module_lib API surfaces but the public API is empty.
The empty public API results in an empty .srcjar being repackaged and
merged into the sdkextension-sdk snapshot and results in no directory
for the public API stubs sources being created. Unfortunately, the
Android.bp file in the snapshot is created by Soong and it does not
know that the public API will be empty and so it creates an Android.bp
file that references the directory into which the stubs sources should
be added but which ends up not existing in the snapshot. Referencing a
non-existent directory causes a build failure.

This change fixes that issue by using PathForModuleSrc with no path
components to get the path to the module directory (which must exist)
and then resolving the module relative local src directory against
that. The local src directory is globbed to find all the files, which
will return an empty set of paths if the directory does not exist.
Finally, the file paths are passed as an rsp file to soong_zip to avoid
exceeding any command line limits.

Many other different approaches were considered:
* Adding a property to the java_sdk_library to indicate that the public
  API was actually empty. That would require extra maintenance by
  developers and would require some extra checks to be performed after
  generating the stubs source to ensure that it was empty which would
  complicate the build process.
* Creating a directory with some placeholder file (empty directories
  don't work well with git) that would force the creation of the
  directory. That file would most likely be created whether the API
  was empty or not, would need to be stored in git alongside the source
  and could be quite confusing to reviewers.

Bug: 173508731
Test: m nothing - to run new tests
      Build sdkextension-sdk, unpack it and then build the .srcjar
      files for the public, system and module_lib API surfaces.
      Without this change the build failed, reporting that the
      stubs_sources directory for the public API did not exist.
      With this change the build succeeded.
      Checked the contents of the resulting .srcjar files and made
      sure that the public one was empty and the others contained
      the SdkExtensions.java class and a package-info.java file.
Change-Id: Ia468a3f37349f2dbc21db67744bda6461498d515
2020-11-19 12:42:18 +00:00
Paul Duffin
ab5ac8f169 Revert "Use glob for java_sdk_library_import stub_srcs"
This reverts commit 7f97957ded.

Reason for revert: breaks sdk snapshots b/173508731
Bug: 173508731
Test: Ran prebuilts/runtime/update.py and then m nothing
      Before revert it failed
      After revert it worked

Change-Id: I9c081681fac589e37788a0d592435e3224011c58
2020-11-19 12:03:51 +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
ebb51503a4 Merge "Add unit_test test option in test configs" 2020-11-18 04:40:37 +00:00
Steven Moreland
0029898a84 java link time error improve
Asked about error message including "against private API.Adjust
sdk_version", which is a bit hard to parse due to missing space. Also
tried to make error message less verbose, so that it is more clear what
to do, and fixed a grammar mistake.

Bug: N/A
Test: N/A
Change-Id: Ib9a30d86b5cb0e9b3b7d5576ecb9498a9b316042
2020-11-17 21:57:23 +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
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
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
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
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
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
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
68ecbaf614 Merge "Switch boot jars package check to using dex jars" 2020-11-11 12:53:23 +00:00
Mathew Inwood
1ef4ba906a Explicitly tag max-target-o APIs as "lo-prio".
This allows the presubmit checker to explicitly allow certain changes to
these APIs, rather than special casing tha max-target-o list. This in turn
will allow other APIs to be tagged as lo-prio in future to get the same
treatment.

Test: m out/soong/hiddenapi/hiddenapi-flags.csv
Bug: 172993934
Change-Id: Ic7cc0243b2b018c96d420a3f266c4b3a6958c32f
2020-11-11 11:01:07 +00:00
Mathew Inwood
82d5b6726b Merge "Temporarily move APIs to blocked list." 2020-11-11 09:13:48 +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
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
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
Paul Duffin
1eacd95001 Merge "Move boot jars package check from make" 2020-10-30 10:06:46 +00:00
Jingwen Chen
9cb8d1b37b java compilation: refactor and extract javac flag computation into a
separate function.

This cleans up the internal wiring for a follow-up --patch-module
functionality change.

Bug: 150878007
Test: m
Change-Id: Ie7d9c2b1ad40e055da8a53d632510bef408fc7d2
2020-10-30 00:55:58 -04:00
Ulyana Trafimovich
42cac12541 Merge "Drop "android.hidl.manager" -> "android.hidl.base" dependency from class loader context." 2020-10-29 17:51:48 +00:00
Ulya Trafimovich
180fecedf0 Drop "android.hidl.manager" -> "android.hidl.base" dependency from class loader context.
This dependency is incorrect and shouldn't exist.
It has been removed in https://r.android.com/1467918

Test: m nothing
Bug: 170710203
Bug: 132357300
Change-Id: If3036437e138b552436f135425e6bd15be043678
2020-10-29 17:47:34 +00:00
Paul Duffin
9a89a2a0ea Move boot jars package check from make
Adds a singleton that traverses the module variants finding the ones
that are in the list (updatable and non-updatable) of boot jars and
add a ninja rule to ensure that they only contain packages from an
allowed list.

Replaces a hack that ignored any prebuilt boot jars supplied as dex
file with an equivalent one to ensure that they are still ignored.
A follow up change that switches to checking dex jars will allow the
hack to be removed.

The boot jars check can be strict or lax. If strict then all the boot
jars listed in the configuration must be found, otherwise it will only
check the ones it finds. It is strict by default unless
TARGET_BUILD_UNBUNDLED=true or ALLOW_MISSING_DEPENDENCIES=true.

Moves the script and data file from build/make.

Test: m check-boot-jars - for failing and passing cases
      SKIP_BOOT_JARS_CHECK=true - no check-boot-jars target created
	  ALLOW_MISSING_DEPENDENCIES=true - not strict
	  TARGET_BUILD_UNBUNDLED=true - not strict
      verified manually that apart from path differences the same
      files (same check sum) were checked in both old make checks and
      the new Soong ones
      EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m check-boot-jars
Bug: 171479578
Change-Id: I9d81d6650ba64fc0d48d2dab4ba5a3ba8dd03dec
2020-10-29 17:20:06 +00:00
Ulyana Trafimovich
e430ac338a Merge "Move part of logic from construct_context.py to Soong." 2020-10-29 13:53:17 +00:00
Ulyana Trafimovich
05b9a65f25 Merge "Add separate dependency tags for compat libs based on SDK version." 2020-10-29 10:27:59 +00:00
Ulyana Trafimovich
17da06cfd9 Merge "Fix handling of "android.test.mock" in class loader context." 2020-10-29 10:27:33 +00:00
Ulyana Trafimovich
c5b6f32751 Merge "Unify handling of compat and normal libs in class loader contexts." 2020-10-28 17:05:05 +00:00
Paul Duffin
7d584e9360 Retry: Make ConfiguredJarList immutable
By making the Append and RemoveList methods return a new list instead
of modifying the existing list it makes the ConfiguredJarList usages
easier to reason about and safer to use, especially considering that
they are primarily used in global configuration.

Added some tests for Append/RemoveList to ensure that they work and
do not modify the original or result in newly created lists sharing
storage with the original which would lead to corruption.

Bug: 171756871
Bug: 171479578
Test: m nothing
      EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m nothing
Change-Id: I541c4686ecdd45c6a0c8b1c93fedf0fcd5952e2b
2020-10-27 17:37:20 +00:00
Ulya Trafimovich
8130c482ab Move part of logic from construct_context.py to Soong.
construct_context.py is a script that runs at Ninja stage and constructs
class loader context arguments for dex2oat. Previously it accepted lists
of library paths and concatenated them into one class loader context
string. The script also handled the dependency of "android.hidl.manager"
on "android.hidl.base" that is not tracked by the build system and must
be handled in a special way.

Now that class loader context representation is going to change from
flat lists to trees, passing paths to individual libraries as script
arguments is no longer possible, because a list of paths cannot
represent a class loader context tree. Passing the trees in a serialized
form is also inconvenient, because the script would have to parse them,
which would complicate it a lot.

Therefore this patch ports all the concatenation and "android.hidl.base"
handling to Soong. It is not possible to port the remaining script to
Soong because Soong has no information about the targetSdkVersiion of
the dexpreopted apps (it is in the manifest and sometimes in an APK, and
has to be extracted at Ninja time).

Test: construct_context_test.py
Test: new subtests in TestUsesLibs
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Icdb03cf00d1e27e4cff3844b89bfaec4de502dd7
2020-10-27 17:05:30 +00:00
Ulya Trafimovich
b521811d7b Add separate dependency tags for compat libs based on SDK version.
The version in the tag is the SDK version that in which compatibility
library was added as a separate libary. Using distinct tags makes it
possible to differentiate between dependencies for different SDK
versions (this will be needed in subsequent CLs).

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I72296c05d6649e811ddc701aaeb84f91d1ba66cb
2020-10-27 17:05:30 +00:00
Ulya Trafimovich
46b3d5bd05 Fix handling of "android.test.mock" in class loader context.
Mimick the way PackageManager handles it at runtime: do add it to class
loader context for apps with targetSdkVersion < 30, but only if
"android.test.runner" is used. Previously it was not added at all.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I4c06635277ab13e21069b9fa0b46eb6a2547dfdd
2020-10-27 17:05:30 +00:00
Ulya Trafimovich
24813e1d80 Unify handling of compat and normal libs in class loader contexts.
Also, add tests for compatibility libraries in class loader context.

This CL separates special-case handling of compatibility libraries into
a "fixup" step that is done after class loader context is constructed by
Soong. This allows to handle compatibility libraries and normal
libraries uniformly, which should enable further simplification of class
loader context representation (in subsequent CLs).

Currently the only "fixup" step is removal of libraries from conditional
class loader context if they already are in unconditional context. This
check cannot be done at the time when the libraries are added to
conditional context, because the full uncoditional context is not yet
known at that time. Previously construction of unconditional context was
delayed, now it is no longer delayed and handled in the same way as
unconditional context, and the "fixup" does the filtering.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Ie71e9fb2d3d529b5317cd84e09ab3c853017c349
2020-10-27 17:05:30 +00:00
Paul Duffin
e10dfa4e3d Cleanup usages of CreateConfiguredJarList
After previous refactorings the CreateConfiguredJarList function is now
only used in tests and are supplied with a PathContext that will cause
ReportPathErrorf() to panic. So, this change removes the ctx parameter,
calls panic directly on any error and renames the method to make it
clear that it is for testing only.

Bug: 171479578
Test: m nothing
Change-Id: Icfb4bdfe720afa855b64ecf0e74a0b030882d029
2020-10-27 10:36:29 +00:00
Paul Duffin
69d1fb1e39 Switch BootJars/UpdatableBootJars to ConfiguredJarList
This change:
* Switches BootJars/UpdatableBootJars fields of config.productVariables
  from []string to ConfiguredJarList.
* Updates BootJars() method to simply concatenate the jars list from
  the BootJars/UpdatableBootJars fields.
* Adds an UnmarshalJSON(..) method to ConfiguredJarList to support
  unmarshalling from a single string array to avoid having to change the
  format of the JSON file from which the configuration is loaded.
* Adds some additional calls to ConfiguredJarList(..) in tests to
  convert from []string to ConfiguredJarList. They pass nil as the
  ctx argument as there is no suitable PathContext which will cause any
  errors to be thrown using panic. That is reasonable for hard coded
  values in tests. A follow up change will clean up the calls to
  ConfiguredJarList(..).

Bug: 171479578
Test: m nothing
Change-Id: I59b94dafb479ccd8f0471ed802be175af57be271
2020-10-27 10:36:29 +00:00
Anton Hansson
52ac73d21e Make highmem classification of metalava optional
We have added a lot of metalava invocations since the highmem
differentation was added, most of which do not use a lot of memory.

By collecting data of max rss per process we have narrowed down
the set of highmem modules to a smaller set, and will annotate the
relevant modules as such.

Bug: 170701554
Test: NINJA_HIGHMEM_NUM_JOBS=3 m checkapi (no long tail of metalava)
Change-Id: Ic9c8c91388b02889111ef596fc6fd8bde9b42b9d
2020-10-26 11:38:40 +00:00
Mathew Inwood
1e8118da95 Merge "Tag removed APIs as such in hiddenapi_flags.csv." 2020-10-26 08:52:11 +00:00
Cole Faust
26c468c155 Merge "Export proguard_flags_files from android_librarys" 2020-10-23 19:35:57 +00:00
Cole Faust
9a631319ab Export proguard_flags_files from android_librarys
If an android_library has a proguard flag file, that
file should also be used when compiling apps with the
library.

Fixes: 171425221
Test: New unit test in app_test.go, and manually
2020-10-22 21:07:35 +00:00
Mathew Inwood
a44e8c515d Tag removed APIs as such in hiddenapi_flags.csv.
Refactor flags in generate_hiddenapi_lists.py" the invocation to use the
new more flexible schema. Add "--tag removed" to removed.txt APIs so
that we can identify those APIs in the final output.

Test: m -j out/soong/hiddenapi/hiddenapi-flags.csv
Bug: 171300342
Change-Id: I38f2ec7c6e2ff7e5bdd9fe2aeb771d5153a2dc99
2020-10-21 15:52:15 +01:00
Martin Stjernholm
7f51107ee6 Rename ART release APEX to com.android.art.
Test: See https://r.android.com/1457217
Bug: 169639321
Change-Id: I6800c7a382486b4e50945cc8b789f4be16482fe6
Merged-In: I6800c7a382486b4e50945cc8b789f4be16482fe6
2020-10-21 15:41:02 +01:00
Martin Stjernholm
ea581fc95d Move the intermediate directory for ART boot images.
Free up the directory $(PRODUCT_OUT)/apex/com.android.art for the
release ART APEX. Without this we'll get conflicting install paths in
make.

Test: build/soong/soong_ui.bash --make-mode \
    TARGET_PRODUCT=sdk_x86_64 TARGET_BUILD_VARIANT=userdebug nothing
  with http://r.android.com/q/topic:release-apex-rename+author:mast
  present to rename the ART release APEX to com.android.art.
Test: Build & boot on CF
Test: apct/device_boot_test and asit/perf/boottime_test on
  blueline_jitzygote-userdebug
Test: avd/avd_boot_health_check on cf_x86_phone-userdebug_coverage_art
Bug: 169639321
Change-Id: I0b263d5922d438834e5c804e55f69a2a1421ab73
Merged-In: I0b263d5922d438834e5c804e55f69a2a1421ab73
2020-10-19 20:42:46 +01:00
Saeid Farivar Asanjan
128fe5c1f5 Add empty tag support for java_import
Test: manual
Change-Id: I53d7c6bb620fa8fe7f5c3ec0a12f723eb62fca16
2020-10-15 17:55:24 +00:00
Anton Hansson
faa866c5f0 Merge "Make test api extend system in sdk_library.go" 2020-10-14 14:43:03 +00:00
Paul Duffin
bc0fe96be3 Support building WITHOUT_CHECK_API=true
When WITHOUT_CHECK_API=true the check api process is not run which
means that the current.txt and removed.txt files are not generated by
the build. In that case this change causes the droidstubs module to
fallback to exporting the source files instead.

An additional removedApiFilePath property (to match apiFilePath) was
added to hold the exported path as removedApiFile has to be a
WritablePath and source paths are not writable.

Bug: 169034951
Test: m WITHOUT_CHECK_API=true nothing
      fails without this fix, passes with it.
Change-Id: If6b09dd67c8533368b71405143f524d66350703f
2020-10-13 15:37:10 +01:00
Anton Hansson
4fe970f303 Make test api extend system in sdk_library.go
The test stubs for the "main" android API are being changed to
incude @SystemApi annotated APIs. Update sdk_library to make modules
and optional libraries follow the same principle.

Bug: 129133308
Test: presubmit
Change-Id: I7bd940e1a8127d954d30c532c74d684a5ba9d33c
Merged-In: I7bd940e1a8127d954d30c532c74d684a5ba9d33c
(cherry picked from commit 13dbaac5b6)
2020-10-13 08:25:00 +01:00
Anton Hansson
ff98103505 Merge "Remove jdiff support from droiddoc" 2020-10-13 07:08:13 +00:00
Colin Cross
9ebc22cf2d Merge changes Ieeca3c39,Iddeea2d0,I8d66a5d3
* changes:
  Add jni_libs to host java binaries
  Make java_binary common variant a dependency
  Replace jniDependencyTag with a value
2020-10-13 03:33:10 +00:00
Treehugger Robot
ff8838cb86 Merge "Add jetifier support to android_library_import" 2020-10-12 23:38:06 +00:00
Jaewoong Jung
c1c415d0f7 Merge "Apply PRODUCT_ENFORCE_RRO_TARGETS to dependencies." 2020-10-12 21:45:33 +00:00
Saeid Farivar Asanjan
f043696fb9 Add jetifier support to android_library_import
Bug: 170242653
Test: manual
Change-Id: I9b49ea9ed18041c5509d4d53a3ce8fdf58c8c537
2020-10-12 17:51:38 +00:00
Jaewoong Jung
c779cd403f Apply PRODUCT_ENFORCE_RRO_TARGETS to dependencies.
With this change, users don't need to figure out which libraries
actually hold the resources to be overlaid when targetting apps with a
core lib dependency (e.g. Settings, SystemUI).

Fixes: 169898727
Test: app_test.go
Change-Id: I3c3b9dc0a377b1828db1199858a73d080a173205
2020-10-12 10:34:36 -07:00
Jaewoong Jung
19bc60abee Merge "Add config.AndroidFirstDeviceTarget." 2020-10-12 17:30:18 +00:00
Anton Hansson
53781d55bc Merge "Make hiddenapi flag generation use new artifact" 2020-10-12 16:08:11 +00:00
Jaewoong Jung
642916f20a Add config.AndroidFirstDeviceTarget.
Targets[Android][0] is not always the first, preferred target. Add a new
field to config to provide the correct target and begin to use it.

Test: m nothing
Test: build/soong/scripts/build-ndk-prebuilts.sh
Fixes: 156980228
Change-Id: Ib56f52424ebf47f3eee6ac62b9fd9eca2919d63a
2020-10-12 14:15:19 +00:00
Anton Hansson
858a8cabf9 Merge "Add a Impl_only_libs prop for sdk_library" 2020-10-12 09:00:13 +00:00
Colin Cross
89226d9ef9 Add jni_libs to host java binaries
Add a property to support dependencies on JNI libraries for host
java binaries.

Fixes: 170389375
Test: TestBinary
Change-Id: Ieeca3c3997615f0b17ae1f058b94e6c9ba929cab
2020-10-09 19:27:34 -07:00
Colin Cross
c179ea6812 Make java_binary common variant a dependency
ctx.PrimaryModule() is wrong in the case of a java_binary that
supports both host and device, use an explicit dependency instead.
Once the dependency exists there is no need to manually request
the jar be installed, it will automatically be installed by the
host installation rules for dependencies.

Test: TestBinary
Change-Id: Iddeea2d08bc574c79d42139020558cd70d718ca1
2020-10-09 19:27:34 -07:00
Colin Cross
de78d138a1 Replace jniDependencyTag with a value
Support GetDirectDepsWithTag on JNI deps by replacing the
jniDependencyTag type with a jniLibTag value.

Test: app_test.go
Change-Id: I8d66a5d3f433562e131a1fbafce75891d1b094dd
2020-10-09 19:24:05 -07:00
Colin Cross
405af07859 Revert "Make lots of tests run in parallel"
This reverts commit 323dc60712.

Reason for revert: Possible cause of test instability
Bug: 170513220
Test: soong tests

Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-09 18:34:24 -07:00
Anton Hansson
7f66efa10c Add a Impl_only_libs prop for sdk_library
Similar to Stubs_only_libs, this allows being a bit more specific
about what libs compile against what. In my usecase, it allows
removing a platform dependency from the appsearch stubs, which allows
the platform to depends on the stubs.

Bug: 169304493
Test: m
Change-Id: Ie997462819cd5266a761b2d415e81806c7877967
Merged-In: Ie997462819cd5266a761b2d415e81806c7877967
2020-10-09 13:49:30 +01:00
Anton Hansson
746be9ca1e Remove jdiff support from droiddoc
There are no users of this flag anymore.

Bug: 158465496
Test: m
Change-Id: I8e4af0a7863f6f4ebfc21997c9d72a6745081433
2020-10-08 19:07:39 +01:00
Colin Cross
45fd6ace7e Merge "Make lots of tests run in parallel" 2020-10-07 20:40:38 +00:00
Colin Cross
43159bd1b7 Merge "Remove global state from apex modules" 2020-10-07 17:58:00 +00:00
Paul Duffin
a87ea4587d Merge "Allow access to the class jar for java_import using {.jar} tag" 2020-10-07 17:16:43 +00:00
Anton Hansson
b3cbd61846 Make hiddenapi flag generation use new artifact
Use the output of new genrule combined-removed-dex instead of the
removedDexApi output from various metalava runs when generating the
hiddenapi-flags.csv file.

There are some minor difference in the two combined-removed-dex files,
but these diffs do not amount to any diffs in the generated
hiddenapi-flags.csv file. See the full set of diffs here:
https://paste.googleplex.com/6632343525654528

Bug: 158465496
Test: diff hiddenapi-flags.csv before and after
Change-Id: I082d18fc2b8a57ea8c5941d5c955a7970ab9d860
2020-10-07 12:28:23 +01:00
Anton Hansson
70bc545407 Merge "Add outputfiles tags for droidstubs api txts" 2020-10-07 09:54:43 +00:00
Ulyana Trafimovich
9f701fa348 Merge changes from topic "uses-libs-24"
* changes:
  Fail the build if dexpreopt cannot find path to a <uses-library>.
  Add dependency on implementation <uses-library> for modules that depend on component libraries.
2020-10-07 09:18:02 +00:00
Colin Cross
323dc60712 Make lots of tests run in parallel
Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.

Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-10-06 15:12:22 -07:00
Colin Cross
56a8321c21 Remove global state from apex modules
A global variant was used to store the global mapping between
modules and APEXes.  Replace it with storing pointers to APEX
contents inside each module so that they can query the contents
of any APEXes they belong to.

Bug: 146393795
Test: all Soong tests
Test: single line change to build.ninja host install dependency ordering
Test: no Android-${TARGET_PRODUCT}.mk, make_vars-${TARGET_PRODUCT}.mk or late-${TARGET_PRODUCT}.mk
Change-Id: Id2d7b73ea27f8c3b41d30820bdd86b65c539bfa4
2020-10-06 13:39:57 -07:00
Paul Duffin
aa55f74505 Allow access to the class jar for java_import using {.jar} tag
Layoutlib requires access to the jar file (containing .class) files for
a number of libraries including "core-libart". It does that using the
{.jar} output tag, e.g. "core-libart{.jar}".

This change makes sure that works when "core-libart" is provided as a
java_import instead of a java_library.

Bug: 142938164
Test: m nothing
Change-Id: I605019d680c28e4a33f0ca14279d63fa62b9774b
2020-10-06 17:48:37 +01:00
Paul Duffin
81febc4500 Avoid panic when a boot jar is provided as a java_import
Bug: 142938164
Test: m nothing
Change-Id: I607009825f5946d7e1daa31dc1e4bb8f2609206d
2020-10-06 16:54:02 +01:00
Ulya Trafimovich
39b437b25f Add dependency on implementation <uses-library> for modules that depend on component libraries.
If a dexpreopted Java module depends on a component library (such as
stubs), it must be dexpreopted against the implementation library,
because that is what it will use at run time. Therefore dexpreopt needs
to know about the implementation library.

One of the subtests of TestUsesLibraries is removed. This is because the
subtest was previosuly split in two variants with the only difference
that the first variant had dependency on a stubs library, and the second
one had dependency on the implementation. The latter caused dexpreopt to
be disabled because Soong couldn't find the implementation (it had only
the name, but no access to the module). Now that there is a dependency
on the implementation, the problem goes away and the two subtest
variants can be merged into one.

Add a method for getting the name of the implementation library for the
optional SDK library. Currently it is the same as the SDK library name,
but it may change in future.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I584df4b6db874c7ae3c478231fc51572a46929b1
2020-10-06 14:04:49 +01:00
Anton Hansson
ecf5435590 Add outputfiles tags for droidstubs api txts
These can then easily be used in genrules to merge txt files.

Bug: 169034951
Test: m combined-dex-api
Change-Id: Id49739c90a2ab52a72094b76696a4e5211c8d742
2020-10-06 10:01:29 +01:00
Paul Duffin
fb6ae5bc73 Add support for using sdk_version: "module_<ver>"
Fixes a panic when trying to build something with
sdk_version: "module_30".

Test: m nothing
Change-Id: I9b2ce50957f59e2bead335ffa58888e15cda1f78
2020-09-30 16:20:17 +01:00
Paul Duffin
a2ae7e0358 Allow java_sdk_library to specify doctags_files
When generating Javadoc the processor needs to be given information
about the doctags that are present in the source. This change allows
that information to be managed with the java_sdk_library that generates
the stubs source from which the Javadoc is generated.

Bug: 168301990
Test: Built offline-sdk-docs with and without the change and
      diffed them. The only difference was the timestamp.js
      file.
Change-Id: I4adbeb0781bc2191461fec856ffa90ea185e7434
2020-09-28 18:35:57 +01:00
Paul Duffin
6877e6d951 Output Javadoc comments for public API
When generating stubs source for contributions to the public API keep
the Javadoc comments from the input source so that the stubs source can
be used as input to the metalava invocation that creates the stubs from
which the public Javadoc is generated.

This is needed to fix an issue with conscrypt's contributions to the
public API, i.e. SSLEngines and SSLSockets where the Javadoc comments
were not present in the generated Javadoc.

Test: Built offline-sdk-docs with and without the change and
      diffed them. The only difference was the timestamp.js
      file and they now included proper documentation for the
      SSLEngines/SSLSockets classes.
Bug: 169162018
Change-Id: I1b50cff3b91766ce261b2f8e798b77ebc6faac70
2020-09-25 20:23:37 +01:00
Anton Hansson
a6906e2329 Merge "Make API lint warnings errors for system & testapi" 2020-09-25 06:52:57 +00:00
Treehugger Robot
4f6eebff0c Merge changes I0885e493,Ic37c8db9
* changes:
  linux_bionic_arm64 is added when Host_bionic_arm64 is true
  HostCross is an attribute of a Target, not OsType
2020-09-24 22:56:43 +00:00
Anton Hansson
b30f593da4 Make API lint warnings errors for system & testapi
They used to be listed to not have this treatment, but we are
baselining the existing warnings and making them errors instead.

Bug: 154317059
Test: m
Change-Id: I306b5a07d1b771cc0061aaac44f881f40fbe85ed
Merged-In: I306b5a07d1b771cc0061aaac44f881f40fbe85ed
2020-09-24 13:51:29 +01:00
Jiyong Park
1613e5541f HostCross is an attribute of a Target, not OsType
A host target is considered as being cross-compiled when the target
can't run natively on the build machine. For example, linux_glibc/x86_64
is a non-cross target on a standard x86/Linux machine, but is a cross
host on Mac. Previously, whether cross or not was a static attribute of
an OsType. For example, Windows was always considered as cross host,
while linux_bionic was not. This becomes a problem when we support more
host targets like linux_bionic/arm64 which should be cross-host on
standard x86/Linux machines.

This change removes HostCross from the OsClass type and instead adds a
property HostCross to the Target type. When a target is being added, it
is initialized to true when the target can't run natively on the current
build machine.

Bug: 168086242
Test: m
Change-Id: Ic37c8db918873ddf324c86b12b5412952b0f2be2
2020-09-24 14:14:31 +09:00
Dan Albert
4f378d75aa Convert more versions in config to ApiLevel.
The test case I removed is invalid. The codename has had its int
assigned, but the config claims it is not final.

If this ever does need to be supported it's just a matter of making
sure the Q -> 29 mapping (or whatever) in the finalized codenames map
in android/api_levels.go.

Test: treehugger
Bug: http://b/154667674
Change-Id: I4f42ec2fd4a37750519ee3937938a1c65b6bb1e8
2020-09-22 16:01:56 -07:00
Dan Albert
0b176c8038 Replace FutureApiLevel with an ApiLevel.
Keeping the int constant around for now as FutureApiLevelInt because
it's still useful in places that haven't adopted ApiLevel yet for
testing if their non-ApiLevel API level is current or not.

Test: treehugger
Bug: http://b/154667674
Change-Id: I47a7012703f41fdeb56f91edf9c83afa93042deb
2020-09-22 15:04:48 -07:00
Dan Albert
c8060536e8 Replace ApiStrToNum uses with ApiLevel.
Test: treehugger
Bug: http://b/154667674
Change-Id: I2954bb21c1cfdeb305f25cfb6c8711c930f6ed50
2020-09-22 15:04:48 -07:00
Treehugger Robot
5fc50f2936 Merge "Fix proguard_usage.zip with USE_RBE=true RBE_R8=true" 2020-09-22 17:59:40 +00:00
Aurimas Liutikas
4c5efde049 Suppress reflection warnings when running metalava
Intellij PSI/UAST reflects into java.base causing
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/mnt/ssd1/out/master/soong/host/linux-x86/framework/metalava.jar) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Upstream bug https://youtrack.jetbrains.com/issue/IDEA-210683

Bug: 168689341
Test: make checkapi
Change-Id: Ibc8954d83d5962b3cd0ea1bac9a62f6ccfc88c6c
2020-09-21 11:35:10 -07:00
Anton Hansson
a2adc37fc9 Make hiddenapi use prebuilt stubs when it should
Bug: 160455085
Test: build_unbundled_mainline_module.sh (with disabled source-stubs)
Test: hiddenapi_singleton_test.go
Change-Id: Id93c974351b3f8efdf8e4efe4192d3809f4fcaa5
2020-09-18 08:06:58 -07:00
Colin Cross
e00c0e795d Fix proguard_usage.zip with USE_RBE=true RBE_R8=true
proguard_usage.zip contained an empty unused.txt file when
the unused.txt file wasn't specified as an output of the r8
rule.

Test: m USE_RBE=true RBE_R8=true out/soong/.intermediates/frameworks/base/packages/Shell/Shell/android_common/proguard_usage.zip
Change-Id: Ie6a7c8b2581fe21d643e675143d6cc0e2ce80456
2020-09-17 18:56:43 +00:00
Treehugger Robot
0fe609075d Merge "Make robolectric runtimes a host module" 2020-09-16 23:23:08 +00:00
Colin Cross
5aa29a7fc2 Make robolectric runtimes a host module
I931f9145f1ced21a9f86d647cfbb6d2b645b4f18 made robolectric_android-all-stub
empty, breaking running robolectric tests packaged by Soong.
To enable using robolectric-host-android_all instead, make the
runtimes module a host module.

Also remove the empty robolectric_android-all-stub dependency.

Test: m checkbuild
Change-Id: Idc158d84fd8b6d98d824a6bdc8be297ac43ec2f2
2020-09-15 11:26:12 -07:00
Liz Kammer
6b5430203c Merge "Updates checkapi filename properties behavior" 2020-09-14 17:55:17 +00:00
Liz Kammer
88d593d942 Merge "Add hidden_api for java_import" 2020-09-14 13:57:09 +00:00
Ulyana Trafimovich
2fc25bbd4c Merge changes from topic "uses-libs-21"
* changes:
  Treat "org.apache.http.legacy" as optional <uses-library> by default.
  Consistently use default install path for compatibility <uses-library>.
2020-09-14 09:18:39 +00:00
Treehugger Robot
570b81ab01 Merge "Remove framework-modules naming scheme" 2020-09-11 19:58:16 +00:00
Paul Duffin
ee9ad5d526 Remove framework-modules naming scheme
The naming_scheme property was not removed as it may be useful for
future when migrating to java_sdk_library.

Bug: 168301990
Test: m nothing
Change-Id: Ie97dd60355a207f1312a2dd910f1fb25b46fd737
2020-09-11 16:09:15 +01:00
Liz Kammer
9ed7915f01 Updates checkapi filename properties behavior
Previously Api_filename and Removed_api_filename were treated as
booleans based on whether they were non-empty, the supplied filenames
are used.

Test: go tests
Test: m
Bug: 143135631

Change-Id: I72c86eaf3b314eb2eb3afd0b2acf7d4b102ddb03
2020-09-11 07:49:45 -07:00
Ulya Trafimovich
663dc53c94 Consistently use default install path for compatibility <uses-library>.
Previously default install path was provided only for comatibility
libraries that are added explicitly via `uses_libs`/`optional_uses_libs`
properties. This didn't take into account compatibility libraries that
are added by Soong when it computes transitive closure of SDK library
dependencies. As a result, install path in such cases remained unknown,
and the corresponding compatibility library was omitted from class
loader context, which caused 'ClassLoaderContext shared library size
mismatch' errors at first boot on device.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: If661272f46803299c8640f7f5ef161c8217d07e4
2020-09-11 11:31:22 +01:00
Treehugger Robot
b900066dab Merge "Add support for building with R8 full mode" 2020-09-10 22:41:42 +00:00
Treehugger Robot
b8e35ca4a4 Merge "Revert "Revert "Remove create_stubs and checkapi from droiddoc""" 2020-09-10 20:52:55 +00:00
Christoffer Quist Adamsen
f2d7b16dd6 Add support for building with R8 full mode
Change-Id: Ibb6fd64e8901cb4311b29b3bbb266ec8fd1835c9
Test: make external/libtextclassifier
2020-09-10 21:24:57 +02:00
Xin Li
80dc4f137a Merge "Merge Android R" 2020-09-10 17:22:09 +00:00
Liz Kammer
e1ab250ec8 Revert "Revert "Remove create_stubs and checkapi from droiddoc""
This reverts commit 3666c7023f.

Reason for revert: This was originally reverted because it caused a breakage (b/167405890) in a branch that is no longer relevant.

Change-Id: I81063cd47b816b5b3c0ab8427432730d6b881a3f
2020-09-10 15:29:25 +00:00
Liz Kammer
5ca3a6293e Add hidden_api for java_import
Test: go java tests
Test: m
Bug: 160455085
Change-Id: Ib6e826e32ca73ceea0799b26145ad06b1e62a1bf
2020-09-10 07:56:03 -07:00
Ulyana Trafimovich
79a94a27b6 Merge "Replace is_uses_lib property with provides_uses_lib." 2020-09-10 14:34:20 +00:00
Ulya Trafimovich
54027b572e Replace is_uses_lib property with provides_uses_lib.
The previous property was boolean-valued and provided only the
information whether the library should be treated as <uses-library>
by Soong. The new property is an optional string, which is the name of
the <uses-library>. The name can be different from the module name, as
in the case of "qcrilhook" module which provides <uses-library>
"com.qualcomm.qcrilhook".

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I65b68e6f7c420ab9c443a76de4c917d31fcd8c8f
2020-09-10 10:47:41 +01:00
Kousik Kumar
3e0b9c031c Merge "Check UseRBE is set before replacing any template with the RE version." 2020-09-10 09:24:17 +00:00
kellyhung
af286f3312 Add test_mainline_module option. am: 74b00521f8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1402513

Change-Id: I4824247226e786363cf94815576a93da3deb73da
2020-09-09 08:06:35 +00:00
kellyhung
74b00521f8 Add test_mainline_module option.
Bug: 165425972

Test: m HelloWorldTests
Change-Id: I6e60b3895328c4f7aef0bfb30dcdefc30ee1d8ed
2020-09-09 02:15:39 +00:00
Treehugger Robot
9ef1f7d96a Merge "Don't assume host arch is always x86" am: daf735287b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1415953

Change-Id: I049556891890833c1e7db6483e5ee6446714583e
2020-09-09 00:32:18 +00:00
Treehugger Robot
daf735287b Merge "Don't assume host arch is always x86" 2020-09-09 00:13:50 +00:00
Ulyana Trafimovich
0f13eff149 Merge "Be more strict about unknown install <uses-library> paths." am: 117a5ef307
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1418529

Change-Id: Ib28e902e7f8ec57a15ef50692024cd37a96696bc
2020-09-08 15:34:50 +00:00
Jiyong Park
87788b5247 Don't assume host arch is always x86
This change fixes some places where host arch is assumed to be x86 to
form a path element like linux-x86. In preparation for non-x86 host
targets, the host arch part is derived from the context.

In addition, InstallForceOS() is refactored so that it can override not
only OsType, but also ArchType. Without this, the paths for the
robolectic modules will be changed from linux-x86 to linux-common, which
breaks several other places where the old paths are expected.

Bug: 134795810
Test: m
Change-Id: Ib38c715948ae546e55021ece82bac1d82e9e5da0
2020-09-08 15:12:10 +09:00
Ulya Trafimovich
045e11ad0d Be more strict about unknown install <uses-library> paths.
Allow default install paths only for compatibility libraries. For other
libraries that are explicitly specified in `uses_libs` and
`optional_uses_libs` unknown install path should be an error.

Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I2209c90a939a8aa46c42e13bb42d09c07e4d0895
2020-09-07 13:58:51 +01:00
Ulyana Trafimovich
99bd329274 Merge "Allow non-SDK Java libraries to masquerade as <uses-library>." am: bb3467d297
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1417188

Change-Id: If25aaa0174091e966cc5c6b16063b6486a7b4ab6
2020-09-07 10:23:53 +00:00
Ulyana Trafimovich
bb3467d297 Merge "Allow non-SDK Java libraries to masquerade as <uses-library>." 2020-09-07 09:49:07 +00:00
Treehugger Robot
da55e8208f Merge "Iterate <uses-library> in deterministic order in manifest_fixer." am: bfb98ece49
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1418533

Change-Id: I42df02457960f99d3257d131524d8005e2c7a97e
2020-09-04 01:17:25 +00:00
Treehugger Robot
bfb98ece49 Merge "Iterate <uses-library> in deterministic order in manifest_fixer." 2020-09-04 00:45:48 +00:00
Treehugger Robot
48e2acaf99 Merge "Add imports_compile_dex to prebuilt_apis" am: cda9a92efb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1418868

Change-Id: I29a69d3fd58d9bd7d02ad27fc5b9b9b54b633f63
2020-09-04 00:05:40 +00:00
Ulya Trafimovich
d2c7ddc82a Iterate <uses-library> in deterministic order in manifest_fixer.
Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: Ideb7e0f7beae8c80561f841b8ce9129003f1aa96
2020-09-03 15:52:01 +01:00
Ramy Medhat
16f23a4038 Check UseRBE is set before replacing any template with the RE version.
Test: presubmit
Change-Id: I6df58b4e700f0d231367af2710672d731d20a736
2020-09-03 01:29:49 -04:00
Liz Kammer
4e7f2607ed Add imports_compile_dex to prebuilt_apis
Allows specifying compile_dex for java_import modules generated by
prebuilt_apis.

Bug: 160455085
Test: m sdk_public_current_android
Change-Id: Id316ba740577b2c9c0522368c01072864cda6cca
2020-09-02 09:27:35 -07:00
Anton Hansson
847ca7514e Merge "Change sdk_library child visibility semantics" am: 3652018b83
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1416192

Change-Id: I6d013916d33618dab06447fbfd7ee0d9e2d09d7a
2020-09-02 15:56:58 +00:00
Anton Hansson
3652018b83 Merge "Change sdk_library child visibility semantics" 2020-09-02 14:13:49 +00:00
Anton Hansson
e0b81e4472 Merge "java_sdk_library: Add annotations_enabled property" 2020-09-02 11:36:35 +00:00
Paul Duffin
e22c2ab14b java_sdk_library: Add annotations_enabled property
Passes it through to droidstubs.

Bug: 155164730
Test: m droid
Change-Id: I8b23a959ce33716dfc4572488a1fd3f6bab73a17
Merged-In: I8b23a959ce33716dfc4572488a1fd3f6bab73a17
(cherry picked from commit 2ce1e81b3e)
2020-09-02 11:30:54 +01:00
Jooyung Han
4c92cad10e Merge commit '0703fd873fe2ed492266a4457a1e217971c2f4f0' into manual_merge_1e3d9fb376aaf1be6de1bd16a9004ccc95226ab0
Change-Id: I7115a50254e23e3f7d9cdab960c671195746978e
2020-09-02 14:19:18 +09:00
Jooyung Han
3a92fbeaff Merge "apex: support prebuilt_firmware for vendor apexes" 2020-09-02 04:17:43 +00:00
Treehugger Robot
6346ec0f46 Merge "Add compile_dex for java_import" am: e263af74db
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1392497

Change-Id: I9fbbd7e1f02a64f5e0ed9b583a61e64fd4306362
2020-09-02 02:02:32 +00:00
Treehugger Robot
e263af74db Merge "Add compile_dex for java_import" 2020-09-02 01:23:54 +00:00
Liz Kammer
d6c31d274e Add compile_dex for java_import
Test: go java tests
Test: m
Bug: 160455085
Change-Id: I2db95dfe565e78b630007adc3360a58614d0127e
2020-09-01 12:34:08 -07:00
Steve Kim
3666c7023f Revert "Remove create_stubs and checkapi from droiddoc"
This reverts commit 3a55c91f9d.

Reason for revert: build failed. Guess this is the cause but needs to confirm. Creating a revert per instructions

Change-Id: I30f1c8cd63e5ab84dba5d21ed354a42695c24ec4
2020-09-01 17:58:01 +00:00
Ulya Trafimovich
21a7375205 Allow non-SDK Java libraries to masquerade as <uses-library>.
Extend usesLibraryProperties with a boolean is_uses_lib property and
move these properties from java.AndroidApp to java.Module to allow
java.Library modules set the new propery and be recognized as
<uses-library> by Soong.

Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I01cd5e0da3dd543c1c0597249d37d0914b213ca7
2020-09-01 17:45:39 +01:00
Anton Hansson
944e77d219 Change sdk_library child visibility semantics
If specified, the more specific *_visibility attribute override the
visibility attribute.

This is a temporary solution local to java_sdk_library. Ideally this
should be applied to all modules that create child modules.

Bug: 165017290
Test: m
Change-Id: Ia8c5ae119623a83d8ac583c602320915bb8c7f33
2020-09-01 15:17:41 +01:00
Jooyung Han
0703fd873f apex: support prebuilt_firmware for vendor apexes
prebuilt_firmware module is one of many prebuilt_etc-like modules. When
it is soc-specific, it is installed in /vendor/firmware. Similarly, when
prebuilt_firmware is embeded in a vendor apex, installing it in
<apex>/firmware instead of <apex>/etc.

Bug: 162701747
Test: lunch sunfish-userdebug
      m && device boots && vibrator works
Change-Id: I00d28cde42259aaf8221e3897df77efc42b0c1ca
2020-09-01 10:45:13 +09:00
Liz Kammer
3a55c91f9d Remove create_stubs and checkapi from droiddoc
Test: m docs
Test: go java tests
Bug: 144248501
Bug: 143136634
Change-Id: Ic0da89332f3ed2e5e1bb36d00cb9cbd1f6282b45
2020-08-31 08:16:22 -07:00
Xin Li
65cb5c69ea Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Ifca7b65f4e27bf14cdc30f72f790b0de90130bae
Change-Id: I3a39be5f0b8736de4822c6a14072c78d4e4ad89d
2020-08-29 01:17:45 -07:00
Ulyana Trafimovich
b8822a0616 Merge "Propagate transitive SDK Java library dependencies to dexpreopt." 2020-08-28 09:36:13 +00:00
Jeongik Cha
219141c6bb Introduce BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES
If BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES has a numeric value,
it replaces "current" or "system_current" with the version which
the flag indicates.

Bug: 163009188
Test: BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES=29 m, and then check if every vendor
java module's sdk_version is 29 if its sdk_version was current.

Change-Id: I17b49b8e02caf2d1bc57b91648d4420f3ad9fcb9
2020-08-27 23:09:54 +09:00
Ulya Trafimovich
fc24ad3d4e Propagate transitive SDK Java library dependencies to dexpreopt.
For some dependencies, like stubs, the SDK library may not be found at
build time (either because the implementation library is not among the
dependencies of the dexpreopted module, or because it's part of a
prebuilt, or because it's missing from the build altogether). In such
cases dexpreopt is useless, because dex2oat does not have access to the
full classpath (unless the &-classpath is used). Therefore do not
dexpreopt in such cases.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: If289088cfd103011ccb16165e95a97b30fd31b81
2020-08-27 11:47:15 +01:00
Treehugger Robot
4c2e4f381a Merge "Support ninja rsp files in soong_zip" 2020-08-24 18:40:56 +00:00
Liz Kammer
9c07d24477 Merge "Add imports_sdk_version to prebuilt_apis" 2020-08-24 16:50:51 +00:00
Treehugger Robot
ec7a91f9fa Merge "Add extra_test_configs option" 2020-08-21 16:22:43 +00:00
Treehugger Robot
f5a2b8a641 Merge "Remove duplicated use of UsesLibraryDependency" 2020-08-21 10:01:58 +00:00
Ulyana Trafimovich
49b1e9b6ce Merge "Use common helper functions for getting sorted map keys." 2020-08-21 09:36:30 +00:00
Ulyana Trafimovich
bde92fc6be Merge "Propagate transitive <uses-library> dependencies through static libraries." 2020-08-21 09:36:10 +00:00
Treehugger Robot
68bfe074c6 Merge "Reland: Deduplicate APEX variants that would build identically" 2020-08-21 06:46:51 +00:00
Treehugger Robot
c23d6031b0 Merge "Capture list of unused methods when shrinking in R8" 2020-08-21 00:28:24 +00:00
Liz Kammer
9b7ecd76f5 Remove duplicated use of UsesLibraryDependency
This was resulting in a soong java test failure:
./java.go:994:80: ambiguous selector dep.DexJarBuildPath
./java.go:994:103: ambiguous selector dep.DexJarInstallPath
./java.go:2595:58: ambiguous selector dep.DexJarBuildPath
./java.go:2595:81: ambiguous selector dep.DexJarInstallPath
./sdk_library.go:879:2: duplicate method DexJarBuildPath
./sdk_library.go:879:2: duplicate method DexJarInstallPath

Test: go test java tests
Test: m
Change-Id: I34465907f917d94be643be7322215fc35fc5fbe6
2020-08-20 13:50:42 -07:00
Liz Kammer
2d2fd859bb Add imports_sdk_version to prebuilt_apis
This allows setting the prebuilt sdk's generated java_imports
sdk_version to "none".

Test: go tests
Test: m
Bug: 160455085
Change-Id: Id24aca811f0f09692971e63418da6685d8351737
2020-08-20 09:48:50 -07:00
Ulya Trafimovich
b8063c6a86 Use common helper functions for getting sorted map keys.
Add a new helper SortedIntKeys similar to SortedStringKeys.

Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: I08a43ec2cae7d1a82531295aca1a0658e3a0dd6f
2020-08-20 12:37:03 +01:00
Ulya Trafimovich
4b6d4c12cc Propagate transitive <uses-library> dependencies through static libraries.
Bug: 163037089
Test: lunch aosp_cf_x86-userdebug && m nothing
Test: added testcase in Soong
Change-Id: I943d497d779ca218a16e7208029189a1a69086c1
2020-08-20 12:34:42 +01:00
Ulyana Trafimovich
9ce2221791 Merge "Collect paths to transitive SDK Java library dependencies." 2020-08-20 10:37:58 +00:00
Joseph Murphy
bc98d2ffe8 Adds a workaround to fix version inconsistency
frameworks/base still has the tree on R while the build system considers
current development to be S which causes issues when Robolectric goes
looking for an R jar but instead finds an S jar.  Therefore, for the
moment, we are hardcoding this to be tagged as R. In the future,
hopefully these two sources of truth can be aligned better.

Bug: b/157635117
Test: N/A or manual
Change-Id: I7495735b1c6c4369408bdf8805f59fad6aac5128
2020-08-20 00:45:45 +00:00
Dan Shi
95d19422a6 Add extra_test_configs option
Bug: 163344047
Test: m -j HelloWorldHostTest hello_world_test HelloWorldTests
Change-Id: I237e3aa3f40df1f6387ba8ff6a16e56535cdeae9
2020-08-19 15:27:03 -07:00
Colin Cross
053fca10c9 Support ninja rsp files in soong_zip
Add a -r argument to soong_zip that reads a list of files from a file
like the -l argument but treats it as a Ninja rsp file with escaping.
Replace the -l arguments in Soong that are using rsp files with -r.

Fixes: 162435077
Test: TestReadRespFile, TestZip
Change-Id: I4605312e99406ab1bd0c37af9c5ad212393f0403
2020-08-19 21:18:56 +00:00
Colin Cross
cb6143a142 Capture list of unused methods when shrinking in R8
Use the -printusage flag in R8 to output a list of the unused
methods.  Some of the files can be large (2MB for DocumentsUI,
87MB for all of AOSP), so immediately zip them and remove the
originals.  The zipped files will be merged and disted.

Bug: 151857441
Test: m TARGET_BUILD_APPS=DocumentsUI dist
Change-Id: I780e84e80eba7fe4d4fa15fec0f461890afd900b
2020-08-19 11:19:14 -07:00
Colin Cross
aede88c1c7 Reland: Deduplicate APEX variants that would build identically
APEX variants that share the same SDK version and updatability
almost always use identical command line arguments to build but
with different intermediates directories.  This causes unnecessary
build time and disk space for duplicated work.

Deduplicate APEX variants that would build identically.  Create
aliases from the per-APEX variations to the new shared variations
so that the APEX modules can continue to depend on them via the
APEX name as the variation.

This has one significant change in behavior.  Before this change,
if an APEX had two libraries in its direct dependencies and one
of those libraries depended on the other, and the second library
had stubs, then the first library would depend on the implementation
of the second library and not the stubs.  After this change, if
the first library is also present in a second APEX but the second
library is not, then the common variant shared between the two
APEXes would use the stubs, not the implementation.

In a correctly configured set of build rules this change will
be irrelevant, because if the compilation worked for the second
APEX using stubs then it will work for the common variant using
stubs.  However, if an incorrect change to the build rules is
made this could lead to confusing errors, as a previously-working
common variant could suddenly stop building when a module is added
to a new APEX without its dependencies that require implementation
APIs to compile.

This change reduces the number of modules in an AOSP arm64-userdebug
build by 3% (52242 to 50586), reduces the number of variants of the
libcutils module from 74 to 53, and reduces the number of variants
of the massive libart[d] modules from 44 to 32.

This relands I0529837476a253c32b3dfb98dcccf107427c742c with a fix
to always mark permissions XML files of java_sdk_library modules as
unique per apex since they contain the APEX filename, and a fix
to UpdateUniqueApexVariationsForDeps to check ApexInfo.InApexes
instead of DepIsInSameApex to check if two modules are in the same
apex to account for a module that depends on another in a way that
doesn't normally include the dependency in the APEX (e.g. a libs
property), but the dependency is directly included in the APEX.

Bug: 164216768
Test: go test ./build/soong/apex/...
Change-Id: I2ae170601f764e5b88d0be2e0e6adc84e3a4d9cc
2020-08-19 10:21:17 -07:00
Ulya Trafimovich
31e444e101 Collect paths to transitive SDK Java library dependencies.
Previously only the names were collected, and later used in the
manifest_fixer to add missing <uses-library> entries to the manifest.
Now we also need to collect build-time and on-device paths, to be used
in class loader context for dexpreopt. This commit only collects paths,
but does not pass them to dexpreopt yet.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I34b229ee68f16ba215ba03770feadb4d890ec2bf
2020-08-19 13:51:21 +01:00
Treehugger Robot
fc4d79598c Merge "Revert "Deduplicate APEX variants that would build identically"" 2020-08-18 17:19:40 +00:00
Pete Bentley
0c7b26e0e2 Revert "Deduplicate APEX variants that would build identically"
This reverts commit d6b2525b00.

Reason for revert: <Breaks tests - confirmed by Forrest: b/165188843>

Change-Id: I7cb68cb87522415004390c0672dc774e0067b122
2020-08-18 13:44:59 +00:00
Anton Hansson
85f59b7b54 Merge "Remove special-cased stub deps on framework-res" 2020-08-18 11:58:57 +00:00
Anton Hansson
72ce814def Merge "Add a tagged output for app's exportPackage" 2020-08-18 11:38:46 +00:00
Treehugger Robot
ca29a25d38 Merge "Deduplicate APEX variants that would build identically" 2020-08-18 04:50:12 +00:00
Treehugger Robot
90905c0c68 Merge "Make the default exec strategy for javac/r8/d8 remote local fallback." 2020-08-18 00:54:03 +00:00
Colin Cross
d6b2525b00 Deduplicate APEX variants that would build identically
APEX variants that share the same SDK version and updatability
almost always use identical command line arguments to build but
with different intermediates directories.  This causes unnecessary
build time and disk space for duplicated work.

Deduplicate APEX variants that would build identically.  Create
aliases from the per-APEX variations to the new shared variations
so that the APEX modules can continue to depend on them via the
APEX name as the variation.

This has one significant change in behavior.  Before this change,
if an APEX had two libraries in its direct dependencies and one
of those libraries depended on the other, and the second library
had stubs, then the first library would depend on the implementation
of the second library and not the stubs.  After this change, if
the first library is also present in a second APEX but the second
library is not, then the common variant shared between the two
APEXes would use the stubs, not the implementation.

In a correctly configured set of build rules this change will
be irrelevant, because if the compilation worked for the second
APEX using stubs then it will work for the common variant using
stubs.  However, if an incorrect change to the build rules is
made this could lead to confusing errors, as a previously-working
common variant could suddenly stop building when a module is added
to a new APEX without its dependencies that require implementation
APIs to compile.

This change reduces the number of modules in an AOSP arm64-userdebug
build by 3% (52242 to 50586), reduces the number of variants of the
libcutils module from 74 to 53, and reduces the number of variants
of the massive libart[d] modules from 44 to 32.

Bug: 164216768
Test: go test ./build/soong/apex/...
Change-Id: I0529837476a253c32b3dfb98dcccf107427c742c
2020-08-17 15:18:31 -07:00
Treehugger Robot
51636c0ae9 Merge "Rename class2greylist" 2020-08-17 16:33:21 +00:00
Anton Hansson
8f903f30ff Remove special-cased stub deps on framework-res
This dep is now possible to express in native Android.bp syntax,
which makes the build easier to understand.

Bug: 161214753
Test: build sdk, diff out/dist before and after
Change-Id: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce
Merged-In: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce
2020-08-17 11:00:03 +01:00
Anton Hansson
092aca410f Add a tagged output for app's exportPackage
This allows the android stubs to depend on framework-res' exportPackage
without special-casing inside the build system.

Bug: 161214753
Test: depending on this output in a followup CL
Change-Id: I8c5d17540d2624974983d73e56ba17898505dba8
2020-08-17 11:00:00 +01:00
Treehugger Robot
a07777d434 Merge "Rename ApexName to ApexVariationName" 2020-08-15 06:43:52 +00:00
Colin Cross
e07f2316b7 Rename ApexName to ApexVariationName
In preparation for reusing the same variation for multiple apexes,
rename ApexName to ApexVariationName.

Bug: 164216768
Test: all soong tests
Change-Id: I88f2c5b192ffa27acd38e01952d0cefd413222a0
2020-08-13 17:50:29 -07:00
Colin Cross
a24b9deb5f Merge changes I02fb745a,Iccc96c0d
* changes:
  Follow all shared library dependencies when collecting JNI libraries
  Handle static unwinder in ltoDepsMutator
2020-08-13 21:55:53 +00: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
Ramy Medhat
2889166b6c Make the default exec strategy for javac/r8/d8 remote local fallback.
Test: presubmits
Change-Id: Ia67c2a1e13638db1fb9c93755ce72159767d46b4
2020-08-13 11:41:35 -04:00
Treehugger Robot
fd5978a473 Merge "Increase heap size for lint tool" 2020-08-12 22:07:18 +00:00
Treehugger Robot
50a58067e6 Merge "Stop using prebuilt NDK CRT objects." 2020-08-12 22:01:27 +00:00
Andrei-Valentin Onea
d89374c5a7 Merge "Rename hiddenapi csv artifact" 2020-08-12 17:08:10 +00:00
Dan Albert
92fe740677 Stop using prebuilt NDK CRT objects.
We don't need the prebuilt versions. The NDK CRT objects are (now)
built from the platform sources and the only difference is that the
NDK CRT objects also include an ELF note that identifies the NDK
version, which isn't helpful for anything built by the platform.

Add a `crt` property to cc_object that allows CRT objects to identify
themselves. CRT objects, unlike other modules, will have a variant
built per-API level they support, rather than just an SDK variant and
a platform variant. This is needed because new CRT objects will rely
on APIs not available in old libcs and old CRT objects will not
support all the features of a modern one.

Test: treehugger
Bug: http://b/159925977
Change-Id: I6595485fa1bfe0ad4945193d344b863f64eec654
2020-08-11 15:06:55 -07:00
Dan Willemsen
9f43597ff7 Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.

Adds a bpfix rule so that we can eventually remove the
product_variables.pdk definition, which is now always a no-op.

Test: treehugger
Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7
Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
2020-08-11 01:11:44 +00:00
Andrei Onea
47841973b2 Rename hiddenapi csv artifact
Use a more inclusive terminology (go/hiddenapi-list-renaming).

Bug: 162844296
Test: m
Change-Id: I9feea8f9d8e88977d949dfe4dcbd7e72bf77a451
2020-08-10 17:23:52 +01:00
Jingwen Chen
fc16b6684e Merge "Fix droiddoc disting when WITHOUT_CHECK_API is true." 2020-08-10 05:22:24 +00:00
Jeongik Cha
6df337255c Merge "Introduce AlwaysUsePrebuiltSdks" 2020-08-10 00:51:56 +00:00
Treehugger Robot
7189f5d1e2 Merge "Merge libs/ directory of imported aars into classes.jar" 2020-08-08 00:51:38 +00:00
Colin Cross
205e91183e Merge libs/ directory of imported aars into classes.jar
AARs can provide extra classes in the libs/ directory that should
be treated the same as classes.jar, merge them into a single jar
when extracting the AAR.

Bug: 162892721
Test: m androidx.appsearch_appsearch
Change-Id: I92bf46f47ce5f3dce16c42197c15ed256304fda2
2020-08-07 14:07:23 -07:00
Jeongik Cha
816a23a50d Introduce AlwaysUsePrebuiltSdks
Instead of UnbundledBuild, use AlwaysUsePrebuiltSdks
to determine if java modules needs to be built against prebuilt sdks.
And rename UnbundledBuildUsePrebuiltSdks to AlwaysUsePrebuiltSdks to
express its behavior more correctly.(It can be orthgonal to "Unbundled")

Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage

Change-Id: I0be7265c1959d8774c295372cd7a9250169f6df9
2020-08-07 12:15:52 +09:00
Ulyana Trafimovich
910eb70891 Merge "Add structured representation for colon-separated jar lists." 2020-08-06 15:07:27 +00:00
Colin Cross
2eddd06879 Merge "Add libraryDependencyTag to track dependencies on static and shared libraries" 2020-08-06 00:06:28 +00:00
Liz Kammer
9c55b0efa2 Merge "Add property api_levels_jar_filename to droidstubs" 2020-08-05 19:05:13 +00:00
Liz Kammer
9eb51fc9d4 Merge "Refactor java compileDex" 2020-08-05 15:41:03 +00:00
Ulya Trafimovich
249386ad69 Add structured representation for colon-separated jar lists.
With the addition of apexes and /system_ext some of the bootclasspath
and system server jars have moved from /system to the new locations.
This has been implemented by using lists of colon-separated strings
called "apex-jar pairs" (although "apex" was misleading as it could
refer to "platform" or "system_ext", not necessarily a real apex).

Using the colon-separated string representation is inconvenient, as it
requires splitting and reassembling the list components many times,
which harms performance and makes error handling difficult. Therefore
this patch refactors the colon-separated lists into a struct that
hides the implementation details.

Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Id248ce639a267076294f4d4d73971da2f2f77208
2020-08-05 09:59:30 +01:00
Liz Kammer
a7a64f3c5b Refactor java compileDex
We want to support a compile_dex property for java_import. This splits
dex-related properties into a dexer struct which can be embedded in
relevant modules.

Test: m
Test: soong tests
Bug: 160455085
Change-Id: If56a51dac43f630d49483a36db29cd50e9ccd529
2020-08-04 10:15:04 -07:00
Liz Kammer
3d894b728a Add property api_levels_jar_filename to droidstubs
The default is android.jar to maintain current behavior but allows users
to specify a different filepath to support generating api-versions for
docs other than the platform (e.g. auto).

Bug: 162552181
Test: m doc
Test: go test java_test
Change-Id: I9e51abaf7d5451d68ca782157d9b739f76c5da82
2020-08-04 09:55:13 -07:00
Andrei Onea
ca79081bde Rename hiddenapi manual lists
Use new names for lists from go/hiddenapi-list-renaming
Bug: 162827370
Test: m

Change-Id: I9522f32faa46d1d49aefad0921ba6d9c427d8779
2020-08-04 15:34:35 +01:00
Treehugger Robot
cf04073b43 Merge "Update language to comply with inclusive guidance" 2020-07-31 22:50:49 +00:00
Treehugger Robot
703ea006e0 Merge "Default to not creating stubs for droiddoc" 2020-07-31 19:32:11 +00:00
Liz Kammer
1e2ee12ff4 Default to not creating stubs for droiddoc
This will allow us to remove `create_stubs: false` throughout the
codebase easily, then remove the functionslity to create stubs from
droiddoc.

Test: m docs
Test: m checkapi
Test: m updateapi
Bug: 144248501
Bug: 143136634

Change-Id: Ib95f68bc064fbe1475e4b25433bee6292bc005dc
2020-07-31 10:11:25 -07:00
Paul Duffin
021f4e525f Fix prebuilt mutator ordering in tests
Previously, the prebuilt mutators were added by the
cc.RegisterRequiredBuildComponentsForTest() function as a convenience
but unfortunately it lead to some of the mutators being in a different
order in the tests than in the normal build.

This change:
* Extracts the RegisterPrebuiltMutators() call from
  cc.RegisterRequiredBuildComponentsForTest()
* Makes sure that the prebuilt mutators are registered before the
  visibility gatherer and enforcer mutators.

Bug: 162505935
Test: m nothing
Change-Id: I7d959b558200b502f0a5e4653c41ea01414e142a
2020-07-31 16:12:01 +01:00
Andrei-Valentin Onea
01124262f0 Merge "Update language to comply with Android's inclusive language guidance" 2020-07-30 12:09:00 +00:00
Colin Cross
f0913fb0a0 Follow all shared library dependencies when collecting JNI libraries
The implementation before libraryDependencyTag was added failed to
include some JNI libraries into apps because it did not handle
sharedExportDepTag, earlySharedDepTag or lateSharedDepTag.

Also fix a bug in cc.*Module.IsNdk that was comparing "liblog.ndk"
against "liblog" and incorrectly returning false that would have
caused NDK libraries that now pass the check above to incorrectly be
packaged into the APK.

Bug: 162437057
Test: m checkbuild
Change-Id: I02fb745abb5cace2b4e5bfff2f35cef6d2e0a4ff
2020-07-29 13:22:33 -07:00
Colin Cross
6e511a9a9f Add libraryDependencyTag to track dependencies on static and shared libraries
dependencyTag uses a set of predefined tags to identify different types
of dependencies.  There are already multiple bits of metadata stored
in the dependency tag (Library, Shared, ReexportFlags), and supporting
them all requires a combinatorial explosion of predefined tags and
causes issues when using equality comparisons if a new bit of metadata
is added.

Add a new libraryDependencyTag type that will contain the metadata
bits, and replace the quality comparisons with checks on the metadata
bits.

There are 5 TODOs where modifying the checks identified problems with
the existing checks.  These were left in place to produce identical
build output and will be fixed separately.

Bug: 162437057
Test: no change to build.ninja or {Android,make_vars,late}-${TARGET_PRODUCT}.mk
Change-Id: I72d4207dcf381c07c92e00e5a03968ebb5ed8d30
2020-07-29 13:22:30 -07:00
Aleksei Kalinov
f0f5cdc1cc Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for
reference.

Bug: 161896447
Test: ran `m`.
Change-Id: If5ec29482911c281bc1c4bf2cfc84b2f05c2240d
2020-07-29 15:49:05 +00:00
Treehugger Robot
0ebab772f5 Merge "Update language to comply with inclusive guidance" 2020-07-29 03:41:51 +00:00
Treehugger Robot
3d8e506c3a Merge "Inclusive fix: Replace sanity to validation in java/sdk.go" 2020-07-28 23:39:20 +00:00
Liz Kammer
cada807a92 Update language to comply with inclusive guidance
Update android_app_set to use word install rather than master for
android_app_sets, this better matches the phrasing used for apex_set.

See https://source.android.com/setup/contribute/respectful-code for
reference

Bug: 161896447
Test: m nothing
Change-Id: I429e7f8b16c42c10ad4d9543110f5ce814a893b1
2020-07-28 15:47:38 -07:00
Liz Kammer
7941b30c67 Update language to comply with inclusive guidance
See https://source.android.com/setup/contribute/respectful-code for
reference

Bug: 161896447
Test: m nothing
Change-Id: I13f42b680c6b819a2708c973e7718267c121f862
2020-07-28 13:27:34 -07:00
Liz Kammer
20ebfb46fc Update language to comply with inclusive guidance
See https://source.android.com/setup/contribute/respectful-code for
reference

Bug: 161896447
Test: m nothing
Change-Id: Ie1d0d63d27f1b1b48680922b7202aa6df04f4696
2020-07-28 11:37:31 -07:00
Patrice Arruda
b481b87104 Inclusive fix: Replace sanity to validation in java/sdk.go
Bug: b/161896447
Test: "lunch 1" and "m nothing"
Change-Id: I8cbdec02dccd961a8cac92c6e957aeebd1e263c1
2020-07-28 18:30:44 +00:00
Jingwen Chen
7b27ca7dad Fix droiddoc disting when WITHOUT_CHECK_API is true.
When WITHOUT_CHECK_API=true, the droidstubs apiFile can be nil. Fix this
by defensively checking for nil paths when making the TaggedDistFiles,
and also in android.MakeDefaultDistFiles.

The error message reported in r.android.com/1335521 was:

"internal error: panic in GenerateBuildActions for singleton androidmk
  Dist file should not be nil for the default tag in
  android.net.ipsec.ike.stubs.source in translateAndroidMkModule for
  module android.net.ipsec.ike.stubs.source variant android_common"

Test: WITHOUT_CHECK_API=true m droid dist

Bug: 152834186
Signed-off-by: Jingwen Chen <jingwen@google.com>
Change-Id: I1b1f7c0b7a0e1c0ed5e15957d0162c47fd3ec197
2020-07-28 11:53:57 +00:00
Liz Kammer
dd849a81f3 Add data_native_bins property to java_test_host
When multiple os/arch variants are supported, java_test_host could not
find a matching arch due to java having arch:common, whereas native
binaries support a specific architecture. This change adds the property
`data_native_bins` in order to support binaries with the appropriate
os/arch variants.

Test: m FirmwareDtboVerification with data_native_bins
Test: forrest
Bug: 153848038
Change-Id: I45adebff0fde2811d5ef5620c697b97b768c951f
2020-07-27 09:14:06 -07:00
Treehugger Robot
13aa44fc15 Merge "Build transitive lint reports for apex modules" 2020-07-24 11:50:39 +00:00
Pete Gillin
9f4893d86f Add SettingsRoboTests to the allow-list for legacy core/platform API.
Bug: 161967461
Test: m SettingsRoboTests
Merged-In: I15e5a6c2f07e73718803501d705de0d7ab9bec90
Change-Id: If4e58fba5f74dd06457497c1d131bc1f273f6f5b
2020-07-23 12:34:07 +01:00
Pete Gillin
84c3807b99 Enforce the legacy core/platform API restriction.
This change silently decides whether modules which depend on either
sdkPrivate or sdkCorePlatform get the legacy or the stable version of
the core/platform API, based on whether the module's name is on a
hard-coded list or not.

Test: m java
Test: make a target from the list when its entry is commented out, which correctly fails
Bug: 157640067
Change-Id: I15e5a6c2f07e73718803501d705de0d7ab9bec90
Merged-In: I15e5a6c2f07e73718803501d705de0d7ab9bec90
Merged-In: Iaa97ddaa015e8079fcb3426585c5101c7ec9e22a
(cherry picked from commit c0f4373106)
2020-07-23 09:06:52 +01:00
Colin Cross
08dca38eb0 Build transitive lint reports for apex modules
Build and export transitive lint report zips for apex modules.

Bug: 153485543
Test: m TARGET_BUILD_APPS=com.google.android.wifi lint-check dist
Change-Id: I5a1805440452301a7e2c4ca91482b989638b54fb
2020-07-22 20:16:14 -07:00
Treehugger Robot
0bcda81dd5 Merge "Generate module lib API and scope together" 2020-07-21 04:21:07 +00:00
Treehugger Robot
30c22b9c7a Merge "Add dist target for robolectric-tests.zip" 2020-07-21 02:03:36 +00:00
Colin Cross
cf0e4220eb Add dist target for robolectric-tests.zip
Also remove stray fmt.Println.

Test: m robolectric-tests
Change-Id: Ia463c2b395fadd6ab33b2ce8364f2119b2a2be1e
2020-07-20 17:19:02 -07:00
Paul Duffin
15f34ef811 Generate module lib API and scope together
Previously, due to limitations in metalava the module lib API and stubs
source were generated separately. That limitation has since been
removed so this change optimizes the generating code.

Changes:
* Add an annotation field to apiScope to contain the annotation that
  identifies the scope.
* Rename droidstubArgs to extraArgs to better reflect that they are not
  passed to droidstubs.
* Rename droidstubsArgsForGeneratingStubsSource to droidstubsArgs.
* Remove droidstubsArgsForGeneratingApi and
  createStubsSourceAndApiTogether fields along with code that supports
  generating stubs source and the API separately.
* Fix the module lib test.

Test: m checkapi
Bug: 161364853
Change-Id: I821886bb68645addf5ae9c96ed2f4f3649151d1a
2020-07-20 20:51:25 +01:00
Colin Cross
dd35943b62 Merge "Add environment variables to control lint checks" 2020-07-20 18:50:09 +00:00
Colin Cross
f0ba57bf33 Merge "Package robolectric tests for tradefed" 2020-07-20 18:27:17 +00:00
Colin Cross
8eebb135b3 Package robolectric tests for tradefed
Package a slightly modified copy of the robolectric tests with
the dependencies statically included into the testcases directory
and into a robolectric-tests.zip.

Test: m robolectric-tests
Change-Id: I73f51727695136d2a849d36af1683e93f7e156a3
2020-07-19 19:33:40 -07:00
Makoto Onuki
d786b6bffe Merge "Repeat metalava errors at the end to make it easy to find them" am: d3cd2f5793 am: 0742acdc4b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1365957

Change-Id: Ifca7b65f4e27bf14cdc30f72f790b0de90130bae
2020-07-18 03:17:41 +00:00
Makoto Onuki
d3cd2f5793 Merge "Repeat metalava errors at the end to make it easy to find them" 2020-07-18 02:29:36 +00:00
Makoto Onuki
0df103ae71 Repeat metalava errors at the end to make it easy to find them
Also suppress "unresolved import" messages.

Bug: 161374683
Test: Introduce a lint error, run "m update-api" and make sure the
    error shows up at the end.
Change-Id: Ib5250f7f9593dc4f89f9e7f6dc614e230a966e8f
2020-07-17 15:38:10 -07:00
Liz Kammer
464e5f720c Merge "Add android app property rename_resources_package" into rvc-dev-plus-aosp 2020-07-17 16:56:04 +00:00
Colin Cross
988dfcc067 Add environment variables to control lint checks
Set ANDROID_LINT_CHECK to a comma-separated list of lint issues
that should be checked instead of the defaults.  This will disable
all lint checks and enable only the given list.

Set ANDROID_LINT_CHECK_EXTRA_MODULES to a list of modules that provide
lint checks that should added to all modules when ANDROID_LINT_CHECK
is specified.

Bug: 153485543
Test: m ANDROID_LINT_CHECK=JavaKotlinApiUsedByModule ANDROID_LINT_CHECK_EXTRA_MODULES=JavaKotlinApiFinder TARGET_BUILD_APPS=Gallery2 lint-check dist
Change-Id: Ifdf9bf972b8550104315b0f5e98b34ad699dcb67
2020-07-16 17:37:04 -07:00
Colin Cross
f5ada2c731 Merge changes from topic "lint-unbundled-apps" am: 70f0b53000 am: 8d984239e1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1360941

Change-Id: Ic1b7ec667b2f4ba2a3205ca372bf3afccffff1f3
2020-07-16 23:19:43 +00:00
Treehugger Robot
0add164d0e Merge "Pass unstripped JNI libraries to Make" am: bf81ed4fd1 am: 9a6d827dc3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1356262

Change-Id: I99a111aafcab5a8a8a5b704b9dd67904c93b0aea
2020-07-16 23:19:16 +00:00
Colin Cross
70f0b53000 Merge changes from topic "lint-unbundled-apps"
* changes:
  Build a zip of transitive lint reports for apps
  Add DepSets
2020-07-16 23:06:22 +00:00
Treehugger Robot
bf81ed4fd1 Merge "Pass unstripped JNI libraries to Make" 2020-07-16 22:43:53 +00:00
Colin Cross
c0efd1db13 Build a zip of transitive lint reports for apps
Add a rule to build a zip containing the lint reports from transitive
dependencies for apps, and pass it to Make.

Bug: 153485543
Test: m TARGET_BUILD_APPS=Gallery2 lint-check
Change-Id: I523c09016251377ff89d76084769be7401b95425
2020-07-16 12:51:42 -07:00
Makoto Onuki
086ae0744a Merge "Proper API hierarchy between MODULE_LIBS and PRIV_APPS system APIs" am: 7bbcc22858 am: f5ad49afb2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1360980

Change-Id: I7577d21c1696b47256f4fb514d7a3e06bcce7c88
2020-07-15 16:00:22 +00:00