Commit graph

6711 commits

Author SHA1 Message Date
Jihoon Kang
b6690d21ae Merge "Generate java_api_contribution module from droidstubs module" 2023-01-26 23:54:14 +00:00
Alix Espino
1db2ff3eaf Merge "arch variant support for libs property" 2023-01-26 19:11:23 +00:00
Jihoon Kang
3198f3cb52 Generate java_api_contribution module from droidstubs module
Context
- droidstubs module are either generated from the java_sdk_library
  module or defined in the bp files.
- Since droidstubs module contains API text file property,
  java_api_contribution module can by dynamically created from
  droidstubs.

Implementation
- Add `api_surface` property in droidstubs module. This property is
  either inherited from the java_sdk_library or written in the module
  definition in the bp file.
- Add defaultable hook in droidstubs module to generate the child
  java_api_contribution module.

Test: m
Change-Id: Ica43d65614723c623cd0c155266f9844e69e5d5e
2023-01-26 18:44:25 +00:00
Ian Zerny
9002605d72 Merge "Add default output location for full proguard configuration." 2023-01-26 07:16:03 +00:00
Ian Zerny
82044f1327 Add default output location for full proguard configuration.
Test: n/a
Change-Id: I1d022ff138d14f6b6960811320436c7e5660e6e2
2023-01-25 19:56:22 +01:00
Sam Delmerico
41f9b734bb Merge "transitive Java deps for r8" 2023-01-25 16:05:43 +00:00
Treehugger Robot
7c30b6bad7 Merge "bp2build support .kt in android_library" 2023-01-25 15:47:49 +00:00
Jihoon Kang
6cf5e0d9cb Merge "Add libs property to java_api_library module" 2023-01-24 18:08:49 +00:00
Spandan Das
82a9e8fe03 Merge "Add j.a.p.Generated to ART's Public API surface" 2023-01-24 16:40:17 +00:00
Alix
36795a74dc bp2build support .kt in android_library
Bug: 258690851
Test: bp2build tests and built target renderscript_toolkit
Change-Id: I43ddf5637c97e4849b63abd2423f29519d44c28f
2023-01-24 14:53:44 +00:00
Jihoon Kang
362aa9db12 Add libs property to java_api_library module
Module Lib API surface takes modules that are not part of the API
surface as classpath during compilation of the JAR file. Thus, add libs
property to add deps in bp module definition.

Test: m
Change-Id: I8967d53430fa4cc8e4aa431770ba4e97893f8c61
2023-01-24 00:44:22 +00:00
Sam Delmerico
9f9c0a22fa transitive Java deps for r8
The -libraryjars argument to r8 was missing transitive dependencies, and
so complained when there were classes used in the program JAR which were
not provided via libraries. This CL propagates transitive dependencies
to the r8 command to reduce the warnings that are generated for missing classes.

Bug: 242088131
Change-Id: Ifad7bc7c5d406e3de8d98ea963c97e88c84b45a1
2023-01-20 17:05:14 -05:00
Alix
495cc8a6ff arch variant support for libs property
Test: bp2build tests and manually inspected Build file for libprotobuf-java-lite
Bug: 244210934
Change-Id: Id60d859eea2c23fa7a29784faeed5cb050d4193e
2023-01-19 20:42:24 +00:00
Alix
684f63ab5a Getting rid of old hacky Libs conversion
Now that libs conversion is happening for the needed module_types,
removing if statement with old hacky libs conversion

Test: Presubmit
Bug: 244210934
Change-Id: I92bb2080eeb7dcb85d087a3ff6054bdf8675ec54
2023-01-19 15:39:49 +00:00
Alix Espino
fbd7fabf0a Merge "bp2build support libs for *->android_library_import" 2023-01-19 15:21:07 +00:00
Cole Faust
bbe929c31e Merge "Replace RuleBuilder usages with static rules in app_import.go" 2023-01-17 23:13:12 +00:00
Alix
14101de2e1 bp2build support libs for *->android_library_import
Test: bp2build tests
Bug: 258688914
Change-Id: Ibeae04e4c006f84f902774821c92f463a7c709eb
2023-01-17 15:55:07 +00:00
Alix
53fae383d6 support libs for java_plugin -> *
Test: bp2build tests
Bug: 244210934
Change-Id: I7dbc820b23c4129485b0991aefb41e00e434d94e
2023-01-17 14:57:57 +00:00
Alix Espino
f02c7d882e Merge "libs support for android_app->* edge" 2023-01-17 14:31:18 +00:00
Cole Faust
4ec178c5db Replace RuleBuilder usages with static rules in app_import.go
RuleBuilder creates a new rule in the ninja file every time
it's used, but in this case the rules were all exactly the same
except that the input/output file paths were different.

This can be converted to a single static rule instead.

Bug: 262629589
Test: m nothing
Change-Id: Iaa887c66a757da13293a3614c000d3be02a2a1b0
2023-01-13 17:45:17 -08:00
Jihoon Kang
cd08ae402b Merge "Add java_api_library properties to java_defaults" 2023-01-12 18:57:41 +00:00
Spandan Das
7fb3d436f4 Add j.a.p.Generated to ART's Public API surface
Since this class is now part of ART's public API, we do not need to add
it separately to the relevant system modules

Bug: 261244752
Test: TH

Change-Id: Ib318ef006b868d482b2cb8ff4820afe3f352483d
2023-01-12 18:51:52 +00:00
Romain Jobredeaux
3095d8e7bc Merge "Use centralized rules.bzl file for android rules in bp2build." 2023-01-12 18:46:48 +00:00
Alix
6c087cf01a libs support for android_app->* edge
Test: bp2build tests
Bug: 258688914
Change-Id: I2e24c484019c994b43509f350b3c090a40c3ba6a
2023-01-12 15:19:55 +00:00
Alix Espino
ed2491cf20 Merge "java_binary with kotlin sources" 2023-01-12 14:40:46 +00:00
Treehugger Robot
7def86db45 Merge "Update app tests to set Unbundled_build" 2023-01-12 14:12:10 +00:00
Romain Jobredeaux
5ccb460c42 Use centralized rules.bzl file for android rules in bp2build.
Change-Id: I6e4837d8b6715960337d0db9b36f8137efb5673e
2023-01-11 16:29:12 -05:00
Treehugger Robot
4bf6a9ee50 Merge "Fix ALLOW_MISSING_DEPENDENCIES builds for prebuilt JNI libraries" 2023-01-11 21:09:30 +00:00
Harshit Mahajan
18845d0f7a Update app tests to set Unbundled_build
Based on the description for UnbundledBuildApps(), UnbundledBuild()
should always be true when UnbundledBuildApps() is true.
Updating the test to match this condition.
More details: https://android-review.git.corp.google.com/c/platform/build/soong/+/2380693/comment/54f172b4_2eee54fa/


Bug: b/227460469
Test: m nothing
Change-Id: I3a93edb781522da5af201f6864e157e7bab2195a
2023-01-11 18:44:53 +00:00
Sorin Basca
d528d56215 Use a stub doclet instead of Doclava
Bug: 240421555
Test: m sdk
Change-Id: I8bffb50fe4cfe41ae3cde9d8466c7b22fceaaad9
2023-01-11 12:47:42 +00:00
Sorin Basca
d6be9e51ca Target Java 17
Bug: 233029164
Test: TH
Change-Id: I750b866565c264eb4f4ac14ebc88be6fc9b1b458
2023-01-11 12:47:10 +00:00
Inseob Kim
48aa22380e Consider only preferred modules for jdeps
Bug: 263327259
Test: run atest and see modules to be built
Change-Id: I208a07e2453b924f8af25db340d970ec039c5f32
2023-01-11 13:26:04 +09:00
Spandan Das
3dfb939243 Merge "Create a "Toolchain" API surface" 2023-01-11 01:08:25 +00:00
Jihoon Kang
1c51f50120 Add java_api_library properties to java_defaults
Context
- Some Java API surfaces have subset relationships (i.e. public API
  surface is a subset of system API surface). Thus, simply listing
  all API files that contributes to hierarchical API surfaces when
  defining java_api_library modules can lead to repetition of code in
  Android.bp files.
- Utilizing java_defaults can resolve this problem by
  grouping java_api_contribution modules by API surfaces, and reduce
  code repetition and enhance readability.

Implementation
- Modify java_api_library module to utilize java_defaults modules.

Test: m
Change-Id: I6adead208ca36c21de72ee39c4f532b84af8a153
2023-01-10 22:34:31 +00:00
Harshit Mahajan
8f202ad925 Move target sdk version enforcement check
Enforce target sdk version flag could only be used by `android_app`,
moving the check into a common function `generateAndroidBuildActions`.
This would ensure that the `enforce_target_sdk_version` flag
can also be set by `android_test` and `android_test_helper_app`.

Bug: b/227460469
Test: m nothing

