Commit graph

6299 commits

Author SHA1 Message Date
Pedro Loureiro
d9d5f97f00 Remove special case for test-only module
Test: m nothing

Bug: 195732042
Change-Id: I401a7ec63c5c902255184b5861ead3e3322be373
2022-09-16 18:44:28 +00:00
Treehugger Robot
56fd1539f0 Merge "Revert "bootclasspath_fragment: Treat some specific modules as test"" 2022-09-16 18:24:49 +00:00
Treehugger Robot
2ba6d37e7b Merge "Increase javac heap to 4096M" 2022-09-14 17:55:51 +00:00
Paul Duffin
d0fe1307aa Revert "bootclasspath_fragment: Treat some specific modules as test"
This reverts commit ff9b6faba2.

Reason for revert: No longer needed
Bug: 194063708
Test: m nothing
Change-Id: Ic2f6761c9a0a00a612724cb429f002a16522e53f
2022-09-14 17:05:25 +00:00
Sorin Basca
a1073a5ab5 Increase javac heap to 4096M
Bug: 246361502
Test: TH
Change-Id: I787871a8fe924857cde550700acd15682b924b8b
2022-09-14 11:33:58 +01:00
Zimuzo Ezeozue
a610511bca Merge "Enable aidl#generate_traces by default for some Java SDK kinds" 2022-09-12 21:00:35 +00:00
Sam Delmerico
43c0eb17ae Merge "add jacocoagent by default to Java modules" 2022-09-12 13:32:09 +00:00
Sam Delmerico
1e3f78f866 add jacocoagent by default to Java modules
On coverage builds, R8 will fail to properly optimize and fail the build
if ignore_warnings: false, because jacoco injects dependencies on
jacocoagent classes, but the jacocoagent library is not part of the
classpath libraries passed in to R8 in its arguments.

Instead we can add jacocoagent as a libs dependency for these modules so
that it will get pulled into the r8 flags.

Bug: 243903417
Test: m
Change-Id: Icc24cc260b896fc800125a0318308d823ccf7a83
2022-09-09 16:50:38 -04:00
Sorin Basca
3cc6201d71 Merge changes I6fed538a,I38df207c
* changes:
  Pin javadoc to JDK 11
  Open java.lang for dokka
2022-09-08 19:17:34 +00:00
Sorin Basca
198c51c868 Pin javadoc to JDK 11
Bug: 240421555
Test: m sdk
Change-Id: I6fed538a3a0d05a3115dd930b860aa7769aa6d16
2022-09-08 17:15:18 +01:00
Sorin Basca
1d68e48084 Open java.lang for dokka
Bug: 240421555
Test: m sdk
Change-Id: I38df207ca2c891df24fe32f711b2767cb17195ec
2022-09-08 16:48:01 +01:00
Mårten Kongstad
9be110d151 Merge "Pass --sdk-extensions-{root,info} to metalava" 2022-09-08 06:08:43 +00:00
Mårten Kongstad
802ae0fdd3 Pass --sdk-extensions-{root,info} to metalava
Teach soong to pass metalava the two new command line arguments
--sdk-extensions-root <dir> and --sdk-extensions-info <file> when
generating the API levels file (--generate-api-levels api-versions.xml).

