droidstubs module require aconfig_declarations modules to be specified
when the module depends on the java_aconfig_library module in order to
generate the "exportable" stubs. This adds burden to the droidstubs or
java_sdk_library module owners, as module should specify both the
java_aconfig_library and aconfig_declarations modules to genreate the
"exportable" stubs, although the necessary information from the
aconfig_declarations module can be provided from the
java_aconfig_library modules.
In order to resolve such burden, this change enables the intermediate
cache files from the associated aconfig_declarations module of a
java_aconfig_library module to be propagated to its reverse dependencies
without having the specify the aconfig_declarations modules in the
droidstubs or java_sdk_library modules definitions.
This does not mean that the intermediate cache files of every transitive
dependencies of the java_sdk_library or the droidstubs will be passed to
aconfig to retrieve the state of the aconfig flags.
Specifically, only the java_aconfig_library modules or the java_library
modules that have static dependency on java_aconfig_library modules that
are passed to droidstubs via `libs` or `srcs` (using
":module_name{.tag}" syntax) will provide the intermediate cache files
to generate the "exportable" stubs. For java_sdk_library, all modules
listed as `libs`, `static_libs`, `stub_only_libs`, and `apiScope.libs`
are passed as `libs` and all modules listed as `api_srcs` and `srcs` are
passed as `srcs` to the droidstubs modules dynamically generated in
java_sdk_library module per api scope, thus these properties will be
affected.
Note that the test is being added in the apex package. This is because
trying to register the codegen package build components in the java
package leads to circular dependency between the codegen and the java
package, as codegen package imports the java package.
Test: m nothing --no-skip-soong-tests
Bug: 329284345
Change-Id: I7953ab64776f6947808321ce8a3598154501bcfe
Similar to how the exportable stubs are generated in droidstubs, this
change adds the rule to generate the runtime stubs in droidstubs. Unlike
the exportable stubs, which the artifacts are dist'ed during the sdk
build, the runtime stubs will only used in the hiddenapi flags
generation. Therefore, only the stubs are generated and no other
artifacts are generated during the "runtime" metalava invocation. When
`aconfig_declarations` property is not defined (i.e. no flags are
enabled, thus the exportable and the runtime stubs are identical), the
runtime stubs are simple copied from the exportable stubs.
Note that the runtime stubs are not a dependency of `droid` as of now.
The dependency of the hiddenapi flags will be replaced to the runtime
stubs in the child CL.
Test: m nothing --no-skip-soong-tests && m api-stubs-docs-non-updatable
Bug: 319162970
Change-Id: I14928b7b5619522c4caab1dfc795bc9c7e929639
This change enabled aconfig_declarations_group module type to be added
as `aconfig_declarations` property of droidstubs module. Similar to
aconfig_declrations module, the aconfig_declarations_group module
provides the intermediate cache files of the aconfig_declarations
modules of the listed codegen modules to droidstubs module.
Test: m nothing --no-skip-soong-tests
Change-Id: I42eb64d3ab65e679ea733c5bb98833971e49a8e8
Given that WITHOUT_CHECK_API=true is incompatible with from-text stub
build, this change makes the module raise an error when the two
conflicting configurations are set.
This change also modifies the checkapi error message, that
DISABLE_STUB_VALIDATION does not bypass checkapi.
Test: m nothing --no-skip-soong-tests && WITHOUT_CHECK_API=true m nothing
Bug: 322060779
Change-Id: I597309baa8fcfbefa05863c7b392bfb8b6774cea
This change generates rules for "exportable" stubs in the droidstubs
module.
Given that there are a lot of overlap between the currently existing
"everything" stubs rule and the newly introducing "exportable" stubs
rule, the currently existing metalava rule commands are modularized to
be utilized in the "exportable" stubs rule commands.
The currently existing build actions are modularized in the followings:
- commonMetalavaStubCmd(...): metalava commands that are required for
generation of both "everything", "exportable", and potentially
"runtime" stubs
- everythingOptionalCmd(...): metalava commands that are dependent on
"everything" stubs and not dependent on flagged apis annotations, such
as api lint, released api check
Based on this modularization, the "everything" stubs are now generated
in everythingStubCmd(...), which calls commonMetalavaStubCmd(...) and
everythingOptionalCmd(...).
Similarly, the "exportable" stubs are generated in
optionalStubCmd(stubsType=Exportable, ...), which calls
commonMetalavaStubCmd(...) and appends additional flags. Runtime stubs
can be generated similarly in the future with
optionalStubCmd(stubsType=Runtime, ...).
"everything"-related artifacts will now be created in
`everything/` subdirectory, and "exportable"-related artifacts will be
created in `exportable/` subdirectory. For example, the outdir of a
droidstubs module "foo" would look like below:
```
foo
|-- everything
| |-- foo_api.txt
| |-- foo-stubs.srcjar
|
|-- exportable
|-- foo_api.txt
|-- foo-stubs.srcjar
```
The module generates the build rules for the "exportable" stubs
regardless of whether the module defines the `aconfig_declarations`
property or not. All APIs marked with `@FlaggedApis` annotations are
stripped out for the "exportable" stubs when the `aconfig_declarations`
property is not defined. On the other hand, only the `@FlaggedApis` that
are specified in the aconfig_declarations module and are enabled will be
included (and all others are stripped) when the `aconfig_declarations`
propety is defined.
Test: go test ./java && BUILD_FROM_SOURCE_STUBS=true m
Bug: 315490657
Change-Id: I300273cd2a62fa978b046c0268e3a67c35e22b08
In consideration of the incremental build performance, this change let
droidstubs and java_sdk_library (which generates droidstubs per api
scope) modules to specify `aconfig_declaration` modules where the
dependent flags are defined in via the "aconfig_declarations" property,
opposed to passing uniform "all_aconfig_declaration"-generated flag
arguments to metalava.
When "aconfig_declarations" property is defined for java_sdk_library
modules, the property is passed to the generated droidstubs modules.
When "aconfig_declarations" property is defined for droidstubs modules,
the all aconfig_declaration modules listed in the property are listed as
deps, all cache protobuf files are gathered and metalava-consumable
flags are generated in "revert-annotations.txt".
Although this change introduces scalable implementation to easily
support generation of the "runtime" stubs corresponding flags, actual
support of the runtime flags/stubs will be done in future changes. This
change mostly focuses on the generation of the "exportable" flags.
Utilization of the generated "exportable" flags will be done in future
changes.
Test: go test ./java
Bug: 315485740
Change-Id: I37becd1b9dd9069d7ac4abed130906df30b3fdf4
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.
Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.
Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
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 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
`-encoding` and `-source` have been deprecated in metalava.
`-encoding` actually does nothing apart from check to make sure that
the value is `utf-8` (in some case). Metalava always uses `utf-8`.
`-source` has been deprecated in favor of `--java-source` as metalava
also can consume kotlin and it has its own `--kotlin-source` option.
Bug: 295136054
Test: ./gradlew
Change-Id: I08e6931958f40022d65d417360e32b72a1d70444
Revert submission 2615972-b-270335653-doclava-search-imports
Reason for revert: DroidMonitor: Potential culprit for Bug 286398320 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted
Reverted changes: /q/submissionid:2615972-b-270335653-doclava-search-imports
Change-Id: Ibc3bdb301110b564e1427432a1b530e07bb840cd
max_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid max_sdk_version in bp
files
Bug: 208456999
Test: no change in ninja file (this should be a no-op)
Test: TH
Change-Id: I304b5ad802bde200137d8e225182828dfd6f7227
target_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid target_sdk_version in bp
files
Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999
Change-Id: I3c19245e29184bd9e5660ad8981966f64dfa9424
This relands aosp/2457063. The original change broke T and U since those
branches still contain soong modules of type (kind+level). Those soong
modules have been cleaned up now
Test: Used go/abtd to test T and U branches with this change
Bug: 208456999
Change-Id: I0ef7933c055f88cb512a02108f1173e51156ef1c
min_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid min_sdk_version in bp
files
Will do a similar cleanup for targetSdkVersion and maxSdkVersion in a
followup CL
Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999
Change-Id: Ie6ae7e267d093c5e4787e82685daaca1021d202e
This reverts commit 32db73188d.
Reason for revert: Failing branches now have the updated Doclava (automerger encountered a conflict which led to build failure). Relanding.
Change-Id: Ib327e54898e97a93dd6140a65f2d7231ffd4cef3
Currently, stubs are compiled with Java version 1.8.
To align with this, set the java version passed to javac invocation as
1.8 for java_api_library module. Helper function is used to sync the
java version of droiddoc module and java_api_library module.
Test: m
Change-Id: I103b94aed9747a2f2dd65d13de0ae9c0f33db5c0
JavaDoc's implementation of `aidlFlags` omits `min_sdk_version`, and
therefore aidl compiler would default it to a default version.
To fix this, pass the min_sdk_version explicitly
Bug: 253122520
Test: TH
Test: go test ./java
Change-Id: Ia8f639174f8361136596d0e7b3286606f84705cd
I046d75dbbd4f21f4a2b6851f558e430e9879fcff fixed android_app modules
with missing certificate dependencies when AllowMissingDependencies
was set, but the same problem can occur in android_app_import and
android_rro modules. Move the AllowMissingDependencies handling
into processMainCert so that it applies to all of them.
Bug: 246649647
Test: TestAppImportMissingCertificateAllowMissingDependencies
Change-Id: Ic7dd3e61e0e3af15c53b583cf680b1e52394a018
The AIDL source generation rule sets include flags based on the relative
path of .aidl sources. For .aidl sources provided by Bazel targets, e.g.
in a filegroup, the same directory could be added to the include path
twice. Instead we need to ensure that if a Bazel source provides the
include path, that we don't add it again from a Soong source.
Bug: 229251008
Test: USE_BAZEL_ANALYSIS=1 m api-stubs-docs-non-updatable
Change-Id: I4997039003242b43e0e52ccf41729acb4ad11324
If max_sdk_version is included in Android.bp that value will now be
propagated to manifest_fixer.py. This value will then be used to
override any maxSdkVersion attribute set on permission or
uses-permission tags in the android manifest if maxSdkVersion="-1".
Bug: 223902327
Test: add max_sdk_version to Android.bp for test app
Test: create permission in test app manifest with maxSdkVersion="-1"
Test: run test to check maxSdkVersion=max_sdk_version
Change-Id: Ic533ef2a41b9ecc9ee68c69399026df47ee945b7
When set to true, this attribute will pass down the
-Wmissing-permission-annotation flag to the aidl compiler. It is
possible to declare a set of exceptions (for a graduable adoption). For
now, only Java is supported.
Test: build having the attribute enabled for frameworks/base
Bug: 220214993
Change-Id: I54350199b4d980aef0050519e3daf1fef616d08c
Use pathForInstall instead of PathForOutput for HostJavaToolPath
so that it internally produces an InstallPath that can later support
being converted to Make installpath.
Bug: 204136549
Test: m checkbuild
Change-Id: If4f5d3552b27ffe6b9bc709c4a08d9513c49ef7d
Metalava now expects html files to be specified explicitly. This
filtering was originally added because jdiff could not cope with html
inputs, but jdiff support has been removed in r.android.com/1455335.
Bug: 153703940
Test: m checkapi
Change-Id: I34164b633bab2892e3a1c0fd0257fcf98d537655
Previously, SdkSpec was constructed only from the user string. It didn't
make use of the Config struct where information about the latest stable
SDK version, etc. is recorded. As a result, the build system couldn't
check if the sdk version "current" is referring to the in-development
(i.e. not-yet-frozen) SDK version or the latest stable version.
"current" was always assumed to be in-development (IsPreview() returns
true) even when Platform_sdk_final == true.
As the first step for fixing that, this change requires
android.EarlyModuleContext to be passed when constructing SdkSpec from
the user string.
In the following changes, "current" will be mapped to either
FutureApiLevel (10000) or one of the FinalApiLevels() depending on
whether the platform SDK was finalized or not.
Bug: 175678607
Test: m
Change-Id: Ifea12ebf147ecccf12e7266dd382819806571543
... in preparation for making the handling of sdk versions consistent
across java and cc modules.
Bug: 175678607
Test: m
Change-Id: I598f0454bce9b7320621022115412fbe97403945
Everything is running in the sandbox, remove the unsandboxed support.
Bug: 153703940
Test: m checkbuild
Change-Id: I811b8a0ad37143518c120367dd20b2b6aa011570
args properties can access arbitrary files with $(location) expansions,
so they need to pass them through RuleBuilderCommand.PathsForInputs
to produce a path inside the sandbox. Extract the arg expansion out
of collectDeps into a new expandArgs method that takes the
RuleBuilderCommand.
Test: TestDroidstubsSandbox
Change-Id: I9022d17bf3cb64c97b2008c4c1b733bf48edca95
Split part of droiddoc.go into droidstubs.go. Also split droiddoc_test.go
and droidstubs_test.go out of java_test.go.
Test: go test ./java
Change-Id: Iea742e75b6925b135016f7bbf3a168c696a6c433
Fixes warnings:
Warning: Using ANDROID_SDK_HOME for the location of the '.android' preferences location is deprecated, please use ANDROID_PREFS_ROOT instead.
Support for ANDROID_SDK_HOME is deprecated and will be removed in 6.0
Test: m android_stubs_current
Change-Id: Ie8721dcda0578c670dfc796675ba43cda16883f6
rewrapper supports a comma separate list of rsp files, replace
REParams.RSPFile with REParmas.RSPFiles.
Test: remoteexec_test.go
Change-Id: I7850c071c23d368d6fad4480dd527d146c13c6d3
Run lint actions in sbox with RuleBuilder.SandboxInputs. This
copies all input files into the sandbox, which prevents the lint
tool from finding nearby source files that were not presented to it.
Using SandboxInputs requires use of PathForInput or PathForOutput
anywhere a path is used outside of the RuleBuilderCommand methods
that take paths so that they can be translated to the paths that
will be used in the sandbox.
Bug: 181681346
Test: lint_test.go
Test: m lint-check dist
Test: m USE_RBE=true RBE_LINT=true lint-check dist
Test: m USE_RBE=true RBE_LINT=true RBE_LINT_EXEC_STRATEGY=remote lint-check dist
Change-Id: Iab4e09d961891ef182643583d4d456e413bc5e39
Remove the references to the android package in remotexec so that
the android package can reference the remoteexec package. This
will allow RuleBuilder to integrate directly with remoteexec.
Bug: 182612695
Test: m checkbuild
Change-Id: I15be5ef126d8aacbd605518638f341daf6f31bb3