Change-Id: I86e0bf684a5083221dae53907d9f548a0390b673
2023-01-09 20:54:39 +00:00
Alix
7c8eaebc4f java_binary with kotlin sources
Test:  bp2build conversion tests and inspected build file for AnalyzerKt
Change-Id: I0f6d5c3d371a9dbd000b74144ad68d5d8bd156cf
2023-01-09 20:09:37 +00:00
Spandan Das
64b0fbd151 Merge "Move art's java_system_modules into a shared inner tree" 2023-01-09 17:47:20 +00:00
Matt Gilbride
016d22487f Merge "Configure ObsoleteLintCustomCheck lint as fatal" 2023-01-09 15:48:25 +00:00
Treehugger Robot
4520481c6a Merge changes I07db8afc,Ia89e0239
* changes:
  Stop module types being SdkAware
  Replace usages of SdkAware in sdk module with Module
2023-01-07 14:46:22 +00:00
Treehugger Robot
3c867b6ce8 Merge "Remove SdkAware.SdkMemberComponentName" 2023-01-07 14:36:24 +00:00
Paul Duffin
e76fa00998 Merge "Remove IsModuleInVersionedSdk" 2023-01-06 22:37:59 +00:00
Paul Duffin
5366821635 Merge "Dedup checks for module being in versioned sdk snapshot" 2023-01-06 22:37:15 +00:00
Treehugger Robot
6228be4cd4 Merge "support libs for android_library" 2023-01-06 19:30:02 +00:00
Alix
82fb94e91e support libs for android_library
adds support for *-> android_library and android_library->* edges

Change-Id: I41d4e1d1b8106a17e67951d47e67b59ef3170d17
Test: manually inspected build files for libWallpaperPicker & android-suppor-v4
2023-01-05 21:13:57 +00:00
mattgilbride
69f04a150c Configure ObsoleteLintCustomCheck lint as fatal
Lint raises an issue ObsoleteLintCustomCheck if it detects
incompatibilities between a custom lint check jar and the lint api
itself.

This is a warning by default, but in AOSP it should be fatal.
Any custom checks are expected to run. If they don't, there is risk
of introducing bugs.

ObsoleteLintCustomCheck will now cause build breakage so that it will
be investigated immediately.

Bug: N/A
Test: TH
Change-Id: I3a46c93d5b53ee0e1add7c287af791bd1b41f1c1
2023-01-05 17:44:24 +00:00
Spandan Das
85333078aa Merge "Revert "R8/D8 should use sdk_version prop to determine API surface stability."" 2023-01-05 02:24:16 +00:00
Spandan Das
7eb9243fa7 Revert "R8/D8 should use sdk_version prop to determine API surface stability."
This reverts commit daa220ae8c.

Reason for revert: Suspected to be a cause for build failure (b/264446640). Will use go/abtd to verify

Change-Id: Ibfdf893f2426b1119923467027e0acedd08808c1
2023-01-04 22:14:59 +00:00
Alix Espino
d363771bc1 Merge "Libs support for * -> java_library_edge with kt sources" 2023-01-04 22:11:55 +00:00
Cole Faust
94682b23c4 Merge "Allow adding extra tradefed options in the Android.bp file" 2023-01-04 17:30:38 +00:00
Treehugger Robot
f038e067ee Merge "R8/D8 should use sdk_version prop to determine API surface stability." 2023-01-04 17:04:00 +00:00
Spandan Das
daa220ae8c R8/D8 should use sdk_version prop to determine API surface stability.
`min_sdk_version` is used to represent the api_level of the device and
its type will eventually become android.ApiLevel. OTOH,
`sdk_version` property represents the API surface a module builds against
_and_ the version of that API surface. For
R8/D8, the additional `--android-platform-build` should be determined
using the sdk_version of the soong module and not min_sdk_version, since
min_sdk_version will not contain information about the api surface used
for compilation.

The unit test for `core_platform_app` in TestR8 were passing since
min_sdk_version was not set, and therefore it implicitly defaulted to
sdk_version.

Also created a custom struct to propagate params to the helper dex
functions

Test: In build/soong, go test ./java
Test: TH
Bug: 208456999
Change-Id: I08ac6f496444d603557e498c8a1794af665abc7a
2023-01-04 00:16:45 +00:00
Cole Faust
216805457c Allow adding extra tradefed options in the Android.bp file
Some tests need to add custom tradefed options, but still want to
keep most of the soong autogenerated tradefed xml file.

Expose a test_options: { tradefed_options: [...] } property that
will allow tests to add more options to the autogenerated xml file.

Fixes: 184895128
Test: go test, and verified that the ninja files did not change for aosp_arm64
Change-Id: I50d4ad139322e9e207202f1e1a50f5bbb424aa6f
2023-01-03 12:47:11 -08:00
Spandan Das
87c149dccb Merge "Create (API) bp2build converters for droidstubs" 2022-12-29 17:58:45 +00:00
Treehugger Robot
bb258f4a6d Merge "Don't add dexpreopt compat deps to android_library modules" 2022-12-29 02:49:42 +00:00
Spandan Das
4ac2aed136 Create a "Toolchain" API surface
This creates a new API surface for the APIs provided by ART to compile
other API domains (e.g. this contains LambdaMetaFactory). The scope of
this API surface is restricted to compile-time. Unlike the other API
surfaces (e.g. public) whose APIs will exist on device in the form of
implementation libraries, these classes are not guaranteed to exist on
device.

This also updates the naming convention map used in Multi-tree API
export

Bug: 261244752
Test: TH
Change-Id: I164714d68618a3c289bac1a695958e36fdbbda5d
2022-12-28 23:58:55 +00:00
Spandan Das
0b555e323b Create (API) bp2build converters for droidstubs
- The converter runs for api_bp2build, not bp2build workspace
- Since droidstubs is an internal module created by java_sdk_library,
  the conversion encompasses the latter as well
- Since droidstubs do not have an api_surface attribute, this conversion
  uses naming convention to infer the api_surface represented by the api
  file e.g. *stubs.source -> publicapi, *stubs.source.system -> systemapi)
- Also adds an SdkIntraCore enum to represent the API surface provided
  by one core module to another

There is also ongoing work to check in java_api_contribution modules in
Soong. Once we have that, we can update this converter to operate on
that module type instead

Test: go test ./bp2build
Change-Id: Ia85828e04c738d9ffcc524856d7c3034ee29bbf9
2022-12-28 23:58:52 +00:00
Jihoon Kang
ff878bf121 Set Java version for java_api_library module
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
2022-12-27 19:19:04 +00:00
Colin Cross
4a80a158d4 Don't add dexpreopt compat deps to android_library modules
android_library modules are only dexpreopted when built into an app,
and the app will already get the dexpreopt compat dependencies itself.
Adding the compat dependencies to android_library modules causes
circular dependencies when the android_library is used to build
part of the framework, which is then used to build the compat libraries,
which is added as a dependency to the andorid_library.

Test: TestUsesLibraries
Change-Id: I3aca780858c7e5f19d270bcbbe18e6cff8616b43
2022-12-21 21:56:16 -08:00
Jigar Thakkar
1d174b185f Merge "Revert "Allow adding extra tradefed options in the Android.bp file"" 2022-12-20 16:24:20 +00:00
Jared Duke
5979b30170 Revert "Revert "Include proguard flag files from transitive java_library deps""
This reverts commit 6f7e288fb5.

Reason for revert: Downstream proguard usage has been fixed.

Change-Id: I3667e7e908eebc62c640b42cb96b04993fc66e45
2022-12-19 23:05:28 +00:00
Colin Cross
dd5261c8d8 Fix ALLOW_MISSING_DEPENDENCIES builds for prebuilt JNI libraries
Check for ALLOW_MISSING_DEPENDENCIES before reporting an error
with a prebuilt JNI library missing the required architecture.

Bug: 263138197
Test: lunch aosp_riscv64-userdebug && m
Change-Id: Ifa02c3c690cca1bf7b2b62cf9888f80d96073d71
2022-12-19 12:26:43 -08:00
Tahsin Loqman
77dc7d0839 Revert "Allow adding extra tradefed options in the Android.bp file"
This reverts commit 8ec823cba1.

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

Change-Id: I236cc36981d8b30527ca286632727f8ca267e969
2022-12-19 16:27:25 +00:00
Treehugger Robot
0db300d9da Merge "Add test for missing certificate with AllowMissingDependencies" 2022-12-19 13:11:16 +00:00
Treehugger Robot
2731ca8377 Merge "Allow adding extra tradefed options in the Android.bp file" 2022-12-17 03:40:01 +00:00
Colin Cross
ed8b52ca27 Merge "Revert "Include proguard flag files from transitive java_library deps"" 2022-12-17 03:15:36 +00:00
Colin Cross
6f7e288fb5 Revert "Include proguard flag files from transitive java_library deps"
This reverts commit 9c54f032b9.

Reason for revert: b/262940536

Bug: b/262940536
Change-Id: I8140eacc7ca8716f799561412cb5cef29df35d29
2022-12-17 03:15:22 +00:00
Treehugger Robot
c1260dd095 Merge "Include proguard flag files from transitive java_library deps" 2022-12-17 01:39:08 +00:00
Jared Duke
9c54f032b9 Include proguard flag files from transitive java_library deps
Ensure proguard flag files specified by java_library targets propagate
to downstream targets. This matches bazel behavior, as well as
behavior for transitive android_library deps.