The directory hierarcy in a droiddoc_exported_dir module has special
meaning, e.g. extensions/1/public/*-stubs.jar are the mainline module
stubs containing the public API for SdkExt version 1. Update the logic
where the directories are scanned for android.jar files to locate the
SDK extension jars (extensions/<int>/public/*-stubs.jar).

Also introduce a new field on droidstubs properties
(Extensions_info_file) to set the value of --sdk-extensions-info.

Note: if Extensions_info_file is not set, neither
--sdk-extensions-root or --sdk-extensions-info will be passed to
metalava.

Bug: 228828986
Test: go test -run TestDroidstubsWithSdkExtensions ./java
Test: m sdk dist && grep -e from= -e module= out/dist/data/api-versions.xml # needs APIs to be listed in the info file
Change-Id: I682e34d328fc93d3eded8565ffee40961307901a
2022-09-07 16:13:49 +02:00
Sam Delmerico
3dca115dda Merge "jacoco libs dependency for instrumented libraries" 2022-09-02 18:50:29 +00:00
Zim
8774ae1ba1 Enable aidl#generate_traces by default for some Java SDK kinds
This will enable AIDL tags in perfetto traces for the following SDKs:
1. SdkSystemServer
2. SdkCore
3. SdkCorePlatform

SdkModule requires exposing some Trace methods as
@SystemApi(MODULE_LIBRARIES). This will come as a follow up

Test: Manual
Bug: 161393989
Change-Id: I01d520afa8e26eabb97318192151b707b002c28b
2022-09-02 12:43:39 +01:00
Cole Faust
bcc3d05aba Fix module-file name collisions
Bazel doesn't allow a module and file with the same name.

Bug: 198619163
Test: Presubmits
Change-Id: Ie9731b627945d2ff221d3a5d08a32a5a172f9dcd
2022-09-01 15:20:00 -07:00
Sam Delmerico
c75937264b jacoco libs dependency for instrumented libraries
On coverage builds, R8 will fail to properly optimize and fail the build
if ignore_warnings: false, because jacoco injects dependencies on
jacocoagent classes, but the jacocoagent library is not part of the
classpath libraries passed in to R8 in its arguments.

Instead we can add jacocoagent as a libs dependency for these modules so
that it will get pulled into the r8 flags.

Bug: 243903417
Test: add optimize.ignore_warnings: false to NetworkStackAppDefaults &&
  make SKIP_ABI_CHECKS=true PRODUCT=cf_x86_phone-userdebug \
  EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true \
  CLANG_COVERAGE=true COVERAGE_PATHS="" \
  TARGET_USERDATAIMAGE_PARTITION_SIZE=17179869184 \
  SKIP_BOOT_JARS_CHECK=true \
  NetworkStack
Change-Id: I71313b1fd35437ec52890f5c30b3fd1381c7c3d2
2022-08-31 16:15:27 -04:00
Sam Delmerico
3be24727ce Merge changes from topic "aidl_interface_bp2build"
* changes:
  add bp2build unit tests for aidl_interface
  AIDL source generation accounts for Bazel paths
  convert .aidl srcs for java_library
  add Partition method to LabelListAttribute
2022-08-26 20:07:58 +00:00
Sam Delmerico
2351eacb19 AIDL source generation accounts for Bazel paths
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
2022-08-25 14:47:41 -04:00
Sam Delmerico
97bd127457 convert .aidl srcs for java_library
Test: go test ./bp2build
Test: b build //frameworks/base/services/tests/servicestests/aidl:servicestests-aidl
Test: enable //packages/modules/NetworkStack/common/networkstackclient
    && disable restriction on Android SDK in javaLibraryBp2Build
    && b build //packages/modules/NetworkStack/common/networkstackclient:ipmemorystore-aidl-interfaces-V10-java
Change-Id: Ifb817daf09a3983ea1c84948ed9f02a79f95784b
2022-08-25 14:47:41 -04:00
Cole Faust
2d516dfa53 Skip errorprone on protobuf/aidl-only modules
Some protobuf modules like perfetto_trace-full take a long time
to analyze with errorprone, in that case it took over 10 minutes.
Skip errorprone on protobuf or aidl-only modules because having
warnings on generated source code isn't useful anyways.

Bug: 242630963
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I5e73accd0b56a0a71e75927778c5c04a0d358e67
2022-08-24 11:22:52 -07:00
Treehugger Robot
02b122c887 Merge "Strip annotations from copy of core-current-stubs-for-system-modules" 2022-08-22 14:33:38 +00:00
Sorin Basca
bdbae604b0 Strip annotations from copy of core-current-stubs-for-system-modules
Bug: 233029164
Test: m
Change-Id: I4d497b1072d1184cf3dce660992632eb01f4016d
2022-08-22 08:10:16 +01:00
Paul Duffin
1caaec0789 Merge "Add hidden API properties to java_sdk_library modules" 2022-08-21 12:00:14 +00:00
Treehugger Robot
845c4c1646 Merge "Fix ProcessBazelQueryResponse of filegroup" 2022-08-19 17:16:58 +00:00
Paul Duffin
3f1ae0b55a Add hidden API properties to java_sdk_library modules
Previously, hidden API properties were only allowed on
bootclasspath_fragment and platform_bootclasspath module types. This
change allows them to be specified on java_sdk_library modules too. It
involves the following changes:

1. Add the properties to the java.Module.
2. Populate and provide a HiddenAPIPropertyInfo struct from
   java_sdk_library modules.
3. Modify bootclasspath_fragment to merge information gathered from its
   content libraries as if it was specified on the fragment itself.

Bug: 240406019
Test: m nothing
      packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I64eb71c2039ddc14cf380689d0cec7ec221f5b88
2022-08-19 16:45:38 +00:00
Paul Duffin
1149c2c185 Merge changes I66445302,I773279a4
* changes:
  Push Hidden_api inside HiddenAPIFlagFileProperties
  Refactor handling of hidden API property provided information
2022-08-19 15:08:13 +00:00
Treehugger Robot
e29d230b75 Merge "Allow libcore to have NewApi warnings" 2022-08-19 14:32:57 +00:00
Treehugger Robot
3651a5dccb Merge "Dedup apiFile and removedApiFile fields" 2022-08-19 14:12:57 +00:00
Paul Duffin
9b61abbd84 Push Hidden_api inside HiddenAPIFlagFileProperties
All usages of HiddenAPIFlagFileProperties use it as the type of a
Hidden_api field. This change pushes the field inside the struct and
just embeds the struct inside the structs that need it making it
simpler and more consistent with how the HiddenApiPackageProperties
struct is used.

This is extracted as a separate change as while the change is simple
it does affect a lot of lines. Keeping it separate makes it easier to
review the changes.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I664453029574ef68dc5712f7bf137a1a6e78e864
2022-08-19 13:29:47 +00:00
Paul Duffin
1e9e9388d8 Refactor handling of hidden API property provided information
In preparation for adding hidden API properties to individual
java_sdk_library modules this change refactors the handling of that
information.

1. Renames HiddenApiPackageProperties to HiddenAPIPackageProperties
   to be consistent with other similar structs.

2. Creates a new HiddenAPIPropertyInfo struct to be used to provide
   property derived information from one module to another. It includes
   both flag files as well as the information about which packages are
   used.

3. The HiddenAPIPropertyInfo is embedded within the existing
   HiddenAPIFlagInput in place of the existing flag files field.

4. The fields in the HiddenAPIPropertyInfo struct are populated from
   the HiddenAPI*Properties structs.

5. Access to package information is retrieved from the info struct
   instead of directly from the properties. That means that no changes
   will be needed to this code when info from other modules is merged
   into the struct in a follow up change.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I773279a4b621bcc3c40e3bfe193f2c7b0caeccd6
2022-08-19 13:28:47 +00:00
Vinh Tran
16fe8e1cf1 Fix ProcessBazelQueryResponse of filegroup
In mixed builds currently, filegroup doesn't use path prop when creating the paths to the srcs. It defaults to ModuleDir.

Hence, when java.genAidlIncludeFlags [1] calls srcFile.Rel() to eventually create the AIDL include dir for AIDL flags, srcFile.Rel() returns the filepath relative to the module directory instead. This CL appends path prop to module dir when creating relativeRoot.

This fixes the bridge between converted filegroup that set path prop (e.g. libbinder_aidl) to unconverted module (for example, droidstubs). The fix is needed for the child CL aosp/2186599 to convert libbinder_aidl to Bazel. Without this fix, module-lib-api-stubs-docs-non-updatable (unconverted module that depends on libbinder_aidl) can't be built in mixed builds.

[1]: https://cs.android.com/android/platform/superproject/+/master:build/soong/java/gen.go;l=123?q=java%2Fgen.go

Test: go test
Bug: 243010121
Change-Id: Ic2dd2ab9199c62010303a5b8c611d722f4a4118d
2022-08-18 13:59:06 -04:00
Paul Duffin
c71d2b7629 Dedup apiFile and removedApiFile fields
Previously, there were two separate fields for each of the API and
removed API files because in some cases it needed a WritablePath and in
other cases it could only be a Path.

This change refactors the code so that the WritablePath is no longer
needed, the duplicate fields deleted and the remaining field is changed
to Path. It also removes a few unused fields.

Bug: 234113632
Test: m nothing
Change-Id: If81f5fe2aa05d9d7b2bc23869fdb2397649d67b3
2022-08-18 09:40:01 +00:00
Colin Cross
d079e0b270 Reformat build/soong for go 1.19
Test: none
Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
2022-08-17 10:43:13 -07:00
Zhenhuang Wang
852d0c4859 Merge "Move common test_options properties into the android package" 2022-08-17 15:22:18 +00:00
Paul Duffin
13fe665176 Merge "Revert "Check that API is up-to-date when building java_sdk_library"" 2022-08-17 09:13:23 +00:00
Orion Hodson
b816652ee0 Allow libcore to have NewApi warnings
The majority of libcore NewApi warnings come from references to new
methods, constants, fields added in a file and then referenced in the
same source file. Maintaining suppressions is not scalable: they need
to work across multiple API versions in different branches.

Bug: 208656169
Test: TH
Change-Id: If5e746f25f1bd34931ee8c89b363aa92c81e23b3
2022-08-17 09:34:09 +01:00
Treehugger Robot
48ec5b302a Merge "Add lint test property" 2022-08-16 21:23:12 +00:00
Colin Cross
79845f9cce Merge "Collect suggested modifications from lint" 2022-08-16 20:38:16 +00:00
Zhenhuang Wang
0ac5a431a9 Move common test_options properties into the android package
Multiple modules (e.g. java, cc, python, rust) define the `test_options`
field. Extract the common properties in test_options to share across
different test rules.

Bug: 240928948
Test: `refreshmod` and diff with original module-info.json
Change-Id: I404a7a157b4ccaa53d800ee2217559ff695bd825
2022-08-17 01:19:15 +08:00
Paul Duffin
e7a8664a6a Revert "Check that API is up-to-date when building java_sdk_library"
This reverts commit c166b68589.

Bug: 234113632
Bug: 236187167
Reason for revert: causes problems with update-api, see b/236187167

Change-Id: I4c88151cb5e2c86bb6c1a955c5065966a4fbb3e0
2022-08-16 15:43:20 +00:00
Colin Cross
62695b9f01 Collect suggested modifications from lint
Pass --apply-suggestions to lint, which will cause it to apply
suggested fixes to the source files in the sandbox.  Zip up the
modified sources and export them outside the sandbox.

Test: examine suggested-fixes.zip
Bug: 216456886
Change-Id: Iaeb406462c38cf4b10e51d641432ba1fda9327fa
2022-08-15 16:05:03 -07:00
Treehugger Robot
6d7b20f2e6 Merge "Revert^2 "Promote ExtraText lint warning to an error""" am: ffd6014a68
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2183963

Change-Id: I2a9f0e7c05f95186bb1618798ce5cd57a97617a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-12 07:02:59 +00:00
Cole Faust
d57e8b2c2a Add lint test property
Some libraries are only used for tests, but
are not test module types. These modules get warnings
about @VisibleForTesting usages when they really
shouldn't. Expose a test flag that module authors
can use to make lint treat a module as test code.

Bug: 235339747
Test: Manually tested applying it to SystemUI-tests
Change-Id: I1356749a669dc80a7725605d7159da27c9a211b4
2022-08-11 12:26:51 -07:00
Cole Faust
2aa68684ba Revert^2 "Promote ExtraText lint warning to an error""
This reverts commit 0b29c62498.

Reason for revert: Issue that caused breakage has been fixed on stage-aosp-master. I'll test this cl on go/abtd for the stage-aosp-master branch before submitting.

Change-Id: I90f1941f67ebf9c40402713fa7762a99e368c17f
2022-08-11 17:21:45 +00:00
Mike McTernan
8883d52ce0 Revert "Promote ExtraText lint warning to an error" am: 0b29c62498
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2183156

Change-Id: I03abf2ef079a4b2c371eaf291b54e1d3fbf449b4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-11 11:02:51 +00:00
Mike McTernan
0b29c62498 Revert "Promote ExtraText lint warning to an error"
This reverts commit 7868b9e942.

Reason for revert: DroidMonitor: Potential culprit for Bug b/242013483 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Bug: 242013483
Change-Id: Ib73f862f34ca2c8ede7e4b4b9403d1eed00d0426
2022-08-11 10:21:38 +00:00
Treehugger Robot
2a20239c70 Merge "Use aapt2" am: 258d296698
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2178198

Change-Id: I9fa8b617a0854826f6f4da5a66618d17338c5772
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 02:17:45 +00:00
Treehugger Robot
258d296698 Merge "Use aapt2" 2022-08-10 01:21:11 +00:00
Treehugger Robot
5457488c9a Merge "Promote ExtraText lint warning to an error" am: 69f5b684d4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2180436

Change-Id: Ie5c874e675795f1ca68205c18a60005a22e9f0e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 00:29:21 +00:00