platform_build_soong/android/Android.bp
Ronald Braunstein c560309e30 Add test-only and test-target fields to all_teams proto.
The `test-only` flag designates the module contains test-only, not
production code.  In order to generate code-coverage reports, we wanted
a way to filter out code (like java_library) that is test-only and
doesn't need to be in the report.
   The XXX_test modules will have test-only set automatically.
   For modules like `java_library`, users will be a able to set this in
   the Android.bp file.
   As a follow-up, I'll run some queries to find modules that are only
   reachable from top level test targets and mark them test-only as
   appropriate.

`test-only` is being added to the team.proto and will be written via the
`all_teams` target.

Currently, it is challenging to find "all top level test targets".
I'm adding another field to mark the target as a "top level test
target" if it is a XXX_test or XXX_test_host module.  The goal is to
mark all modules the user intended to run as a test, either with
tradefed or directly as a native test.

I added 'module-type/kind' to the proto so I can do some queries:

 gqui from  "flatten(out/soong/ownership/all_teams.pb, teams)" proto team.proto:AllTeams 'select teams.kind, count(*) where teams.top_level_target = true group by teams.kind'
+--------------+----------+
|  teams.kind  | count(*) |
+--------------+----------+
| android_test |     1379 |
| art_cc_test  |       56 |
| cc_benchmark |       68 |
| cc_fuzz      |      515 |
| cc_test      |     3519 |
| cc_test_host |        6 |
| java_fuzz    |        5 |
| java_test    |      773 |
+--------------+----------+

% gqui from  "flatten(~/aosp-main-with-phones/out/soong/ownership/all_teams.pb, teams)" proto team.proto:AllTeams 'select teams.kind ,count(*) where teams.test_only = true group by teams.kind'
+--------------------------+----------+
|        teams.kind        | count(*) |
+--------------------------+----------+
| android_test             |     1379 |
| android_test_helper_app  |     1678 |
| art_cc_test              |       56 |
| art_cc_test_library      |       13 |
| cc_benchmark             |       68 |
| cc_fuzz                  |      515 |
| cc_test                  |     3519 |
| cc_test_host             |        6 |
| cc_test_library          |      484 |
| java_library             |        2 |
| java_test                |      773 |
| java_test_helper_library |       29 |
+--------------------------+----------+

All modules can be seen here: https://docs.google.com/spreadsheets/d/1Zqbh7lDDdlI1xVmrN9fZ8bm8XD7EoORjjiPqbMvAKgQ/edit#gid=396553017

FOLLOW UP cls:
  *) Add more top level tests, like sh_test and python_test
  *) Add validation so that only modules currently marked test-only
     can depend on modules marked test-only
  *) Remove test_spec, code_metadata, TestModuleProviderKey: aosp/2928500

Test: go test ./java ./cc ./android
Test: m blueprint_tests
Test: m nothing --no-skip-soong-tests
    !!  android already failing on selects_test
Test: m all_teams  && gqui from  "flatten(out/soong/ownership/all_teams.pb, teams)"

Change-Id: Ib97dca60989aa9d7f000727c92af2e354926f072
2024-04-09 16:36:29 -07:00

145 lines
3.6 KiB
Text

package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
bootstrap_go_package {
name: "soong-android",
pkgPath: "android/soong/android",
deps: [
"blueprint",
"blueprint-bootstrap",
"blueprint-metrics",
"sbox_proto",
"soong",
"soong-android_team_proto",
"soong-android-soongconfig",
"soong-remoteexec",
"soong-response",
"soong-shared",
"soong-starlark-format",
"soong-ui-metrics_proto",
"soong-android-allowlists",
"golang-protobuf-proto",
"golang-protobuf-encoding-prototext",
// Only used for tests.
"androidmk-parser",
],
srcs: [
"aconfig_providers.go",
"all_teams.go",
"androidmk.go",
"apex.go",
"apex_contributions.go",
"api_domain.go",
"api_levels.go",
"arch.go",
"arch_list.go",
"arch_module_context.go",
"base_module_context.go",
"buildinfo_prop.go",
"config.go",
"test_config.go",
"configured_jars.go",
"csuite_config.go",
"deapexer.go",
"defaults.go",
"defs.go",
"depset_generic.go",
"deptag.go",
"early_module_context.go",
"expand.go",
"filegroup.go",
"fixture.go",
"gen_notice.go",
"hooks.go",
"image.go",
"license.go",
"license_kind.go",
"license_metadata.go",
"license_sdk_member.go",
"licenses.go",
"makevars.go",
"metrics.go",
"module.go",
"module_context.go",
"module_info_json.go",
"mutator.go",
"namespace.go",
"neverallow.go",
"ninja_deps.go",
"notices.go",
"onceper.go",
"override_module.go",
"package.go",
"package_ctx.go",
"packaging.go",
"path_properties.go",
"paths.go",
"phony.go",
"plugin.go",
"prebuilt.go",
"prebuilt_build_tool.go",
"proto.go",
"provider.go",
"raw_files.go",
"register.go",
"rule_builder.go",
"sandbox.go",
"sdk.go",
"sdk_version.go",
"shared_properties.go",
"singleton.go",
"singleton_module.go",
"soong_config_modules.go",
"team.go",
"test_asserts.go",
"test_suites.go",
"testing.go",
"updatable_modules.go",
"util.go",
"variable.go",
"visibility.go",
],
testSrcs: [
"all_teams_test.go",
"android_test.go",
"androidmk_test.go",
"apex_test.go",
"arch_test.go",
"config_test.go",
"configured_jars_test.go",
"csuite_config_test.go",
"defaults_test.go",
"depset_test.go",
"deptag_test.go",
"expand_test.go",
"filegroup_test.go",
"fixture_test.go",
"gen_notice_test.go",
"license_kind_test.go",
"license_test.go",
"licenses_test.go",
"module_test.go",
"mutator_test.go",
"namespace_test.go",
"neverallow_test.go",
"ninja_deps_test.go",
"onceper_test.go",
"package_test.go",
"packaging_test.go",
"path_properties_test.go",
"paths_test.go",
"prebuilt_test.go",
"rule_builder_test.go",
"sdk_version_test.go",
"sdk_test.go",
"selects_test.go",
"singleton_module_test.go",
"soong_config_modules_test.go",
"util_test.go",
"variable_test.go",
"visibility_test.go",
],
}