Bug: 212623640
Test: m + presubmit
Change-Id: I61abaf1fd43d6f06bb610383751bb26e9a1bafd6
2022-12-16 14:09:08 -08:00
Alix
266bbf2f9c Libs support for * -> java_library_edge with kt sources
Bug: 244210934
Test: bo2build tests and built kotlinx_atomicfu
Change-Id: Id6eac2f104878e4d7902a32e846ef1cc87dd7863
2022-12-15 06:27:59 +00:00
Colin Cross
db9f1af579 Pass -t epoch to jetifier
Pass -t epoch to jetifier to get reproducible output files from it.

Bug: 262448304
Test: builds
Change-Id: I65d42e5d556f27e15e6700363840857c1a25da74
2022-12-13 15:57:01 -08:00
Sasha Smundak
dcb6129269 Streamline AndroidMk generation
Add AndroidMkEmitAssignList to emit a line to assign the items from
the given list of string arrays.

Test: treehugger
Change-Id: Id5acbef38ea4e91349bd2461f226db352d4b8123
2022-12-12 18:06:49 -08:00
Colin Cross
5caad2b138 Add test for missing certificate with AllowMissingDependencies
Add a test that verifies that that missing certificate path inserted
when AllowMissingDependencies is set uses a well formed extension
that won't trip up sign_target_files_apks.

Fixes: 259861670
Test: TestCertificates
Change-Id: I00656809698aed5f9d3aaadaecda9848d2882223
2022-12-12 15:11:46 -08:00
Paul Duffin
d796f6f6dc Stop module types being SdkAware
Removes all usages of SdkBase and InitSdkAwareModule.

Bug: 260237150
Test: m nothing
Change-Id: I07db8afc805eadbeb5b23f2e1d2f51567eecfab0
2022-12-12 17:33:06 +00:00
Paul Duffin
2178762a8a Remove SdkAware.SdkMemberComponentName
That method was provided to allow a java_sdk_library_import that was
part of a versioned sdk snapshot to create the name of its component
modules consistent with the way in which modules were named within the
sdk snapshot. As versioned sdk snapshots have all been removed this is
no longer necessary.

Bug: 260237150
Test: m nothing
Change-Id: Iee35abd6d210d9a33dfd8ef2f9c77a53329fda24
2022-12-12 17:33:06 +00:00
Paul Duffin
458a15bd8a Remove IsModuleInVersionedSdk
Previously, as all versioned sdk snapshots have been removed from
Android.bp files this method would always return false. This change
effectively replaces all calls to it with false, and then optimizes
away any unused code.

Bug: 260237150
Test: m nothing
Change-Id: I1b717ee8345e807bd888451f6e7e3c3a0d391ee2
2022-12-12 17:33:05 +00:00
Paul Duffin
e3ae3dd6f9 Dedup checks for module being in versioned sdk snapshot
Previously, various places duplicated the logic to check whether a
module was part of a versioned snapshot. This change replaces that code
with a call to the existing IsModuleInVersionedSdk(Module) func.

This makes the code consistent in preparation for a change that will
remove all calls to IsModuleInVersionedSdk(Module). It is separated out
from that change as it is easier to see that the replaced code is
equivalent to the IsModuleInVersionedSdk(Module) func when it is not
mixed in with other changes. It also makes the following change easier
to review.

Bug: 260237150
Test: m nothing
Change-Id: I44d665bf02d2fc97632a03b5a3d2225ea3c2827d
2022-12-12 17:33:05 +00:00
mattgilbride
5aecabec50 Always run AndroidGlobalLintChecker.jar with lint invocations
AndroidGlobalLintChecker.jar provides a set of lint checks
that should be run across the entire tree.

Bug: 236558918
Test: manually tested, treehugger
Change-Id: I2a868f1d78c969eefa2c29477fc8ecab1043df39
2022-12-10 01:07:29 +00:00
Cole Faust
8ec823cba1 Allow adding extra tradefed options in the Android.bp file
Some tests need to add custom tradefed options, but still want to
keep most of the soong autogenerated tradefed xml file.

Expose a test_options: { tradefed_options: [...] } property that
will allow tests to add more options to the autogenerated xml file.

Fixes: 184895128
Test: go test, and verified that the ninja files did not change for aosp_arm64
Change-Id: I75f7eb002c8325ce7cdc76e12e76e16195320620
2022-12-09 15:23:26 -08:00
Spandan Das
fe85ca255d Move art's java_system_modules into a shared inner tree
These will be built using the toolchains of the respective inner tree.
This will eventually allow us to drop them from the module SDK (albeit
we still need to make them work for S/T builds)

Test: TH
Bug: 261476442
Change-Id: I43726a2a171d25ace90dc3ddc73e228ffadfb37c
2022-12-08 02:42:25 +00:00
Treehugger Robot
c7e4dcf1e8 Merge "Set the test suite for Robolectric tests" 2022-12-07 00:49:03 +00:00
Spandan Das
c082eb8eac Add an api_files property in java_api_library
java_api_contribution is useful to java_api_library when the api files
are not colocated.

If they are colocated (e.g. in Multi-tree assembled api_surfaces
directory), it is useful to refer to them directly without nedding to
create a java_api_contribution module.

Test: In build/soong, go test ./java
Change-Id: I5b4e557068a1e5c71a80c76452030e72ec83a696
2022-12-05 22:27:06 +00:00
Parth Sane
0da806fe7a Merge "Add support for AIDL traces in Priv apps" 2022-12-02 15:02:38 +00:00
nelsonli
3f97ea2ed9 Set the test suite for Robolectric tests
Mark Robolectric tests as belonging to the `robolectric-tests` suite
since tools expect test modules to belong to at least one suite.
Note that tests not marked with a suite implicitly get annotated with
the `null-suite`.

This is also required for Atest Bazel mode which only includes files of
test modules with a non-empty suite attribute in the Tradefed test
directory.

See aosp/2181295 for more details.

Test: m out/target/product/vsoc_x86_64/module-info.json
Bug: 222437352
Bug: 228799625
Change-Id: I9dedaf1661a351c32d2affbaf1f9b89d672acc3a
2022-12-02 14:55:57 +08:00
Sasha Smundak
5c4729df93 Show module type in a module section of the Android-TARGET.mk
The first line of each section will be
```
include $(CLEAR_VARS)  # <module type>
...
```

Bug: 257037252
Test: treehugger
Change-Id: Iba586155b682fe4e1e5817d8397eda8f9d9c8789
2022-12-01 21:12:11 -08:00
Treehugger Robot
cdea74d96c Merge "Support testing for resource shrinking" 2022-12-01 06:09:29 +00:00
Alix Espino
9ba98bb9cf Merge "Bp2Build for libs property in java_library" 2022-11-30 17:34:49 +00:00
Jihoon Kang
c05902cff9 Merge "Add phony rule for java_api_library module type" 2022-11-30 17:06:29 +00:00
Jihoon Kang
423d229c3b Add phony rule for java_api_library module type
Context
- Create phony rule for java_api_library module with its artifact
  (*.jar) as dependency
- Fix source directory base mislinkage issue for input text files passed
  from java_api_contributions modules

Test: m
Change-Id: I055332fd5bc7ef0d03e7b311b0efa93f4454102f
2022-11-29 23:37:55 +00:00
Alix
341484b3da Bp2Build for libs property in java_library
Bp2build for both *->java_library and java_library->* edges.

Change-Id: I2540c9af2ae2fe7677767d507647b1c6669b9bb7
Bug: 244210934
Test: ./bp2build testcase, manually inspected build files for hamcrest-library, hamcrest targets
2022-11-29 19:44:50 +00:00
Paul Duffin
45c566591e Merge "Output min_sdk_version to snapshot" 2022-11-29 17:19:54 +00:00
Anton Hansson
805e0a53ef Ignore native bridge archs for apex selection
This leads to an arm64 apex being used on a device that is mixed
x86_64 with nativebridge=arm64. A device like that doesn't appear
to work with arm64 binaries. For example, the boringssl-self-check
binary crashes on boot.

Bug: 260115309
Test: unit test
Test: boot emulator with this combination
Change-Id: Ic4a91974290a05b1799f755fcf52ef226d68f4c2
2022-11-29 12:56:37 +00:00
Jiakai Zhang
2fbc355f47 Only dexpreopt system server jars for the primary arch.
This change stops the build system from dexpreopting system server jars
for the secondary arch. System server jars are only loaded by the system
server, so the artifacts for the the secondary arch are not used.

Bug: 260577273
Test: Build a system image and no longer see artifacts for the
  secondary arch.
Change-Id: I0b131a02e996ed50e7aec3bb0a221f8ceed9ce57
2022-11-28 15:38:23 +00:00
Paul Duffin
bb638eba50 Output min_sdk_version to snapshot
The min_sdk_version was added to the java_import in Tiramisu. This
change will propagate the min_sdk_version set on a java_library to the
java_import snapshot. If possible the min_sdk_version will be resolved
into a numerical version to ensure consistent behavior across build
releases.

Bug: 260560424
Test: m nothing
      BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh
      # Ran above before and after this change and made sure that only
      # Tiramisu, UpsideDownCake and latest were changed and those changes
      # were the addition of a min_sdk_version property.
      #
      # Ran the following command in tm-mainline-prod:
      #     lunch cf_x86_64_phone-userdebug
      #     m ART_MODULE_BUILD_FROM_SOURCE=false nothing`.
      #
      # It failed with:
      #     module "prebuilt_okhttp-norepackage" variant "android_common": should support min_sdk_version(33) for "AdServicesApk": min_sdk_version is not specified.
      #
      # Unpacked the Tiramisu art snapshot generated with this change into
      # tm-mainline-prod and reran the previous command and it succeeded.
