This property is similar to `asset_dirs`, but for individual files. This
is especially useful when the user wants to pack generated asset files
into the APK.
Bug: 257532944
Test: m nothing
Change-Id: If3062124e9dedb41315dcaf5d379803e5419b8cd
Currently, there is no build action ensuring that the API text files are
up to date, unless a user runs `m checkapi` or `m update-api`. This
means that the user must run `m update-api` after making a change that
modifies api surface(s), so that the API text file reflects the local
change. This adds additional layer of action to developers, and it is
not guaranteed that the developer will always run `m update-api` after
making an api surface-affecting changes.
To prevent such mistake, this change adds droidstub-level api check as
validation for from-text stub generation. With this change, the build
will fail if the API text file is not up to date and the user must run
`m update-api` when making api surface-affecting local changes.
The validation is done by adding all droidstubs modules associated with
the java_api_contributions passed to java_api_library via
`api_contributions` as dependency and setting the current api timestamp
files as the validations for the from-text stubs generating build rule.
The full api surface libraries will not run the validations to avoid
circular dependency. However, all java_sdk_library generated
java_api_library modules will run validations, mapped to the droidstubs
in the same api domaion.
If the user sets the environment variable `DISABLE_STUB_VALIDATION=true`, validation
actions are not run. Validation actions run by default.
Test: m nothing --build-from-text-stub and run ninja query to verify `check_current_api.timestamp`s are listed as validation \
DISABLE_STUB_VALIDATION=true m nothing --build-from-text-stub and run ninja query to verify that validation actions are not added
Bug: 288624417
Change-Id: I329e6438fe8f3ac30d8c6a971d57853ed6b0d150
java_api_library modules generated from java_sdk_library get
full_api_surface_stubs corresponding to the api surface that the module
contributes to. However, modules generated from java_sdk_library where
sdk_version is none should not depend on the full api surface stub jar.
Test: m --build-from-text-stub
Bug: 288624417
Change-Id: I7edda3e6a40f739e805e8719b8d366da765a6933
When building with use_resource_processor: true R.jar files from
shared andoid_library dependencies need to be added to the classpath
so that the generated R classes can be referenced.
Bug: 294256649
Test: m DocumentsUIPerfTests
Change-Id: I30a6bddc3f378ecf58f142f94049e67ba33a47e3
JDK17 is the default java version, adding these props conditionally
openjdk9 is no longer relevant
Test: CI
Change-Id: I5d80fd22f474cedf389d1e295620cfc17bc327a0
Hiddenapi takes a single widest api scope stub dex jar as an input, as
the tool does not support handling duplicate classes passed as inputs.
A problem regarding this is that the test and module lib api surfaces do
not strictly have a subset/superset relationship, unlike other api
surfaces.
This has not become a problem for stubs generated from source
files as the stubs contain all methods in the source files, but became a
problem for stubs genereated from text files as the stubs only contain
the methods that are essential for compilation of the stubs and its
reverse dependencies, and there were cases where the hiddenapi flags are
not properly propagated to the subclasses.
To resolve this problem, a java_api_library module that provides the
union of the test and the module lib api surfaces was introcudes. Since
hiddenapi_modular currently defines the module lib api surface to be a
wider api scope over the test api scope, the new module can be passed as
input to hiddenapi over the module lib non updatable stub module to
resolve the problem.
Test: enable hiddenapi for from-text stub build && ENABLE_HIDDENAPI_FLAGS=true m --build-from-text-stub
Bug: 191644675
Bug: 275570206
Change-Id: I9a230ec5082c52ed866f29b0748814f2cf10279b
Currently in Soong testing suite, the only method for testing module
dependency is CheckModuleDependencies(...), which comapares for the
exact module dependencies. This change adds the method
CheckModuleDependency(...) which enables checking the dependency between
two modules, instead of comparing for all dependencies of an interested
module.
Test: m nothing
Bug: 288624417
Change-Id: I804d35979ddc24b0134671e326c1d37615ec4190
Previously, only the essential java_api_library and
java_api_contribution modules were being added to the template bp file
for testing purpose. However, since the child change aosp/2640275
adds droidstubs that generates the java_api_contribution as the
dependency of the java_api_library modules, not adding the droidstubs
modules to the template bp file will lead to missing dependency errors
in Soong test cases that tests the from-text generation &
java_api_library functionality.
To prevent this, this change adds the droidstubs modules instead of the
auto generated java_api_contribution modules to the template bp file to
more closely align with the real life behavior.
Test: m nothing
Bug: 288624417
Change-Id: I6a25e2f6c5f1281e96eca15aa5eec7417635df3f
Bug: 279960392
Test: CI and m --skip-soong-tests TARGET_PRODUCT=aosp_x86_64 EMMA_INSTRUMENT=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="external/cronet" mts
Change-Id: I4489ed725aee6097e6e340f5f6d06ecaf1c64222
System_modules property provides the jars passed as bootclasspath when
compiling the stubs in the java_api_library where its creating
java_sdk_library's sdk_version is none, as the jars will not be provided
from the full_surface_stub_libs but compiled by itself in the child
change.
The jar provided by the system_modules will also be passed to metalava
to resolve hierarchy coming from outer dependencies.
Test: m --build-from-text-stub
Bug: 288624417
Change-Id: I8f3b89efa24bceb070d7a37fae3c7334dd7f0868
The withres-withoutdex files were added in b/195558228 because D8
produced errors when given an input jar that contained both class
and dex files:
Error: com.android.tools.r8.internal.Cc: Cannot create android app from an archive 'out/soong/.intermediates/libcore/libcore-crypto-tests/android_common/withres/libcore-crypto-tests.jar' containing both DEX and Java-bytecode content
It turns out R8 doesn't have this problem, it defaults to ignoring *.dex
files unless the com.android.tools.r8.allowDexInputToR8 system property
is set. Remove the withres-withoutdex files when using R8, but keep
it in place for D8 for now.
Bug: 302573555
Bug: 303264288
Bug: 303064127
Test: m checkbuild
Test: m Calendar && m Calendar
Test: m framework-minus-apex && m framework-minus-apex
Change-Id: Ib6410f7fef6faf5913476c6423cdd27215c68c45
R8 rules produce a depfile generated by R8. R8 sees the withres-withoutdex
jar as an input, and so adds it to the depfile. If the jar is deleted
after running R8 then ninja will always consider the rule dirty, as the
input file listed in the depfile is missing.
Fixes: 303064127
Test: m Calendar && m Calendar
Test: m framework-minus-apex && m framework-minus-apex
Change-Id: I5cbd780b56fc131b58598d6e569a8a78b7fe9395
There are many issues in the docs, so allow specifying a baseline
file that allows existing lint errors in doclava.
Bug: 217734059
Test: m docs
Change-Id: I8997e47a497e1366247e8354be492805f300a16e
This reverts commit 1180919dda.
Test: go test ./java && m TARGET_PRODUCT=sdk TESTING_TARGET_RELEASE_NEXT=true nothing and inspect ninja command for generating stubs and verify the flag is included && m TARGET_PRODUCT=sdk TARGET_RELEASE=trunk_food nothing and inspect ninja command for generating stubs and verify the flag is not included
Bug: 299570421
Change-Id: I4967376c0236bad729398af80fa59b48dbab5f21
The linter output can be referenced in other modules for further
processing.
Bug: 302400088
Test: m nothing
Change-Id: I1809b70d8d98ced5d8f3d5f068c6639c782ebebc
Delete files created within the d8 and r8 rules that are not considered
output files by ninja. This should reduce disk space usage without
affecting incremental build performance.
Bug: 302573555
Test: m checkbuild
Change-Id: Ifea86888c2f385415735ade7d80cf315bc4d057e
The Android lint --exitcode parameter can be skipped using
ANDROID_LINT_SUPPRESS_EXIT_CODE. Expose a similar attribute to Java
modules to ignore the exit code.
This is useful for integration testing. It is possible to build
libraries that report an error when linted. Othewise, such module would
break the checkbuild target.
Bug: 302400088
Test: m nothing
Change-Id: I372c42184f40d25753a688c380c0c63e9758ca00
This makes it possible for Android.bp files to depends on the srcjar.
Bug: 151360309
Test: m platform-bootclasspath.srcjar
Change-Id: Id42cc3cff89c084b55c7fb0726ad84ecd4f50f58
This output contains all the transitive sources that are contained in
the bootclasspath.
It's currently limited to source-built bootclasspath components. Future
work will make this deal with sdk_library prebuilts.
Bug: 151360309
Test: unit test, as well as manual inspection of platform-bootclasspath
Change-Id: Ie05d8125e19736d8b4b9ebafb70b88a0a40069d5
This new entry in the JavaInfoProvider lists all the transitive source
files contained within the library. That is, the source files of the
module and all its static dependencies.
Bug: 151360309
Test: unit test in java_go + some manual testing
Change-Id: I7fe3035b9e46774095c0e9196cd77fa1027adf6d
android_library does not accept deps when there are no srcs because
there is no compilation happening. The libs of android_library module
are unnecessary as deps on the android_library since they aren't
being propagated to any dependencies.
So we can drop deps here.
Test: the updated test case and CI
Bug: 302290600
Change-Id: Ib43a1c273a5f3b3e0aa6f29f4e8569ad3487e451
APIs annotated with @FlaggedApi should not be included in the artifact
when building sdk target products in the "next" release configuration.
This change adds such logic by passing additional flag to metalava in
droidstubs.
The flag does not need to be passed to metalava invocation done in
java_api_library, as java_api_library generates stubs using api
signature files (i.e. *-current.txt files), and they will not contain
apis marked @FlaggedApi. The metalava invocation in droidstubs is
responsible for removing such apis.
Test: go test ./java && m TARGET_PRODUCT=sdk TESTING_TARGET_RELEASE_NEXT=true nothing and inspect ninja command for generating stubs and verify the flag is included
Bug: 299570421
Change-Id: Ia4b699b6e3ff6324f050eecc9ff5b622fdc04621
java_library rules with javac_shard_size set split the sources into
shards to invoke javac multiple times, but were using a single javac
invocation for all srcjars. For fraemwork-minus-apex, this srcjar
shard was the long pole at 15.7 seconds, containing 266 srcjars with
1542 java files with a total of 614593 lines.
Use a rough approximation of 5 sources per srcjar to determine the
number of shards to split the srcjars into based on javac_shard_size.
This results in splitting the srcjars for frameworks-minus-apex into
8 shards, with the longest taking 10.5 seconds to compile.
The longest shard contains most of the aidl srcjars, which have been
generated by sharded groups of 50 aidl files and have a much higher
average number of sources per srcjar (a mean and median of 27). A
future improvement could be to shard those separately assuming a
higher number of sources per srcjar.
Bug: 302033097
Test: USE_RBE=false m frameworks-minus-apex
Change-Id: I85e740c7fcf5651cf18c0cdc90ab8c6ee39cb47b
This should be no-op, as the underlying mutator has not changed yet.
Some other refactoring is required and done in this CL:
- Delete some old, dead ApiBp2build code
- Fix casting to TopDownMutator when it's not necessary
This change is required to prepare for allowlist v2 work, as only
BottomUp mutators can AddDependency.
Bug: 285631638
Test: m nothing
Test: presubmits
Change-Id: I5212a5f5634cc13056195783e6df37ff8eb000da
If a java_library module has proto srcs, a java_*_proto_library target
will be created for it. Proto sources are generated and then compiled
by a java_library target. We need to pass the libs and static_libs of
the java_library module to this java_library target so that
the compile-time classpath is correct.
Test: updated unit tests and CI
Bug: 301469542
Change-Id: I05b2efce6fda2223e85728b3c4c7b1815d04c3dd
With api_files property being removed from java_api_library, all api
files are passed to java_api_library via java_api_contribution, which
provide api_surface information. Instead of relying on the naming
convention of the api files, java_api_library can utilize this
information to sort the api files from narrower api scope to the wider
api scope.
Test: m --build-from-text-stub
Bug: 295429988
Change-Id: Idd832778833c072c6b7e9d1f775533e5f4e2af00
java_api_contribution provides api_surface information, but files
directly passed to java_api_library do not possess such information.
Currently, the api surface is assumed via naming convention for api
files passed via api_files property, but this is fragile.
This change removes the api_files property from java_api_library and
enforce all api files to be passed via java_api_contribution
Test: m nothing --build-from-text-stub
Bug: 300964421
Change-Id: If01d9ed978fe469d4ee0d685582a51629ebecc56
These properties are used to determine if the app should include the sdk
variant of jni libs. Till we support this, mark androi_app/android_test
that set this property as uncovertible in allowlist v2
Bug: 299360988
Test: created a test app in an android.bp and verified that an
equivalent target is not created if either of these props are set
Change-Id: I925745d2667866a12b71788dc8f1bb1e1f3472cc
The output of the kapt stubs rules only change when the public interface
of a kotlin class changes, which makes them a good candidate for restat.
This will prevent some unnecessary reruns of turbine annotation
processing.
Bug: 297356926
Test: builds
Change-Id: I39bd63284fd37058f69a0a3dace1ea5f4f50e8b5
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.
Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
This module converts simply to an android_binary, but with testonly = True.
Test: new unit tests
Test: new example app
Fixes: 283518652
Change-Id: If6b7661c32caa7dada6d492cce106d96236f6205
Test: go test bp2build conversion tests
Test: enable modules build from prebuilt and m nothing
Bug: 300640274
Change-Id: I8c015aec546d052bef6c42869e12db4e87d39780
Allowlist v2 will change bp2build by automatically disabling rdeps of
unconvertible modules. Many bp2build tests create bp2build stub modules
without an implementation,
This CL changes setup of such tests to also contain a BUILD file with
"stub implementations" of equivalent targets, to keep these test targets
convertible.
To verify this change in-place, this CL removes `bp2build_available:
false` from these dependencies.
This is a test-only change for bp2build tests.
Bug: 285631638
Test: m bp2build
Change-Id: I489480cbc4158a416b7abf57c35a6e2bc2ad6173
This change modifies sdk_library_import so that it directly creates
java_api_contribution per api scope. The module creates api_contribution
module for api scopes where the api file is specified.
Test: m nothing && MODULE_BUILD_FROM_SOURCE=false m nothing
--build-from-text-stub and inspect ninja dependency of java_api_library
Bug: 300175323
Change-Id: I74be3b4f1efef7f7d1cb8bd7b6c893b9cef0f370
metalava requires api files to be sorted in the narrower api scope to
the wider api scope when passed as inputs. Previously, the api files
were sorted based on the naming convention, but some api files in
prebuilts do not necessarily follow the naming convention (i.e.
*-current.txt). Therefore, utilize the api surface information provided
by the java_api_contribution provider instead of the naming convention
to sort the api files.
Test: m nothing
Bug: 300175323
Change-Id: I8466db712bff8fef906186bd272d85682877533d