Change-Id: I9d9d730845554fc175d17f38c038e4e3c7d39e07
2022-11-26 15:52:32 +00:00
Jihoon Kang
ad8c092c08 Merge "Fix java/fuzz_test.go post submit build breakage" 2022-11-22 23:26:11 +00:00
Jihoon Kang
a2d3947a4e Fix java/fuzz_test.go post submit build breakage
Context
- Fix build breakage in aosp-build-tools for darwin targets

Test: m
Bug: b/260020491
Change-Id: I892876cf1567b4464e86daca0b305510da0ab2fd
2022-11-22 17:51:23 +00:00
Spandan Das
53e680d2ae Merge "Add min_sdk_version to aidlCmd for droidstubs" 2022-11-22 17:09:26 +00:00
Colin Cross
262d65d481 Merge "Remove SettingsOverlay* from legacyCorePlatformApiModules" 2022-11-22 16:39:04 +00:00
Treehugger Robot
657ee23d83 Merge "Pass "-Xgc:CMC" to dex2oat when userfaultfd GC is enabled." 2022-11-22 15:10:20 +00:00
Parth Sane
000cbe0aab Add support for AIDL traces in Priv apps
Change-Id: Iafb6c6fd53ce33f7aa1679db55deec2ec383bea7
Test: Manual
Bug: 236441443
2022-11-22 13:05:19 +00:00
Spandan Das
757b666c7f Add min_sdk_version to aidlCmd for droidstubs
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
2022-11-21 22:59:38 +00:00
Nikita Ioffe
663e060c64 Merge "Propagate stub_only_libs to the invocation generating stub sources" 2022-11-21 22:55:46 +00:00
Jihoon Kang
f33d92603e Merge "Add java/fuzz_test.go to test sources" 2022-11-21 19:29:58 +00:00
Jihoon Kang
ba36441424 Merge "Update java_api_library prop name" 2022-11-21 18:03:12 +00:00
Matt Gilbride
0e2c2aaa60 Merge "lint: always run module specified in ANDROID_LINT_CHECK_EXTRA_MODULES" 2022-11-21 17:38:21 +00:00
Paul Duffin
6fcb32258a Merge "Revert "Improve error reporting when depending on prebuilt implementation jar"" 2022-11-21 17:20:03 +00:00
Nikita Ioffe
d732da7251 Propagate stub_only_libs to the invocation generating stub sources
In some cases the java_sdk_library needs to compile against hidden
platform APIs, in order to do so it needs to add impl_only_libs
dependency on the framework library, and set the sdk_version property to
the "core_*" one (e.g. core_platform).

However, if this java_sdk_library depends on the Android SDK in it's
stable API surface, then the setup above will break the stubs srcs
generation, as it uses the sdk_version of the java_sdk_library (e.g.
core_platform), which doesn't have symbols from the Android SDK.

This chage solves the problem by propagating the stub_only_libs to the
invocation that generates the stub sources. It allows the
java_sdk_libraries to add a stub_only_libs dependency on the
android_module_lib_stubs_current stubs library to fix their stubs build.

For more context see another change in this topic:
https://android-review.git.corp.google.com/c/platform/packages/modules/Virtualization/+/2310569

Bug: 243512044
Test: builds
Test: m nothing
Change-Id: Id745cfb2789901672561050c1c3f8bb163922379
2022-11-21 15:51:40 +00:00
Paul Duffin
7ed6ff8c76 Revert "Improve error reporting when depending on prebuilt implementation jar"
This reverts commit c61783b20d.

Bug: 257969510
Reason for revert: b/255275437 - breaks checkbuild target

Change-Id: I01f88053cc24dbc1a4eb5c009f15473bdff3d565
2022-11-21 10:57:30 +00:00
Colin Cross
a54f4b5262 Use missing.x509.pem instead of missing.pem for faked missing certificates
sign_target_files_apks and check_target_files_signatures require that
certificates have a .x509.pem extension and reject missing.pem.  Using
missing.x509.pem instead.

Bug: 259861670
Change-Id: I0b2367213a8cbe390c231a8609bb04df2b125eda
2022-11-21 04:35:55 +00:00
Jihoon Kang
60d4a09cb5 Update java_api_library prop name
Context
- Update java_api_library module's prop name from api_providers to
  api_contributions to adjust to module rename
- Update variables name correspondingly to enhance readability

Test: m
Change-Id: I93b941a572e04bed6084109d151ba83a82715651
2022-11-19 01:03:03 +00:00
mattgilbride
e17645fe30 lint: always run module specified in ANDROID_LINT_CHECK_EXTRA_MODULES
Before this change, ANDROID_LINT_EXTRA_CHECK_MODULES was only read if
ANDROID_LINT_CHECK was also set.  This change allows an entire module of
checks to be added to lint without having to specify all of the
individuals with ANDROID_LINT_CHECK.

This is part of a workaround to run some lint checks globally, but is
useful to provide more flexibility generally.

Bug: 236558918
Test: manually tested with AndroidFrameworkLintChecker
Change-Id: I2d3ec8a997d902c9d00a577a56f4b152b10e078a
2022-11-18 20:56:05 +00:00
Colin Cross
9e8ab16fae Merge "Remove modules form legacyCorePlatformModules that build in internal master" 2022-11-18 03:35:52 +00:00
Jihoon Kang
5cb82e36be Add java/fuzz_test.go to test sources
Context
- fuzz_test.go is not listed in the soong/java test sources and is not
  running on CI.

Implementation
- Fix fuzz_test.go and add to test sources

Test: m
Change-Id: If2685c646dec4885fc42d7760992309bfa9da382
2022-11-17 21:46:48 +00:00
Colin Cross
148917e5ab Merge "Remove modules from legacyCorePlatformApiModules that build without it" 2022-11-17 18:28:00 +00:00
Jihoon Kang
067e62e49f Merge "Create java_api_contribution and java_api_library module" 2022-11-17 03:55:43 +00:00
Jihoon Kang
0ac87c21bd Create java_api_contribution and java_api_library module
Context
- Droidstubs module is currently responsible not only for java api stubs
  generation, but also for checking api equality and compatibility.
- Generating stubs with incomplete api text file that does not list
  entire api surface is done through metalava implicitly adding unlisted
  methods from java source files to the stubs in droidstubs module.
- These factors make java stubs generation harder to debug, thus
  introduce `java_api_contribution` and `java_api_library` modules to make java
  api stubs and jar generation more explicit in Android.bp level and
  eventually easier to debug.

Implementation
- `java_api_contribution` module is included in api domains' directory and
  lists api text file directory to be added to the api surface
- `java_api_library` collects all api text file that forms the api surface
  and creates stubs invoking metalava. Generated java stub files are
  converted into `.srcjar`, and eventually `.jar` file which is the complete
  api surface.

Test: m
Change-Id: I86f097cc8592334a5eaa900cec12764c5fcc09e7
2022-11-16 23:05:41 +00:00
Colin Cross
bf29be8f19 Merge "Remove modules that don't exist from legacyCorePlatformApiModules" 2022-11-16 18:09:07 +00:00
Colin Cross
e4b131a5da Merge changes I0886baa4,I584f98f9
* changes:
  Sort legacyCorePlatformApiModules
  Remove SystemUI from legacyCorePlatformApiModules
2022-11-16 17:02:01 +00:00
Alix Espino
3044987181 Merge "bp2build for java_library with .kt srcs or common_srcs" 2022-11-16 15:40:55 +00:00
Jiakai Zhang
616be0695e Pass "-Xgc:CMC" to dex2oat when userfaultfd GC is enabled.
This change is a no-op change. It doesn't enable userfaultfd GC by
default. ENABLE_UFFD_GC=true can be passed to the build system to enable
userfaultfd GC for testing purposes.

Bug: 242553398
Test: -
  1. lunch aosp_oriole-userdebug
  2. ENABLE_UFFD_GC=true m
  3. See "--runtime-arg -Xgc:CMC" in .invocation files.
Change-Id: I789b49a71b9604fd41bf1ef77d0ac5bac4cbdf25
2022-11-16 12:04:53 +00:00
Alix
8062f4dee7 bp2build for java_library with .kt srcs or common_srcs
java_library modules with .kt srcs or common_srcs will be converted into
module type kt_jvm_library

Test: m bp2build, manually inspected build files for allowlisted modules
Bug: 258688914
Change-Id: I8293a11c8247b4b76358d0991f82c6b61b58adc3
2022-11-15 20:01:29 +00:00
Parth Sane
d96735d5cc Merge "Add android.SdkModule to Sdk Versions that have AIDL traces generated" 2022-11-15 13:04:42 +00:00
Paul Duffin
c61783b20d Improve error reporting when depending on prebuilt implementation jar
The sdk snapshot must not be including implementation code for boot
libraries, the implementation is provided by dex jars within the
corresponding APEX. However, the snapshot does need a module for each
boot library so that the build can seamlessly access the dex files from
the APEX.

A java_library boot library (like core-oj) is represented in the
snapshot by a java_import module which requires a jar file to be
provided, otherwise it is disabled. However, that is provided purely
to keep Soong happy and should never be used.

Previously, the snapshot would contain an empty file for the jar. As
an empty file is an invalid jar any tool (like compiler) that tried
to consume it would fail which was the correct behavior. Unfortunately,
the error message that was produced was not very helpful, it was just
some variant on `invalid file` which lead to a lot of bugs being
raised.

This change replaces that empty file with a reference to the output
from a genrule which runs a script which produces a more useful error
message, with information on how to fix the issue, and fails the build.

It also adds a Name() method to the SdkMemberProperties type as that is
needed in AddInternalModule() to construct the name of the additional
module.

Tested as follows:

In AOSP/master make the following changes:
1. Temporarily set visibility on core-oj and core-libart to
   //visibility:public.
2. Run packages/modules/common/build/mainline_modules_sdks.py to create
   the snapshots.

For each of the S, T and latest snapshots I did the following in the
s-aml-prebuilt-test, t-aml-prebuilt-test and aosp/master branches:

1. Created an Android.bp file containing the following:
  java_library {
    name: "broken",
    static_libs: [
      "prebuilt_core-libart",
      "prebuilt_core-oj",
    ],
  }

2. Fix the visibility issues and run `m broken` where it fails with an
   invalid file.

3. Delete the contents of the prebuilts/module_sdk/art/current/sdk
   directory.

4. Unpack the relevant version of the art-module-sdk snapshot into the
   directory.

5. Run `m broken` where it fails with the helpful message.

6. Test the instructions on how to use the ninja -t path tool to
   identify the cause of the problem and fix it.

Bug: 257969510
Test: See above.
Change-Id: I125bde2d7202afff84c97daebcef37e21c548a3a
2022-11-14 10:14:10 +00:00
Colin Cross
fe999896d1 Remove SettingsOverlay* from legacyCorePlatformApiModules
Bug: 161973015
Test: go/abtd
Change-Id: I64e44f6892c28313656b834c2a9af4c12c726b89
2022-11-11 20:14:57 -08:00
Colin Cross
f1b91e09ff Remove modules form legacyCorePlatformModules that build in internal master
Remove all modules from legacyCorePlatformApiModules that exist
in internal master and build without the legacy stubs in an
aosp_sunfish-userdebug build.

Bug: 161973015
Test: builds
Change-Id: I2e6248ec0cde0d751f66f32bc7e787b7adbfb75b
2022-11-11 20:14:57 -08:00
Colin Cross
276c7f6243 Remove modules from legacyCorePlatformApiModules that build without it
Remove all modules from legacyCorePlatformApiModules that exist
in AOSP and build without the legacy stubs.  The remaining modules
that exist in AOSP in all products and still need the legacy stubs are:
framework-jobscheduler
framework-minus-apex
framework-minus-apex-intdefs
FrameworksCoreTests
services
services.core.unboosted
Settings-core
SettingsLib
SettingsRoboTests
telephony-common
TeleService

The remainder of the modules still in the list either only exist in
internal master or are product-specific.

Bug: 161973015
Test: builds
Change-Id: I8995670aaaa8dce8e4a870ec1700d1dd7be7c95e
2022-11-11 20:14:55 -08:00
Colin Cross
027e98d756 Remove modules that don't exist from legacyCorePlatformApiModules
Remove modules that don't exist in an internal master
aosp_sunfish-userdebug build and also have no references in
codesearch.

Bug: 161973015
Test: builds
Change-Id: I4372f140b3fc7d6a9cda01a243f200fe084ef099
2022-11-11 20:14:11 -08:00
Colin Cross
b13abbfd9c Sort legacyCorePlatformApiModules
Sort the modules in legacyCorePlatformApiModules to simplify removing
unnecessary entries.  Also remove a comment that doesn't add any value
and makes it harder to run scripts against the list.

Bug: 161973015
Test: builds
Change-Id: I0886baa42209600cfd1e16e5d4919a784efe29ab
2022-11-10 21:47:08 -08:00
Colin Cross
5176044dcc Remove SystemUI from legacyCorePlatformApiModules
SystemUI seems to build fine against the stable core platform API.

Bug: 161973015
Test: m SystemUI-core SystemUISharedLib SystemUI-tests
Change-Id: I584f98f991e0b9c8b1a5dba1fcc1bef0745dbdc0
2022-11-10 16:19:13 -08:00
Parth Sane
a114ac9e75 Add android.SdkModule to Sdk Versions that have AIDL traces generated
Test: manual
Change-Id: Ic5fbe9a6e7dc2c898c0ac3b405d46735ab8c3e32
Bug: 236441443
2022-11-10 15:37:47 +00:00
Qing Shen
871c6f32dd Instrument ims-common for coverage
Bug: 257128599

Change-Id: Ib75fce4582da51d01762f0d338308c4f2410c562
2022-11-04 22:39:56 +00:00
Treehugger Robot
1265bfdfbd Merge "Add .hjar output file tag" 2022-11-02 18:39:58 +00:00
Colin Cross
9f09316ffc HACK: use arm64 prebuilts from apex sets for riscv64
There are no riscv64 prebuilts in apex sets, use arm64 ones for
now.

Test: lunch aosp_riscv64-userdebug && m droid dist
Change-Id: Iee2d669e01d93504642223939857634b7fd1c1ba
2022-11-01 23:16:14 +00:00
Sam Delmerico
af9dbb30f6 Merge "move logtags rule from //build/make to //build/bazel" 2022-11-01 13:50:10 +00:00
Colin Cross
ab50deaefd Add .hjar output file tag
Allow genrules to access the turbine header jar outputs
from java_library modules using the .hjar output file
tag.

Bug: 251871740
Test: m checkbuild
Change-Id: Ib1ec9734323a51583057fb458f791e1e0bd0d767
2022-10-31 17:17:25 -07:00
Treehugger Robot
0fc368cff7 Merge "Generate a default wrapper for device java_binary" 2022-10-31 20:13:10 +00:00
Alix Espino
35ac313c32 Merge "Bp2build Java libs for java_binary -> java_import edge" 2022-10-31 14:04:54 +00:00
Treehugger Robot
6ae9b508bf Merge "Don't add unused properties to android_test_import" 2022-10-31 06:57:45 +00:00
Alix
b4e09a0ada Bp2build Java libs for java_binary -> java_import edge
Since Bazel's java_import requires a jars attribute to be specified,
the generated neverlink-duplicated module is of type java_library

Change-Id: I14a866dfc583507a9462add50d95060cbfe540c5
Bug: 244210934
Test: m bp2build, go test ./bp2build, manual inspection of generated Build and jar files
2022-10-28 20:26:38 +00:00
Zi Wang
ca65b40fa0 Generate a default wrapper for device java_binary
Any device java_binary that doesn't have a specific wrapper must
have a main_class property, which is used to generate its default
wrapper. Otherwise its build should fail.

Bug: 250851599
Test: TestDeviceBinaryWrapperGeneration in java_test.go
Change-Id: Ice4c580bcfc1b92f95e217b39e984c55d25a3a02
2022-10-27 11:19:53 -07:00
Orion Hodson
b2d3c8cac6 Allow all of libcore to have NewApi warnings
Required due to minor refactor of libcore projects.
Bug: 208656169
Bug: 255273691
Test: TH
Change-Id: Ifd2ef6d3553ade5a059880398075c70635d428dd
2022-10-26 15:07:11 +00:00
Liz Kammer
748209cb6b Disable all filegroups in mixed builds
Rather than individually denylisting filegroups until we prioritize a
solution for mixed builds that will correctly integrate into uses such
as proto, aidl, gensrcs, etc.

Test: mixed_droid
Change-Id: Iddbd391af7dd7cabc892b2b26dbc68e3aa506471
2022-10-24 11:11:58 -04:00
Sasha Smundak
706d35fe7c Add --add-exports= options to the java extractor invocation.
Long live Java modules system.

Fixes: 254752344
Test: run build_kzip.bash
Change-Id: I9c807afd22d7b2abc2af1f6ac7a0c1e4c8a8b3e1
2022-10-23 15:23:55 -07:00
Rex Hoffman
54641d2aec Enable new_robolectric
Allow new robolectric to break soong's exepected machine type restrictions

Test: mma in /external/robolectric
Bug: 244627502

Change-Id: If58a36b2d84804d586d9c8a773e2e739867fa987
2022-10-21 17:53:40 +00:00
Muhammad Haseeb Ahmad
c0edf32732 Merge "Output shared dependendencies of JNI libs for Java fuzzers" 2022-10-20 19:16:20 +00:00
Jingwen Chen
6817bbb3c8 Introduce BazelStringOrLabelFromProp.
Soong supports string properties, but they are overloaded, and can mean
one of three things:

* path reference
* module reference
* string literal

Bazel has different types: label and string attributes. Thus there needs
to be a way to categorize them correctly in bp2build.

This CL introduces a new function to be used on properties like
apex_key.private_key / apex_key.public_key, as well as
android_app.certificate / apex.certificate.

It is important to disambiguate the prop betenn a string literal
attribute or file/rule target label attribute, so this functions does
just that.  The new attributes are then further handled by their
respective macros (apex_key, android_binary, apex).

Bug: 253557437
Fixes: 253557437
Test: presubmits, new tests

Change-Id: Id8111cdd60d3aabcae7d17fe9da84d0ee3966023
2022-10-20 14:57:37 +00:00
Jiyong Park
2f83b31af7 Don't add unused properties to android_test_import
android_test_import is to import prebuilt test apks into the build rule.
It doesn't support properties like test_config, test_config_template,
and etc, but those properties were anyhow added to the module type and
setting those properties didn't trigger any error.

Fixing this surprising behavior by adding only the properties that are
actualy being used.

Bug: N/A
Test: N/A

Change-Id: I93e821e108861fa1249bc5e0882d706849bcf43f
2022-10-20 20:19:41 +09:00
Muhammad Haseeb Ahmad
431ddf9b76 Output shared dependendencies of JNI libs for Java fuzzers
Test: m example_java_jni_fuzzer
Bug: 252846698
Change-Id: Ib583de335482350bfe293f9c3d021a595edd4f44
2022-10-20 00:55:58 +00:00
Treehugger Robot
d1c40db794 Merge "Revert "Pin javadoc to JDK 11"" 2022-10-17 21:47:49 +00:00
Sorin Basca
4ad3dc66c3 Revert "Pin javadoc to JDK 11"
Revert submission 2211596

Reason for revert: No longer needed after aosp/2215568

Change-Id: Ia770525501d89baa25e22c2df4fb098d056743f6
2022-10-17 07:56:00 +00:00
Spandan Das
91e8d3d00c Merge "Update documenation for default value of sdk_version" 2022-10-15 04:13:32 +00:00
Treehugger Robot
78a966cadb Merge "Bump up errorprone heap size" 2022-10-15 02:40:25 +00:00
Cole Faust
5aab68524c Bump up errorprone heap size
ag/19500070 causes errorprone to fail with out of memory errors.
Also in aosp/2215048 the regular javac heap sized was increased
to 4096MB, so the errorprone heap size wasn't any larger anymore.

Bug: 240473481
Test: m RUN_ERROR_PRONE=true SystemUIGoogleScreenshotTestsLib on internal master
Change-Id: Ie6bdce9f2e7620c076213f4c3313960fd537967b
2022-10-14 15:54:13 -07:00
Spandan Das
1ccf57474d Update documenation for default value of sdk_version
Follow-up to aosp/2065271. "private" is a Soong internal `SdkKind`
definition and is probably more meaningul for devs who work on
the build system. Changing it to "private platform APIs" should
hopefully make it more meaningful to a wider audience.

(Context: https://yaqs.corp.google.com/eng/q/4927173287831666688)

Test: None
Change-Id: Ied7198bb529eeaa85bc741177b414e06a7262365
2022-10-14 17:25:13 +00:00
Muhammad Haseeb Ahmad
fb7d5c8553 Merge "Build and package Java fuzzers for device" 2022-10-14 06:33:55 +00:00
Muhammad Haseeb Ahmad
eb14ff2a06 Build and package Java fuzzers for device
Bug: 246398305
Test: SANITIZE_TARGET="fuzzer hwaddress" build/soong/soong_ui.bash --make-mode -j86 haiku-java-device dist DIST_DIR="/usr/local/google/home/mhahmad/Desktop/android2/OUT"
Test: SANITIZE_HOST="fuzzer address" build/soong/soong_ui.bash --make-mode -j86 haiku-java-host dist DIST_DIR="/usr/local/google/home/mhahmad/Desktop/android2/OUT"
Change-Id: I52c1a6292f5555490aabcb97a449b6c32d57c074
2022-10-13 16:42:43 +00:00
Cole Faust
49a9bfd8fd Merge "Add system-server sdk type to droidstubs" 2022-10-12 22:49:06 +00:00
Chaohui Wang
7233dac59e Merge "Support Kotlin in Robolectric test" 2022-10-12 01:39:14 +00:00
Colin Cross
1b9e68389d Create suggested-fixes.zip before exiting on error
suggested-fixes.zip is useful even when lint is exiting with an
error.  Save the exit code from the lint executable, create the
zip file, then re-exit with the exit code.

Bug: 216456886
Test: Introduce lint error, verify suggested-fixes.zip is created.
Change-Id: I0ba6190e3de0744e53b2a59ba3016861f2f115e2
2022-10-11 11:22:24 -07:00
Cole Faust
051fa91513 Add system-server sdk type to droidstubs
Needed to generate the system-server api database.

Bug: 193460475
Test: go test
Change-Id: I8c6bb3cc1d16ae128b7bcd2513fce4a83e852a5e
2022-10-11 10:54:11 -07:00
Chaohui Wang
dcbe33ced2 Support Kotlin in Robolectric test
Currently, Robolectric test written in Kotlin may not run, especially
when shards are in used, for example SettingsRoboTests has 10 shards.

This is because Robolectric test currently only recognize java files,
adding kt files to fix.

Rename current uniqueSrcFiles to uniqueJavaFiles, and compiledJavaSrcs
to uniqueSrcFiles. uniqueSrcFiles will contains both Java and Kotlin
files.

Note: android.FirstUniquePaths cannot be used, seems the behavior is
different and cause build error.

Bug: 252355400
Test: cd build/soong && mm
Test: m RunSettingsRoboTests with Kotlin tests
Change-Id: Id530ae4dcabffe01a06f44fe4234ffc67b73a601
2022-10-11 18:14:10 +08:00
Treehugger Robot
8e4a787ae7 Merge "Allow overriding rro category in override_runtime_resource_overlay" 2022-10-07 22:39:26 +00:00
Jeremy Meyer
7e671297c7 Allow overriding rro category in override_runtime_resource_overlay
Bug: 240322840
Test: unit tests
Change-Id: I6b07cf57dc113e3805346e50ef9896471df9f53c
2022-10-07 18:21:34 +00:00
Paul Duffin
85d8bdc10e Properly skip TestBootImageConfig on non-Linux platforms
Bug: 245956352
Test: m nothing
Change-Id: I6402573b378eee77d802829ec5dfacf4c514d3b8
2022-10-07 11:48:17 +01:00
Sorin Basca
538911b686 Merge "Revert^2 "Use the toolchain from JDK 17"" 2022-10-07 05:10:30 +00:00
Paul Duffin
3a56f5e0e0 Skip TestBootImageConfig on non-Linux platforms
Bug: 245956352
Test: m nothing
Change-Id: I4c0bfd24febd308d8efa62da9603795a7e5ed222
2022-10-06 21:39:21 +01:00
Paul Duffin
20d90e3e51 Prevent bootImageVariant.licenseMetadataFile being set twice
Previously, in a build containing source and prebuilt art
bootclasspath_fragments, the bootImageVariant.licenseMetadataFile was
set twice with the source always being set after the prebuilt and
so winning.

This change only sets bootImageVariant.licenseMetadataFile for the
active module so it will use the prebuilt's license file if that is
preferred.

Bug: 245956352
Test: m nothing
Change-Id: I948c7e5123169452f67c85ad98c4bbdb90a5d2de
2022-10-06 11:06:53 +01:00
Paul Duffin
8eb4573b23 Test bootImageConfig/Variant fields
Most of the fields in the bootImageConfig/Variant structs are assigned
inside a Once func so are guaranteed to be only set once. However, some
are assigned outside. This change adds comprehensive tests for those
structs and verifies that the constant fields are preserved and the
mutated fields have the correct value.

The check for the constant fields is added in a new TestBootImageConfig
test.

The check for the mutated fields is added into
TestSnapshotWithBootclasspathFragment_ImageName as that test checks an
art bootclasspath_fragment in the following configurations:
* source on its own
* prebuilt on its own
* source and prebuilt with source preferred
* source and prebuilt with prebuilt

It reveals a couple of interesting facts:
* All the *installs fields are set to the same value irrespective of
  whether the source or prebuilt is preferred. The information is
  constructed solely from information already within the
  bootImageConfig/Variant and so can be moved within Once.

* The licenseMetadataFile is incorrect when prebuilt is preferred.
  That is due to both the source and prebuilt modules setting it and
  the source module always wins as the source module depends on the
  prebuilt so always runs its GenerateAndroidBuildActions after it.

Those issues will be cleaned up in following changes.

Bug: 245956352
Test: m nothing
Change-Id: If917cfbcb3b1c842a8682d51cc1ee1fed1c51add
2022-10-06 11:06:51 +01:00
Paul Duffin
741355826f Add Config,RunningInsideUnitTest
Sometimes it is necessary for some functionality to be disabled while
running in unit tests, e.g. functionality that requires external
information such as error prone tools and configuration. Sometimes it
is necessary for some functionality to be enabled while running in
unit tests, e.g. functionality that makes state available for
testing but which is not necessary at runtime.

Previously, that was done by checking to see if TestProductVariables
was nil. This change adds a method to abstract that.

Bug: 245956352
Test: m nothing
Change-Id: I7845b79328e7180623161a9bf897568089da4e4f
2022-10-06 11:01:59 +01:00
Paul Duffin
298b6b0c19 Merge changes I3c73920d,I03b09e51,I09069828
* changes:
  Remove deviceInstalls from bootImageVariant
  Remove profilePathOnHost from bootImageConfig
  Document bootImageConfig and bootImageVariant structs
2022-10-06 09:20:22 +00:00
Treehugger Robot
8f9ae520e7 Merge "Allow sdk_version: "system_server_current" modules to access module-lib APIs" 2022-10-05 22:05:25 +00:00
Colin Cross
a497606f1d Merge changes I154a6f3a,I79f0c20a,I605ae9af,I647c7305,I95e96e3e, ...
* changes:
  Move fuzzer's CollectAllSharedDependencies into GenerateAndroidBuildActions
  Support AllowMissingDependencies in prebuilt_apex modules
  Support AllowMissingDependencies for apex dependencies
  Add AllowMissingDependencies support for prebuilt_etc module with no src property
  Make OutputFileForModule work for AllowMissingDependencies
  Fix panics when target arch is riscv64
2022-10-05 21:25:17 +00:00
Paul Duffin
d0b9fca6d2 Allow sdk_version: "system_server_current" modules to access module-lib APIs
Previously, a java module with sdk_version: "system_server_current",
would only be able to access the system server or public API of a
java_sdk_library. This change allows it to access the system server,
module lib, system and public APIs in that order.

The apiScope structs define the characteristics of each of the
different API scopes used as required by the java_sdk_library. They are
organized into a hierarchy which is used for two different purposes.

The first purpose is to define an extension hierachy. If scope X
extends Y then X provides a superset of all API elements (classes,
fields, methods, etc) provided by Y. That is reflected in the fact that
the .txt file for X would be a delta on the .txt file for Y. So, system
extends public and so system_current.txt only contains additional API
elements to add to current.txt.

The second purpose is when a java_sdk_library/import is asked to
provide a specific API scope. e.g. a library that has:
    sdk_version: "module_current"
will ask each of the SDK libraries it depends upon for a module-lib
API. However, not all of them will provide an API for that scope. In
that case it will find the closest suitable API scope.

Previously, it did that by traversing up the API extension until it
found an API scope that it did provide and return that. As
system_server_current extended the public API that meant that a library
which has:
    sdk_version: "system_server_current"
would provide a system server API if available, and if not fall
straight back to public. That meant that the library could not access
system or module-lib APIs even though it is running in the system
server which should be able to access all APIs.

One way to fix this would have been to just have system server API
scope extend module-lib but that would have had a number of nasty
side effects:
* It would have created a significant overhead as every module that
  provides a system server API would also have to provide a module-lib
  and system API, along with their corresponding .txt files.
* Each existing java_sdk_library that provided a system server API
  would need those .txt files created.
* Generating sdk snapshots for older releases would have been more
  complicated.
* It would have confused developers.

All of that would be unnecessary because the system server API scope is
intended to be provided by libraries that are used solely by the system
server so there is no point in them providing anything other than a
system server API.

So, instead a separate access hierarchy was added which is the same as
the extension hierarchy for all existing scopes except for the
system server scope, which instead of just being able to access the
public API will be able to access the module-lib scope, which can in
turn access system and it can in turn access public.

That achieves what we want which is a library that is loaded into the
system server to be able to access all API scopes.

Bug: 204176972
Test: m nothing
Change-Id: I854df63fcaeba32afbc1eb0d1a501238022673d0
2022-10-05 17:22:59 +01:00
Jihoon Kang
0b5f7f153f Merge "Specify jnilib partition in Android-<target>.mk" 2022-10-05 16:19:51 +00:00
Paul Duffin
e10a9f2e5e Remove deviceInstalls from bootImageVariant
The use of this field to return information from buildBootImageVariant
up the call stack to one of the callers resulted in data races being
detected. This change simply passes the deviceInstalls up the call
stack.

Bug: 245956352
Test: m nothing
      go test -race ./sdk/... -run TestSnapshotWithBootclasspathFragment_ImageName -test.count 100
      # Run the previous command without this change and sometimes it
      # shows the data race around deviceInstalls. When run with this
      # change it reports no data races.
Change-Id: I3c73920dcb17a6c89a63c6a9c3a0bb049a98a690
2022-10-05 12:33:02 +01:00
Paul Duffin
9f6ac0bb42 Remove profilePathOnHost from bootImageConfig
The use of this field to return information from bootImageProfileRule
up the call stack to one of the users resulted in data races being
detected. This change simply returns the profile path back up the call
stack.

Bug: 245956352
Test: m nothing
      go test -race ./sdk/... -run TestSnapshotWithBootclasspathFragment_ImageName -test.count 100
      # Run the previous command without this change and sometimes it
      # shows the data race around profilePathOnHost. With this change
      # that data race is not reported. Although there is still another
      # data race.
Change-Id: I03b09e514cc94f2a6c9d5117d3b2f130cc2e4f5b
2022-10-05 12:33:02 +01:00
Paul Duffin
a8df7e1c5b Document bootImageConfig and bootImageVariant structs
Add warnings to the structs to explain how they are supposed to be used
and deprecate fields that are used incorrectly.

Bug: 245956352
Test: m nothing
Change-Id: I090698287b96fd37102b88beb5d7252977bddc54
2022-10-05 12:32:02 +01:00
Sorin Basca
7e094b33b7 Revert^2 "Use the toolchain from JDK 17"
This reverts commit be3a561aac.

Reason for revert: Reland switch to JDK 17
Bug: 233029164
Test: TH

Change-Id: Ifa69e3fd50b853153a9c23756269ff12e72d7e9f
2022-10-05 08:23:17 +00:00
Colin Cross
a2aaa2fdef Fix panics when target arch is riscv64
Fix panics in api_level.go and apex.go when using riscv64 as the target
arch.

Bug: 250918230
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing
Change-Id: I85c7685f3d14fa2dc7ffbcdea7f490feca304ef7
2022-10-04 10:53:07 -07:00
Jihoon Kang
f78a890183 Specify jnilib partition in Android-<target>.mk
Context
- Android-<target>.mk currently does not contain information about partition for its dependent unembedded jni libraries, but only lists the name of the unembedded jni libraries.
- If an android_app module depends on an unembedded jni library that is located in a different partition, make cannot find the library.

Implementation
- Create a string field partition in jniLib struct.
- Add variable "LOCAL_SOONG_JNI_LIBS_PARTITION_<target>", an array of mappings of the name of the jni library to its partition.

Bug: 154162945
Test: m
Change-Id: I6b8e1272ff59dc70e3dd6ce8c6c8e4686dad76df
2022-10-04 03:26:05 +00:00
Jingwen Chen
bea58093b4 Share certificate bp2build between android_app and apex.
The certificate module is handled the same in Soong between android apps
and apexes, so share the bp2build code as well.

There are a few changes in this CL:

- If override_apex.certificate is unset, the generated apex also unsets
  it. This prevents the generated apex from using the base apex's
  certificate, which is most likely incorrect (e.g. google variant using
  the cert for the aosp variant). Instead, rely on the default
  certificate handling in the macro.
- If the certificate prop is a string, then it gets generated into
  certificate_name in order to disambiguate. This behavior is identical
  to android_app.

Test: added various unit tests.

Bug: 249089160
Fixes: 249089160
Change-Id: I99e18964ff546429a985d0f64dc21e2c69d35d9d
2022-10-03 09:20:47 +00:00
Ken Sun
44022c867d Merge "Revert "Use the toolchain from JDK 17"" 2022-10-03 03:17:13 +00:00
Ken Sun
be3a561aac Revert "Use the toolchain from JDK 17"
Revert submission 2164342-use-jdk17

Reason for revert: DroidMonitor-triggered revert due to breakage b/250426490

Reverted Changes:
Ib1a24e7ea:Update path for libjli.so
I3375bd4e4:Use the toolchain from JDK 17
I9183e5511:Use the toolchain from JDK 17

Change-Id: I28fc32290dd337b7d44bb98bc52956ee84f01aaa
2022-10-03 03:12:41 +00:00
Sorin Basca
1ea00ebb3e Merge "Use the toolchain from JDK 17" 2022-10-02 19:36:17 +00:00
Treehugger Robot
068910e943 Merge "Fix copy-paste error" 2022-10-01 03:23:56 +00:00
Treehugger Robot
dfd50cc813 Merge "Change deptag for sdk deps to help distinguish" 2022-09-30 22:56:36 +00:00
Pedro Loureiro
33ff1d96fc Fix copy-paste error
Introduced in aosp/1756510

Change-Id: Ib4d0c8fa3c8741bf3e80b8daa53a3d2ce36ce565
Test: presubmit
2022-09-30 17:04:15 +00:00
Liz Kammer
ef28a4c5ce Change deptag for sdk deps to help distinguish
Test: m nothing before and after and diff build.ninja files
Change-Id: Idc4c7f86d3e626bd1ee2f90ae3c6fb755644a605
2022-09-30 11:01:18 -04:00
Sorin Basca
8eac0005c6 Use the toolchain from JDK 17
Bug: 233029164
Test: m
Change-Id: I3375bd4e4186c0049490ee3ddc0f85552d25b579
2022-09-29 11:34:52 +01:00
Paul Duffin
a3be747e5d Merge "java_sdk_library_import: Copy all prebuilt properties to child modules" 2022-09-29 10:28:41 +00:00
Jared Duke
51b0a10229 Support testing for resource shrinking
Add a simple test and add necessary mock dependencies to allow future
resoure shrinking use with platform targets.

Test: m
Bug: 202959019
Change-Id: Id2dd44d52ce5ea62c06784caab0af6276248cb3f
2022-09-28 09:46:35 -07:00
Paul Duffin
bf4de041de java_sdk_library_import: Copy all prebuilt properties to child modules
Previously, only the prefer property was copied from the
java_sdk_library_import module to its child modules which meant that if
the use_source_config_var property was used to control the prefer
property that the child modules would never be used. That can cause
build breakages when building against prebuilts as some parts of the
build will use prebuilt files from java_sdk_library_import and some
will use source files from the corresponding java_sdk_library.

This change copies the use_source_config_var property too.

It also adds tests to verify that dependencies on child modules of a
java_sdk_library use the prebuilt child modules of the corresponding
java_sdk_library_import. That revealed a bug with the handling of stub
sources where the prefer property was set after creating the module
which has also been fixed.

Bug: 249192297
Test: m nothing
      # Cherry pick into branch broken by previous behavior and make
      # sure that it fixes it.
Change-Id: I5719c257f8457bcb2238bc7965215512a20f1095
2022-09-28 13:58:52 +01:00
Cole Faust
3bce294a30 Demote BinderGetCallingInMainThread from an error to a warning
Lint was updated, and adds this new error-level check that we
have preexisting occurances of.

Bug: 247885568
Bug: 249337906
Bug: 249335143
Test: m lint-check on internal master
Change-Id: I88c337dd1e12b2722a97e878b5277201df0c163d
2022-09-27 15:20:01 -07:00
Harshit Mahajan
964a46cb64 Merge "Enforce mainline modules to have latest target sdk version by default." 2022-09-27 17:04:27 +00:00
Cole Faust
085d54469b Merge "Downgrade UnspecifiedImmutableFlag errors to warnings" 2022-09-27 16:35:46 +00:00
Cole Faust
c586109016 Downgrade UnspecifiedImmutableFlag errors to warnings
There are preexisting occurances of it in the source tree.

Bug: 247885568
Test: Presubmits
Change-Id: Ieac1e297414e6abb91460af5da30461d20e7a6ab
2022-09-26 16:22:37 -07:00
Paul Duffin
e840995ac3 java_sdk_library: Use dist_stem when generating sdk snapshot file names
The API finalization process for platform releases copies various files
from the apistubs/ dist directory into prebuilts/sdk/<n>/...  Having
them use the same name in both places makes that process simpler. For
most modules the name of the file is derived from the name of the
module by appending a suffix but unfortunately, for some modules that
does not work. e.g. the conscrypt.txt file is produced by the
conscrypt.module.public.api module. The dist_stem property was added to
java_sdk_library to allow the stem name of the file to differ from the
module name.

The API finalization process for extension APIs does something similar
as it extracts various files from the snapshots and copies them into
the appropriate extension API specific directory in
prebuilts/sdk/extensions/<n>. Instead of copying files from the
apistubs/ dist directory (which is not built for trains) it copies them
from sdk snapshots that are built as part of the train.

Previously, the sdk snapshot used to derive the name of the files
within the snapshot from the name of the module, it ignored the
dist_stem property. This change causes it to use the dist_stem property
to make it consistent with the apistubs/ dist directory naming.

The file name is created in
sdkLibrarySdkMemberProperties.AddPropertyToSet() which does not have
access to the dist_stem property. So, it has to be supplied in the
sdkLibrarySdkMemberProperties instance in the new Stem property.

Bug: 248258460
Test: m nothing
      BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh --build-release=latest
      # Ran the previous command before and after and make sure that the
      # conscrypt, art and icu sdk snapshots use the dist_stem value but
      # none of the other snapshots are affected.
Change-Id: Ied52003de63dcdb86a252a39bb8781f85d51a6ff
2022-09-26 18:32:58 +01:00
Rico Wind
6008155960 Merge "Add soong support for resource shrinking" 2022-09-24 05:19:33 +00:00
Rico Wind
351bac996c Add soong support for resource shrinking
This adds a new flag to the optimize section to allow invoking the resource shrinker

Bug: 246217952
Test: m
Change-Id: I2e7851af1189db2a6adf6f9f9f444a1d7f3a8d60
2022-09-23 19:11:11 +02:00
Anton Hansson
f419277cc5 Merge "Tweak logic for when extension txt is latest" 2022-09-23 10:11:56 +00:00
Treehugger Robot
37ec64f783 Merge "Provide platform build flag to R8/D8" 2022-09-21 21:35:38 +00:00
Harshit Mahajan
5b8b730cdd Enforce mainline modules to have latest target sdk version by default.
Due to GMS target SDK requirements (https://docs.partner.android.com/gms/policies/preview/mba#min-target-sdk)
we need to ensure all the  mainline packages to target latest API
level. Currently, the team chases each module to bump their target
API level.

Updating the build code to make sure that mainline modules
(i.e updatable modules) target the latest sdk version by default.
It would be by default set to 10000 before SDK finalization and updated to the new API level after finalization.

Effectively it would mean:
1. '10000' in aosp and internal master
2. Finalized number in development branches like "33" in "tm-dev"
3. As sdk hasn't been finalised in "udc-dev", it would be "10000"
which would be automatically updated to finalized version after sdk finalization.

For local development if the target sdk version is required to be set,
users would need to set Updatable flag to false.
Enforce_default_target_sdk_version flag needs to be used in bp file,
if this feature needs to be tested locally when updatable: false.

Bug: b/227460469
Test: m nothing
Change-Id: I05e0ae74ae44fd73df75e91b926bcc924446253f
2022-09-21 19:09:38 +00:00
Jared Duke
40d731a4c3 Provide platform build flag to R8/D8
Provide the `--android-platform-build` flag to R8/D8 for targets that do
not specify a stable min SDK. This includes all targets that do not
specificy an SDK version (e.g., services.jar, SystemUI.apk) and all
targets that specify core_platform (e.g., framework.jar).

Follow-up work will expand the set of cases that qualify for this flag,
but for now this captures some of the highest priority targets.

Bug: 232073181
Test: m + presubmit + validate verbose.log
Change-Id: Idad32c80490a101c049b7f937807a615564ca8ef
2022-09-21 11:01:32 -07:00
Paul Duffin
4930389405 Merge "Exclude unsupported libraries from sdk snapshot" 2022-09-21 12:43:47 +00:00
Paul Duffin
4f1128bee4 Merge "Separate hidden API flag info for sdk from platform_bootclasspath" 2022-09-21 12:10:37 +00:00
Paul Duffin
1fdd934df0 Merge "Separate hidden API flag generation from encoding" 2022-09-21 12:10:29 +00:00
Anton Hansson
7212dbef03 Tweak logic for when extension txt is latest
Always use the latest extension as the latest API, regardless of
the current base extension version. This makes it so that we can
bump the base in master without changing which txt is considered
latest.

Also extend the error check to apply more widely (which caught an
error in the extension 3 finalization).

Bug: 228017107
Test: m checkapi (with api break & bumped base)
Test: prebuilt_apis_test.go
Change-Id: Ia10eb41ff500c566736f0d29a29984a99386bb6f
2022-09-21 11:51:21 +00:00
Colin Cross
9f6e6238ef Merge "Move AllowMissingDependencies handling into processMainCert" 2022-09-20 20:15:43 +00:00
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
Colin Cross
bc2c8a7517 Move AllowMissingDependencies handling into processMainCert
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
2022-09-14 12:48:17 -07: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
Paul Duffin
1938dba8b6 Exclude unsupported libraries from sdk snapshot
When an sdk snapshot is targeted at release X then it cannot include
bootclasspath fragment libraries which are not present in that build as
otherwise it causes build failures. It should also not include any
unsupported libraries, i.e. libraries that cannot work on that release.

This change causes sdk snapshot to exclude libraries that have a
    min_sdk_version > target build release

It also ensures that hidden API flags do not include any information
from excluded libraries.

Bug: 240406019
Test: BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change excludes framework-connectivity-t library from the
      # tethering sdk snapshot for S, including from the hidden API flag files.
Change-Id: I57969b85a12e9e5a3fc76c055b260cec5d5f7d7f
2022-09-14 16:47:18 +01:00
Paul Duffin
887efdd779 Separate hidden API flag info for sdk from platform_bootclasspath
Previously, the sdk snapshot and platform_bootclasspath both used the
HiddenAPIInfo/Provider to retrieve the hidden API related information
they needed. This change separates them by adding a new
HiddenAPIInfoForSdk/Provider that is used to provide the information
needed by the sdk snapshot. This allows a follow up change to generate
different information for the sdk and for the platform depending on the
target build release of the sdk snapshot.

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: I30cea6cf8dae1be467b7063430d6197e5baa684b
2022-09-14 16:37:12 +01:00
Paul Duffin
af70518189 Separate hidden API flag generation from encoding
Previously, the rules for encoding hidden API flags into dex files were
generated in the hiddenAPIRulesForBootclasspathFragment alongside the
rules for creating the hidden API flag files.

This change separates the encoding from the generation of the flags.
This will allow a follow up change to generate API flags for the sdk
snapshot separately without affecting the encoded dex files.

Bug: 240406019
Test: m nothing
Change-Id: I3ab3ff5780e7b2e322665d3ea15f1438f2e403bd
2022-09-14 16:07:28 +01: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