Merge "rust: Bundle Rust shared dependencies in fuzzers"
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 0dd7dae..ddc8807 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -141,6 +141,7 @@
"external/f2fs-tools": Bp2BuildDefaultTrue,
"external/flac": Bp2BuildDefaultTrueRecursively,
"external/fmtlib": Bp2BuildDefaultTrueRecursively,
+ "external/fsverity-utils": Bp2BuildDefaultTrueRecursively,
"external/guava": Bp2BuildDefaultTrueRecursively,
"external/google-benchmark": Bp2BuildDefaultTrueRecursively,
"external/googletest": Bp2BuildDefaultTrueRecursively,
@@ -346,6 +347,7 @@
"system/core/libprocessgroup": Bp2BuildDefaultTrue,
"system/core/libprocessgroup/cgrouprc": Bp2BuildDefaultTrue,
"system/core/libprocessgroup/cgrouprc_format": Bp2BuildDefaultTrue,
+ "system/core/libsparse": Bp2BuildDefaultTrueRecursively,
"system/core/libsuspend": Bp2BuildDefaultTrue,
"system/core/libsystem": Bp2BuildDefaultTrueRecursively,
"system/core/libsysutils": Bp2BuildDefaultTrueRecursively,
@@ -354,7 +356,9 @@
"system/core/mkbootfs": Bp2BuildDefaultTrueRecursively,
"system/core/property_service/libpropertyinfoparser": Bp2BuildDefaultTrueRecursively,
"system/core/property_service/libpropertyinfoserializer": Bp2BuildDefaultTrueRecursively,
+ "system/extras/f2fs_utils": Bp2BuildDefaultTrueRecursively,
"system/extras/toolchain-extras": Bp2BuildDefaultTrue,
+ "system/extras/verity": Bp2BuildDefaultTrueRecursively,
"system/hardware/interfaces/media": Bp2BuildDefaultTrueRecursively,
"system/incremental_delivery/incfs": Bp2BuildDefaultTrue,
"system/libartpalette": Bp2BuildDefaultTrueRecursively,
@@ -384,6 +388,7 @@
"system/memory/libion": Bp2BuildDefaultTrueRecursively,
"system/memory/libmemunreachable": Bp2BuildDefaultTrueRecursively,
"system/sepolicy/apex": Bp2BuildDefaultTrueRecursively,
+ "system/security/fsverity": Bp2BuildDefaultTrueRecursively,
"system/testing/gtest_extras": Bp2BuildDefaultTrueRecursively,
"system/timezone/apex": Bp2BuildDefaultTrueRecursively,
"system/timezone/output_data": Bp2BuildDefaultTrueRecursively,
@@ -456,6 +461,9 @@
// TODO(b/266459895): remove this and the placeholder BUILD file after re-enabling libunwindstack
"external/rust/crates/rustc-demangle-capi":/* recursive = */ false,
+
+ // Used for testing purposes only. Should not actually exist in the real source tree.
+ "testpkg/keep_build_file":/* recursive = */ false,
}
Bp2buildModuleAlwaysConvertList = []string{
@@ -477,6 +485,7 @@
"code_coverage.policy",
"code_coverage.policy.other",
"codec2_soft_exports",
+ "compatibility_matrix_schema",
"flatbuffer_headers",
"framework-connectivity-protos",
"gemmlowp_headers",
@@ -576,12 +585,11 @@
//frameworks/base/core/java
"IDropBoxManagerService_aidl",
- //system/core/libsparse
- "libsparse",
-
//system/extras/ext4_utils
"libext4_utils",
"mke2fs_conf",
+ "mkuserimg_mke2fs",
+ "blk_alloc_to_base_fs",
//system/extras/libfec
"libfec",
@@ -589,10 +597,6 @@
//system/extras/squashfs_utils
"libsquashfs_utils",
- //system/extras/verity/fec
- "fec",
- "boot_signer",
-
//packages/apps/Car/libs/car-ui-lib/car-ui-androidx
// genrule dependencies for java_imports
"car-ui-androidx-annotation-nodeps",
@@ -769,6 +773,27 @@
// Used by xsd_config
"xsdc",
+
+ // cc_test that can be run by b test
+ "binderRpcWireProtocolTest",
+ "binderUnitTest",
+ "cpu_features-bit_utils_test",
+ "liblp_test",
+ "android.hardware.audio.common.test.utility_tests",
+ "HalAudioStreamWorkerTest",
+ "libjavacore-unit-tests",
+ "NeuralNetworksTest_utils",
+ "NeuralNetworksTest_logtag",
+ "NeuralNetworksTest_operations",
+ "nanoapp_chqts_shared_tests",
+ "fakeservicemanager_test",
+ "tristate_test",
+ "binderUtilsHostTest",
+ "run_dex2oat_test",
+ "bluetooth-address-unit-tests",
+
+ // for platform_compat_config
+ "process-compat-config",
}
Bp2buildModuleTypeAlwaysConvertList = []string{
@@ -781,6 +806,7 @@
"java_import_host",
"java_sdk_library",
"sysprop_library",
+ "xsd_config",
}
// Add the names of modules that bp2build should never convert, if it is
@@ -814,7 +840,6 @@
"linker", // TODO(b/228316882): cc_binary uses link_crt
"versioner", // TODO(b/228313961): depends on prebuilt shared library libclang-cpp_host as a shared library, which does not supply expected providers for a shared library
- "tjbench", // TODO(b/240563612): Stem property
// requires host tools for apexer
"apexer_test", "apexer_test_host_tools", "host_apex_verifier",
@@ -823,9 +848,6 @@
"libbase_ndk", // TODO(b/186826477): fails to link libctscamera2_jni for device (required for CtsCameraTestCases)
"bouncycastle", // TODO(b/274474005): Need support for custom system_modules.
- // python protos
- "libprotobuf-python", // Has a handcrafted alternative
-
// genrule incompatibilities
"brotli-fuzzer-corpus", // TODO(b/202015218): outputs are in location incompatible with bazel genrule handling.
"platform_tools_properties", "build_tools_source_properties", // TODO(b/203369847): multiple genrules in the same package creating the same file
@@ -850,9 +872,6 @@
"host_bionic_linker_asm", // depends on extract_linker, a go binary.
"host_bionic_linker_script", // depends on extract_linker, a go binary.
- // in cmd attribute of genrule rule //system/timezone/output_data:robolectric_tzdata: label '//system/timezone/output_data:iana/tzdata' in $(location) expression is not a declared prerequisite of this rule
- "robolectric_tzdata",
-
// rust support
"libtombstoned_client_rust_bridge_code", "libtombstoned_client_wrapper", // rust conversions are not supported
@@ -900,8 +919,6 @@
"static_crasher", // depends on unconverted modules: libdebuggerd_handler
"test_fips", // depends on unconverted modules: adb
"timezone-host", // depends on unconverted modules: art.module.api.annotations
- "truth-host-prebuilt", // depends on unconverted modules: truth-prebuilt
- "truth-prebuilt", // depends on unconverted modules: asm-7.0, guava
// '//bionic/libc:libc_bp2build_cc_library_static' is duplicated in the 'deps' attribute of rule
"toybox-static",
@@ -948,12 +965,10 @@
"svcenc", "svcdec",
// Failing host cc_tests
- "memunreachable_unit_test",
"libprocinfo_test",
"ziparchive-tests",
"gtest_isolated_tests",
"libunwindstack_unit_test",
- "task_profiles_test",
"power_tests", // failing test on server, but not on host
// reflect: call of reflect.Value.NumField on interface Value
@@ -1033,7 +1048,6 @@
"libBionicLoaderTests", // depends on unconverted modules: libmeminfo
"libapexutil_tests", // depends on unconverted modules: apex-info-list-tinyxml, libapexutil
"libcutils_sockets_test",
- "libexpectedutils_test",
"libhwbinder_latency",
"liblog-host-test", // failing tests
"libminijail_test",
@@ -1070,7 +1084,6 @@
"scudo_unit_tests",
"stats-log-api-gen-test", // depends on unconverted modules: libstats_proto_host
"syscall_filter_unittest_gtest",
- "sysprop_test", // depends on unconverted modules: libcom.android.sysprop.tests
"thread_exit_cb_helper",
"tls_properties_helper",
"ulp",
@@ -1414,16 +1427,12 @@
"merge_ota",
// releasetools
- "releasetools_fsverity_metadata_generator",
"verity_utils",
"check_ota_package_signature",
"check_target_files_vintf",
"releasetools_check_target_files_vintf",
- "releasetools_verity_utils",
- "build_image",
"ota_from_target_files",
"releasetools_ota_from_target_files",
- "releasetools_build_image",
"add_img_to_target_files",
"releasetools_add_img_to_target_files",
"fsverity_metadata_generator",
@@ -1470,6 +1479,22 @@
// python_test_host with test data
"sbom_writers_test",
+
+ // TODO(B/283193845): tradefed and its java_test_host dependents
+ "tradefed",
+ "permissive_mte_test",
+ "ICU4CTestRunner",
+
+ "HelloWorldHostTest", // TODO(b/280452825): Convert HelloWorldHostTest to b test
+
+ "libprotobuf-full-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
+ "libprotobuf-lite-test", // TODO(b/246997908): cannot convert proto_libraries which implicitly include other srcs in the same directory
+
+ // depends on other //art modules
+ "libart-for-test",
+ "libart_generated_headers",
+ "libart-runtime-gtest",
+ "libartd-runtime-gtest",
}
MixedBuildsDisabledList = []string{
@@ -1489,9 +1514,6 @@
"libadb_pairing_connection_static",
"libadb_pairing_server", "libadb_pairing_server_static",
- // TODO(b/240563612) Needing `stem` selection support for cc_binary
- "crasher",
-
// java_import[_host] issues
// tradefed prebuilts depend on libprotobuf
"prebuilt_tradefed",
@@ -1588,12 +1610,13 @@
}
// These should be the libs that are included by the apexes in the StagingMixedBuildsEnabledList
- StagingDclaMixedBuildsEnabledList = []string{}
+ StagingDclaMixedBuildsEnabledList = []string{
+ "libstagefright_flacdec",
+ "libutils",
+ }
// TODO(b/269342245): Enable the rest of the DCLA libs
// "libssl",
- // "libstagefright_flacdec",
- // "libutils",
// The list of module types which are expected to spend lots of build time.
// With `--ninja_weight_source=soong`, ninja builds these module types and deps first.
diff --git a/android/bazel.go b/android/bazel.go
index d326634..e631ed4 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -537,6 +537,12 @@
}
func convertWithBp2build(ctx TopDownMutatorContext) {
+ if ctx.Config().HasBazelBuildTargetInSource(ctx) {
+ // Defer to the BUILD target. Generating an additional target would
+ // cause a BUILD file conflict.
+ return
+ }
+
bModule, ok := ctx.Module().(Bazelable)
if !ok || !bModule.shouldConvertWithBp2build(ctx, ctx.Module()) {
return
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index d71eca2..4645e6b 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -187,6 +187,9 @@
// Returns the results of the GetCcUnstrippedInfo query
GetCcUnstrippedInfo(label string, cfgkey configKey) (cquery.CcUnstrippedInfo, error)
+ // Returns the results of the GetPrebuiltFileInfo query
+ GetPrebuiltFileInfo(label string, cfgKey configKey) (cquery.PrebuiltFileInfo, error)
+
// ** end Cquery Results Retrieval Functions
// Issues commands to Bazel to receive results for all cquery requests
@@ -272,11 +275,12 @@
type MockBazelContext struct {
OutputBaseDir string
- LabelToOutputFiles map[string][]string
- LabelToCcInfo map[string]cquery.CcInfo
- LabelToPythonBinary map[string]string
- LabelToApexInfo map[string]cquery.ApexInfo
- LabelToCcBinary map[string]cquery.CcUnstrippedInfo
+ LabelToOutputFiles map[string][]string
+ LabelToCcInfo map[string]cquery.CcInfo
+ LabelToPythonBinary map[string]string
+ LabelToApexInfo map[string]cquery.ApexInfo
+ LabelToCcBinary map[string]cquery.CcUnstrippedInfo
+ LabelToPrebuiltFileInfo map[string]cquery.PrebuiltFileInfo
BazelRequests map[string]bool
}
@@ -325,6 +329,14 @@
return result, nil
}
+func (m MockBazelContext) GetPrebuiltFileInfo(label string, _ configKey) (cquery.PrebuiltFileInfo, error) {
+ result, ok := m.LabelToPrebuiltFileInfo[label]
+ if !ok {
+ return cquery.PrebuiltFileInfo{}, fmt.Errorf("no target with label %q in LabelToPrebuiltFileInfo", label)
+ }
+ return result, nil
+}
+
func (m MockBazelContext) InvokeBazel(_ Config, _ invokeBazelContext) error {
panic("unimplemented")
}
@@ -433,6 +445,14 @@
return cquery.CcUnstrippedInfo{}, fmt.Errorf("no bazel response for %s", key)
}
+func (bazelCtx *mixedBuildBazelContext) GetPrebuiltFileInfo(label string, cfgKey configKey) (cquery.PrebuiltFileInfo, error) {
+ key := makeCqueryKey(label, cquery.GetPrebuiltFileInfo, cfgKey)
+ if rawString, ok := bazelCtx.results[key]; ok {
+ return cquery.GetPrebuiltFileInfo.ParseResult(strings.TrimSpace(rawString))
+ }
+ return cquery.PrebuiltFileInfo{}, fmt.Errorf("no bazel response for %s", key)
+}
+
func (n noopBazelContext) QueueBazelRequest(_ string, _ cqueryRequest, _ configKey) {
panic("unimplemented")
}
@@ -454,6 +474,10 @@
panic("implement me")
}
+func (n noopBazelContext) GetPrebuiltFileInfo(_ string, _ configKey) (cquery.PrebuiltFileInfo, error) {
+ panic("implement me")
+}
+
func (n noopBazelContext) InvokeBazel(_ Config, _ invokeBazelContext) error {
panic("unimplemented")
}
@@ -665,26 +689,20 @@
func (context *mixedBuildBazelContext) createBazelCommand(config Config, runName bazel.RunName, command bazelCommand,
extraFlags ...string) bazel.CmdRequest {
+ if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
+ panic("Unknown GOOS: " + runtime.GOOS)
+ }
cmdFlags := []string{
"--output_base=" + absolutePath(context.paths.outputBase),
command.command,
command.expression,
"--profile=" + shared.BazelMetricsFilename(context.paths, runName),
- // We don't need to set --host_platforms because it's set in bazelrc files
- // that the bazel shell script wrapper passes
-
- // Optimize Ninja rebuilds by ensuring Bazel write into product-agnostic
- // output paths for the configured targets that shouldn't be affected by
- // TARGET_PRODUCT. Otherwise product agnostic modules will be rebuilt by
- // Ninja when the product changes, unconditionally.
- //
- // For example, Mainline APEXes should be identical regardless of the
- // product (modulo arch/cpu).
- //
- // This flag forcibly disables the platform prefix in the intermediate
- // outputs during a mixed build.
- "--noexperimental_platform_in_output_dir",
+ "--host_platform=@soong_injection//product_config_platforms:mixed_builds_product-" + context.targetBuildVariant + "_" + runtime.GOOS + "_x86_64",
+ // Don't specify --platforms, because on some products/branches (like kernel-build-tools)
+ // the main platform for mixed_builds_product-variant doesn't exist because an arch isn't
+ // specified in product config. The derivative platforms that config_node transitions into
+ // will still work.
// Suppress noise
"--ui_event_filters=-INFO",
@@ -731,9 +749,9 @@
#####################################################
def _config_node_transition_impl(settings, attr):
if attr.os == "android" and attr.arch == "target":
- target = "current_product-{VARIANT}"
+ target = "mixed_builds_product-{VARIANT}"
else:
- target = "current_product-{VARIANT}_%s_%s" % (attr.os, attr.arch)
+ target = "mixed_builds_product-{VARIANT}_%s_%s" % (attr.os, attr.arch)
apex_name = ""
if attr.within_apex:
# //build/bazel/rules/apex:apex_name has to be set to a non_empty value,
@@ -970,9 +988,9 @@
platform_name = platforms[0].name
if platform_name == "host":
return "HOST"
- if not platform_name.startswith("current_product-{TARGET_BUILD_VARIANT}"):
- fail("expected platform name of the form 'current_product-{TARGET_BUILD_VARIANT}_android_<arch>' or 'current_product-{TARGET_BUILD_VARIANT}_linux_<arch>', but was " + str(platforms))
- platform_name = platform_name.removeprefix("current_product-{TARGET_BUILD_VARIANT}").removeprefix("_")
+ if not platform_name.startswith("mixed_builds_product-{TARGET_BUILD_VARIANT}"):
+ fail("expected platform name of the form 'mixed_builds_product-{TARGET_BUILD_VARIANT}_android_<arch>' or 'mixed_builds_product-{TARGET_BUILD_VARIANT}_linux_<arch>', but was " + str(platforms))
+ platform_name = platform_name.removeprefix("mixed_builds_product-{TARGET_BUILD_VARIANT}").removeprefix("_")
config_key = ""
if not platform_name:
config_key = "target|android"
@@ -981,7 +999,7 @@
elif platform_name.startswith("linux_"):
config_key = platform_name.removeprefix("linux_") + "|linux"
else:
- fail("expected platform name of the form 'current_product-{TARGET_BUILD_VARIANT}_android_<arch>' or 'current_product-{TARGET_BUILD_VARIANT}_linux_<arch>', but was " + str(platforms))
+ fail("expected platform name of the form 'mixed_builds_product-{TARGET_BUILD_VARIANT}_android_<arch>' or 'mixed_builds_product-{TARGET_BUILD_VARIANT}_linux_<arch>', but was " + str(platforms))
within_apex = buildoptions.get("//build/bazel/rules/apex:within_apex")
apex_sdk_version = buildoptions.get("//build/bazel/rules/apex:min_sdk_version")
diff --git a/android/bazel_paths.go b/android/bazel_paths.go
index ddbdbd4..872e908 100644
--- a/android/bazel_paths.go
+++ b/android/bazel_paths.go
@@ -242,6 +242,11 @@
// Don't transform OriginalModuleName
newPath.OriginalModuleName = path.OriginalModuleName
+ // if it wasn't a module, store the original path. We may need the original path to replace
+ // references if it is actually in another package
+ if path.OriginalModuleName == "" {
+ newPath.OriginalModuleName = path.Label
+ }
if strings.HasPrefix(path.Label, "//") {
// Assume absolute labels are already correct (e.g. //path/to/some/package:foo.h)
diff --git a/android/config.go b/android/config.go
index bed57e3..90dbe0b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -291,6 +291,10 @@
// "--bazel-force-enabled-modules"
bazelForceEnabledModules map[string]struct{}
+ // Names of Bazel targets as defined by BUILD files in the source tree,
+ // keyed by the directory in which they are defined.
+ bazelTargetsByDir map[string][]string
+
// If true, for any requests to Bazel, communicate with a Bazel proxy using
// unix sockets, instead of spawning Bazel as a subprocess.
UseBazelProxy bool
@@ -517,6 +521,8 @@
config: config,
}
+ config.productVariables.Build_from_text_stub = boolPtr(config.buildFromTextStub)
+
// Soundness check of the build and source directories. This won't catch strange
// configurations with symlinks, but at least checks the obvious case.
absBuildDir, err := filepath.Abs(cmdArgs.SoongOutDir)
@@ -1710,10 +1716,6 @@
return c.productVariables.ProductPrivateSepolicyDirs
}
-func (c *config) MissingUsesLibraries() []string {
- return c.productVariables.MissingUsesLibraries
-}
-
func (c *config) TargetMultitreeUpdateMeta() bool {
return c.productVariables.MultitreeUpdateMeta
}
@@ -1929,6 +1931,10 @@
return InList(name, c.config.productVariables.BuildBrokenInputDirModules)
}
+func (c *config) BuildWarningBadOptionalUsesLibsAllowlist() []string {
+ return c.productVariables.BuildWarningBadOptionalUsesLibsAllowlist
+}
+
func (c *deviceConfig) GenruleSandboxing() bool {
return Bool(c.config.productVariables.GenruleSandboxing)
}
@@ -1941,10 +1947,6 @@
return c.productVariables.SelinuxIgnoreNeverallows
}
-func (c *deviceConfig) SepolicySplit() bool {
- return c.config.productVariables.SepolicySplit
-}
-
func (c *deviceConfig) SepolicyFreezeTestExtraDirs() []string {
return c.config.productVariables.SepolicyFreezeTestExtraDirs
}
@@ -2004,6 +2006,20 @@
}
}
+func (c *config) HasBazelBuildTargetInSource(ctx BaseModuleContext) bool {
+ moduleName := ctx.Module().Name()
+ for _, buildTarget := range c.bazelTargetsByDir[ctx.ModuleDir()] {
+ if moduleName == buildTarget {
+ return true
+ }
+ }
+ return false
+}
+
+func (c *config) SetBazelBuildFileTargets(bazelTargetsByDir map[string][]string) {
+ c.bazelTargetsByDir = bazelTargetsByDir
+}
+
// ApiSurfaces directory returns the source path inside the api_surfaces repo
// (relative to workspace root).
func (c *config) ApiSurfacesDir(s ApiSurface, version string) string {
@@ -2021,6 +2037,7 @@
func (c *config) SetBuildFromTextStub(b bool) {
c.buildFromTextStub = b
+ c.productVariables.Build_from_text_stub = boolPtr(b)
}
func (c *config) AddForceEnabledModules(forceEnabled []string) {
diff --git a/android/module.go b/android/module.go
index 98084f3..ba32710 100644
--- a/android/module.go
+++ b/android/module.go
@@ -4014,3 +4014,53 @@
WriteFileRule(ctx, outFile, string(j))
ctx.Phony("soong_config_trace", outFile)
}
+
+// Interface implemented by xsd_config which has 1:many mappings in bp2build workspace
+// This interface exists because we want to
+// 1. Determine the name of the additional targets generated by the primary soong module
+// 2. Enable distinguishing an xsd_config module from other Soong modules using type assertion
+type XsdConfigBp2buildTargets interface {
+ CppBp2buildTargetName() string
+ JavaBp2buildTargetName() string
+}
+
+// PartitionXsdSrcs partitions srcs into xsd_config modules and others
+// Since xsd_config are soong modules, we cannot use file extension for partitioning
+func PartitionXsdSrcs(ctx BazelConversionPathContext, srcs []string) ([]string, []string) {
+ //isXsd returns true if src is a soong module of type xsd_config
+ isXsd := func(src string) bool {
+ mod, exists := ctx.ModuleFromName(src)
+ if !exists {
+ return false
+ }
+ _, _isXsd := mod.(XsdConfigBp2buildTargets)
+ return _isXsd
+ }
+ nonXsd := []string{}
+ xsd := []string{}
+
+ for _, src := range srcs {
+ if isXsd(src) {
+ xsd = append(xsd, src)
+ } else {
+ nonXsd = append(nonXsd, src)
+ }
+ }
+
+ return nonXsd, xsd
+}
+
+// Replaces //a/b/my_xsd_config with //a/b/my_xsd_config-{cpp|java}
+// The new target name is provided by the `targetName` callback function
+func XsdConfigBp2buildTarget(ctx BazelConversionPathContext, mod blueprint.Module, targetName func(xsd XsdConfigBp2buildTargets) string) string {
+ xsd, isXsd := mod.(XsdConfigBp2buildTargets)
+ if !isXsd {
+ ctx.ModuleErrorf("xsdConfigJavaTarget called on %v, which is not an xsd_config", mod)
+ }
+ ret := BazelModuleLabel(ctx, mod)
+ // Remove the base module name
+ ret = strings.TrimSuffix(ret, mod.Name())
+ // Append the language specific target name
+ ret += targetName(xsd)
+ return ret
+}
diff --git a/android/neverallow.go b/android/neverallow.go
index 5b5e613..f2e8c85 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -59,6 +59,7 @@
AddNeverAllowRules(createProhibitFrameworkAccessRules()...)
AddNeverAllowRules(createBp2BuildRule())
AddNeverAllowRules(createCcStubsRule())
+ AddNeverAllowRules(createJavaExcludeStaticLibsRule())
}
// Add a NeverAllow rule to the set of rules to apply.
@@ -253,6 +254,14 @@
}
}
+func createJavaExcludeStaticLibsRule() Rule {
+ return NeverAllow().
+ NotIn("build/soong").
+ ModuleType("java_library").
+ WithMatcher("exclude_static_libs", isSetMatcherInstance).
+ Because("exclude_static_libs property is only allowed for java modules defined in build/soong")
+}
+
func neverallowMutator(ctx BottomUpMutatorContext) {
m, ok := ctx.Module().(Module)
if !ok {
diff --git a/android/neverallow_test.go b/android/neverallow_test.go
index ddd982d..1639bbf 100644
--- a/android/neverallow_test.go
+++ b/android/neverallow_test.go
@@ -344,6 +344,23 @@
`module "outside_allowed_list": violates neverallow`,
},
},
+ // Test for the rule restricting use of exclude_static_libs
+ {
+ name: `"exclude_static_libs" outside allowed directory`,
+ fs: map[string][]byte{
+ "a/b/Android.bp": []byte(`
+ java_library {
+ name: "baz",
+ exclude_static_libs: [
+ "bar",
+ ],
+ }
+ `),
+ },
+ expectedErrors: []string{
+ `exclude_static_libs property is only allowed for java modules defined in build/soong`,
+ },
+ },
}
var prepareForNeverAllowTest = GroupFixturePreparers(
@@ -430,9 +447,10 @@
}
type mockJavaLibraryProperties struct {
- Libs []string
- Sdk_version *string
- Uncompress_dex *bool
+ Libs []string
+ Sdk_version *string
+ Uncompress_dex *bool
+ Exclude_static_libs []string
}
type mockJavaLibraryModule struct {
diff --git a/android/sdk_version.go b/android/sdk_version.go
index 08762ef..80aeb2e 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -84,12 +84,6 @@
}
}
-// JavaLibraryName returns the soong module containing the Java APIs of that API surface.
-func (k SdkKind) JavaLibraryName(c Config) string {
- name := k.DefaultJavaLibraryName()
- return JavaApiLibraryName(c, name)
-}
-
// JavaApiLibraryName returns the name of .txt equivalent of a java_library, but does
// not check if either module exists.
// TODO: Return .txt (single-tree or multi-tree equivalents) based on config
@@ -335,11 +329,10 @@
// Export the name of the soong modules representing the various Java API surfaces.
func javaSdkMakeVars(ctx MakeVarsContext) {
- ctx.Strict("ANDROID_PUBLIC_STUBS", SdkPublic.JavaLibraryName(ctx.Config()))
- ctx.Strict("ANDROID_SYSTEM_STUBS", SdkSystem.JavaLibraryName(ctx.Config()))
- ctx.Strict("ANDROID_TEST_STUBS", SdkTest.JavaLibraryName(ctx.Config()))
- ctx.Strict("ANDROID_MODULE_LIB_STUBS", SdkModule.JavaLibraryName(ctx.Config()))
- ctx.Strict("ANDROID_SYSTEM_SERVER_STUBS", SdkSystemServer.JavaLibraryName(ctx.Config()))
- // TODO (jihoonkang): Create a .txt equivalent for core.current.stubs
- ctx.Strict("ANDROID_CORE_STUBS", SdkCore.JavaLibraryName(ctx.Config()))
+ ctx.Strict("ANDROID_PUBLIC_STUBS", SdkPublic.DefaultJavaLibraryName())
+ ctx.Strict("ANDROID_SYSTEM_STUBS", SdkSystem.DefaultJavaLibraryName())
+ ctx.Strict("ANDROID_TEST_STUBS", SdkTest.DefaultJavaLibraryName())
+ ctx.Strict("ANDROID_MODULE_LIB_STUBS", SdkModule.DefaultJavaLibraryName())
+ ctx.Strict("ANDROID_SYSTEM_SERVER_STUBS", SdkSystemServer.DefaultJavaLibraryName())
+ ctx.Strict("ANDROID_CORE_STUBS", SdkCore.DefaultJavaLibraryName())
}
diff --git a/android/test_asserts.go b/android/test_asserts.go
index 5cc7e4a..3a2cb1a 100644
--- a/android/test_asserts.go
+++ b/android/test_asserts.go
@@ -200,6 +200,22 @@
}
}
+// Asserts that each of the Paths in actual end with the corresponding string
+// from expected. Useful to test that output paths contain expected items without
+// hard-coding where intermediate files might be located.
+func AssertPathsEndWith(t *testing.T, message string, expected []string, actual []Path) {
+ t.Helper()
+ if len(expected) != len(actual) {
+ t.Errorf("%s (length): expected %d, actual %d", message, len(expected), len(actual))
+ return
+ }
+ for i := range expected {
+ if !strings.HasSuffix(actual[i].String(), expected[i]) {
+ t.Errorf("%s (item %d): expected '%s', actual '%s'", message, i, expected[i], actual[i].String())
+ }
+ }
+}
+
// AssertDeepEquals checks if the expected and actual values are equal using reflect.DeepEqual and
// if they are not then it reports an error prefixed with the supplied message and including a
// reason for why it failed.
diff --git a/android/variable.go b/android/variable.go
index 77888e5..6362953 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -109,6 +109,11 @@
Cflags []string
}
+ Build_from_text_stub struct {
+ Static_libs []string
+ Exclude_static_libs []string
+ }
+
// debuggable is true for eng and userdebug builds, and can be used to turn on additional
// debugging features that don't significantly impact runtime behavior. userdebug builds
// are used for dogfooding and performance testing, and should be as similar to user builds
@@ -286,6 +291,7 @@
Uml *bool `json:",omitempty"`
Arc *bool `json:",omitempty"`
MinimizeJavaDebugInfo *bool `json:",omitempty"`
+ Build_from_text_stub *bool `json:",omitempty"`
Check_elf_files *bool `json:",omitempty"`
@@ -420,8 +426,6 @@
TargetFSConfigGen []string `json:",omitempty"`
- MissingUsesLibraries []string `json:",omitempty"`
-
EnforceProductPartitionInterface *bool `json:",omitempty"`
EnforceInterPartitionJavaSdkLibrary *bool `json:",omitempty"`
@@ -451,14 +455,14 @@
BuildBrokenVendorPropertyNamespace bool `json:",omitempty"`
BuildBrokenInputDirModules []string `json:",omitempty"`
+ BuildWarningBadOptionalUsesLibsAllowlist []string `json:",omitempty"`
+
BuildDebugfsRestrictionsEnabled bool `json:",omitempty"`
RequiresInsecureExecmemForSwiftshader bool `json:",omitempty"`
SelinuxIgnoreNeverallows bool `json:",omitempty"`
- SepolicySplit bool `json:",omitempty"`
-
SepolicyFreezeTestExtraDirs []string `json:",omitempty"`
SepolicyFreezeTestExtraPrebuiltDirs []string `json:",omitempty"`
@@ -528,6 +532,7 @@
Malloc_pattern_fill_contents: boolPtr(false),
Safestack: boolPtr(false),
TrimmedApex: boolPtr(false),
+ Build_from_text_stub: boolPtr(false),
BootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}},
ApexBootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}},
diff --git a/apex/apex.go b/apex/apex.go
index f49492e..32d7250 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -220,6 +220,13 @@
// imageApex or flattenedApex depending on Config.FlattenApex(). When payload_type is zip,
// this becomes zipApex.
ApexType apexPackaging `blueprint:"mutated"`
+
+ // Name that dependencies can specify in their apex_available properties to refer to this module.
+ // If not specified, this defaults to Soong module name. This must be the name of a Soong module.
+ Apex_available_name *string
+
+ // Variant version of the mainline module. Must be an integer between 0-9
+ Variant_version *string
}
type ApexNativeDependencies struct {
@@ -3134,6 +3141,13 @@
}
apexName := ctx.ModuleName()
+ for _, props := range ctx.Module().GetProperties() {
+ if apexProps, ok := props.(*apexBundleProperties); ok {
+ if apexProps.Apex_available_name != nil {
+ apexName = *apexProps.Apex_available_name
+ }
+ }
+ }
fromName := ctx.OtherModuleName(from)
toName := ctx.OtherModuleName(to)
@@ -3516,6 +3530,8 @@
Logging_parent *string
Tests bazel.LabelListAttribute
Base_apex_name *string
+ Apex_available_name *string
+ Variant_version *string
}
type convertedNativeSharedLibs struct {
@@ -3666,6 +3682,8 @@
Package_name: packageName,
Logging_parent: loggingParent,
Tests: testsAttrs,
+ Apex_available_name: a.properties.Apex_available_name,
+ Variant_version: a.properties.Variant_version,
}
props := bazel.BazelTargetModuleProperties{
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 38e24e8..149b177 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -786,18 +786,16 @@
}
func TestFileContexts(t *testing.T) {
- for _, useFileContextsAsIs := range []bool{true, false} {
+ for _, vendor := range []bool{true, false} {
prop := ""
- if useFileContextsAsIs {
- prop = "use_file_contexts_as_is: true,\n"
+ if vendor {
+ prop = "vendor: true,\n"
}
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
- file_contexts: "file_contexts",
updatable: false,
- vendor: true,
`+prop+`
}
@@ -806,18 +804,17 @@
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
- `, withFiles(map[string][]byte{
- "file_contexts": nil,
- }))
+ `)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("file_contexts")
- forceLabellingCommand := "apex_manifest\\\\.pb u:object_r:system_file:s0"
- if useFileContextsAsIs {
- android.AssertStringDoesNotContain(t, "should force-label",
- rule.RuleParams.Command, forceLabellingCommand)
+ if vendor {
+ android.AssertStringDoesContain(t, "should force-label as vendor_apex_metadata_file",
+ rule.RuleParams.Command,
+ "apex_manifest\\\\.pb u:object_r:vendor_apex_metadata_file:s0")
} else {
- android.AssertStringDoesContain(t, "shouldn't force-label",
- rule.RuleParams.Command, forceLabellingCommand)
+ android.AssertStringDoesContain(t, "should force-label as system_file",
+ rule.RuleParams.Command,
+ "apex_manifest\\\\.pb u:object_r:system_file:s0")
}
}
}
@@ -6717,6 +6714,266 @@
}`)
}
+func TestApexAvailable_ApexAvailableNameWithVersionCodeError(t *testing.T) {
+ t.Run("negative variant_version produces error", func(t *testing.T) {
+ testApexError(t, "expected an integer between 0-9; got -1", `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ apex_available_name: "com.android.foo",
+ variant_version: "-1",
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+ })
+
+ t.Run("variant_version greater than 9 produces error", func(t *testing.T) {
+ testApexError(t, "expected an integer between 0-9; got 10", `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ apex_available_name: "com.android.foo",
+ variant_version: "10",
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+ })
+}
+
+func TestApexAvailable_ApexAvailableNameWithVersionCode(t *testing.T) {
+ context := android.GroupFixturePreparers(
+ android.PrepareForIntegrationTestWithAndroid,
+ PrepareForTestWithApexBuildComponents,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/foo-file_contexts": nil,
+ "system/sepolicy/apex/bar-file_contexts": nil,
+ }),
+ )
+ result := context.RunTestWithBp(t, `
+ apex {
+ name: "foo",
+ key: "myapex.key",
+ apex_available_name: "com.android.foo",
+ variant_version: "0",
+ updatable: false,
+ }
+ apex {
+ name: "bar",
+ key: "myapex.key",
+ apex_available_name: "com.android.foo",
+ variant_version: "3",
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+
+ fooManifestRule := result.ModuleForTests("foo", "android_common_foo_image").Rule("apexManifestRule")
+ fooExpectedDefaultVersion := android.DefaultUpdatableModuleVersion
+ fooActualDefaultVersion := fooManifestRule.Args["default_version"]
+ if fooActualDefaultVersion != fooExpectedDefaultVersion {
+ t.Errorf("expected to find defaultVersion %q; got %q", fooExpectedDefaultVersion, fooActualDefaultVersion)
+ }
+
+ barManifestRule := result.ModuleForTests("bar", "android_common_bar_image").Rule("apexManifestRule")
+ defaultVersionInt, _ := strconv.Atoi(android.DefaultUpdatableModuleVersion)
+ barExpectedDefaultVersion := fmt.Sprint(defaultVersionInt + 3)
+ barActualDefaultVersion := barManifestRule.Args["default_version"]
+ if barActualDefaultVersion != barExpectedDefaultVersion {
+ t.Errorf("expected to find defaultVersion %q; got %q", barExpectedDefaultVersion, barActualDefaultVersion)
+ }
+}
+
+func TestApexAvailable_ApexAvailableName(t *testing.T) {
+ t.Run("using name of apex that sets apex_available_name is not allowed", func(t *testing.T) {
+ testApexError(t, "Consider adding \"myapex\" to 'apex_available' property of \"AppFoo\"", `
+ apex {
+ name: "myapex_sminus",
+ key: "myapex.key",
+ apps: ["AppFoo"],
+ apex_available_name: "myapex",
+ updatable: false,
+ }
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ apps: ["AppFoo"],
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ android_app {
+ name: "AppFoo",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "none",
+ system_modules: "none",
+ apex_available: [ "myapex_sminus" ],
+ }`,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/myapex_sminus-file_contexts": nil,
+ }),
+ )
+ })
+
+ t.Run("apex_available_name allows module to be used in two different apexes", func(t *testing.T) {
+ testApex(t, `
+ apex {
+ name: "myapex_sminus",
+ key: "myapex.key",
+ apps: ["AppFoo"],
+ apex_available_name: "myapex",
+ updatable: false,
+ }
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ apps: ["AppFoo"],
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ android_app {
+ name: "AppFoo",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "none",
+ system_modules: "none",
+ apex_available: [ "myapex" ],
+ }`,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/myapex_sminus-file_contexts": nil,
+ }),
+ )
+ })
+
+ t.Run("override_apexes work with apex_available_name", func(t *testing.T) {
+ testApex(t, `
+ override_apex {
+ name: "myoverrideapex_sminus",
+ base: "myapex_sminus",
+ key: "myapex.key",
+ apps: ["AppFooOverride"],
+ }
+ override_apex {
+ name: "myoverrideapex",
+ base: "myapex",
+ key: "myapex.key",
+ apps: ["AppFooOverride"],
+ }
+ apex {
+ name: "myapex_sminus",
+ key: "myapex.key",
+ apps: ["AppFoo"],
+ apex_available_name: "myapex",
+ updatable: false,
+ }
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ apps: ["AppFoo"],
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ android_app {
+ name: "AppFooOverride",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "none",
+ system_modules: "none",
+ apex_available: [ "myapex" ],
+ }
+ android_app {
+ name: "AppFoo",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "none",
+ system_modules: "none",
+ apex_available: [ "myapex" ],
+ }`,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/myapex_sminus-file_contexts": nil,
+ }),
+ )
+ })
+}
+
+func TestApexAvailable_ApexAvailableNameWithOverrides(t *testing.T) {
+ context := android.GroupFixturePreparers(
+ android.PrepareForIntegrationTestWithAndroid,
+ PrepareForTestWithApexBuildComponents,
+ java.PrepareForTestWithDexpreopt,
+ android.FixtureMergeMockFs(android.MockFS{
+ "system/sepolicy/apex/myapex-file_contexts": nil,
+ "system/sepolicy/apex/myapex_sminus-file_contexts": nil,
+ }),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildId = proptools.StringPtr("buildid")
+ }),
+ )
+ context.RunTestWithBp(t, `
+ override_apex {
+ name: "myoverrideapex_sminus",
+ base: "myapex_sminus",
+ }
+ override_apex {
+ name: "myoverrideapex",
+ base: "myapex",
+ }
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ apps: ["AppFoo"],
+ updatable: false,
+ }
+ apex {
+ name: "myapex_sminus",
+ apex_available_name: "myapex",
+ key: "myapex.key",
+ apps: ["AppFoo_sminus"],
+ updatable: false,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ android_app {
+ name: "AppFoo",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "none",
+ system_modules: "none",
+ apex_available: [ "myapex" ],
+ }
+ android_app {
+ name: "AppFoo_sminus",
+ srcs: ["foo/bar/MyClass.java"],
+ sdk_version: "none",
+ min_sdk_version: "29",
+ system_modules: "none",
+ apex_available: [ "myapex" ],
+ }`)
+}
+
func TestApexAvailable_CheckForPlatform(t *testing.T) {
ctx := testApex(t, `
apex {
diff --git a/apex/builder.go b/apex/builder.go
index 7c6522d..a2fe2a0 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -275,6 +275,22 @@
manifestJsonFullOut := android.PathForModuleOut(ctx, "apex_manifest_full.json")
defaultVersion := android.DefaultUpdatableModuleVersion
+ if a.properties.Variant_version != nil {
+ defaultVersionInt, err := strconv.Atoi(defaultVersion)
+ if err != nil {
+ ctx.ModuleErrorf("expected DefaultUpdatableModuleVersion to be an int, but got %s", defaultVersion)
+ }
+ if defaultVersionInt%10 != 0 {
+ ctx.ModuleErrorf("expected DefaultUpdatableModuleVersion to end in a zero, but got %s", defaultVersion)
+ }
+ variantVersion := []rune(*a.properties.Variant_version)
+ if len(variantVersion) != 1 || variantVersion[0] < '0' || variantVersion[0] > '9' {
+ ctx.PropertyErrorf("variant_version", "expected an integer between 0-9; got %s", *a.properties.Variant_version)
+ }
+ defaultVersionRunes := []rune(defaultVersion)
+ defaultVersionRunes[len(defaultVersion)-1] = []rune(variantVersion)[0]
+ defaultVersion = string(defaultVersionRunes)
+ }
if override := ctx.Config().Getenv("OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION"); override != "" {
defaultVersion = override
}
@@ -314,7 +330,7 @@
// buildFileContexts create build rules to append an entry for apex_manifest.pb to the file_contexts
// file for this APEX which is either from /systme/sepolicy/apex/<apexname>-file_contexts or from
// the file_contexts property of this APEX. This is to make sure that the manifest file is correctly
-// labeled as system_file.
+// labeled as system_file or vendor_apex_metadata_file.
func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.OutputPath {
var fileContexts android.Path
var fileContextsDir string
@@ -346,6 +362,13 @@
output := android.PathForModuleOut(ctx, "file_contexts")
rule := android.NewRuleBuilder(pctx, ctx)
+ forceLabel := "u:object_r:system_file:s0"
+ if a.SocSpecific() && !a.vndkApex {
+ // APEX on /vendor should label ./ and ./apex_manifest.pb as vendor_apex_metadata_file.
+ // The reason why we skip VNDK APEX is that aosp_{pixel device} targets install VNDK APEX on /vendor
+ // even though VNDK APEX is supposed to be installed on /system. (See com.android.vndk.current.on_vendor)
+ forceLabel = "u:object_r:vendor_apex_metadata_file:s0"
+ }
switch a.properties.ApexType {
case imageApex:
// remove old file
@@ -355,9 +378,9 @@
// new line
rule.Command().Text("echo").Text(">>").Output(output)
if !useFileContextsAsIs {
- // force-label /apex_manifest.pb and / as system_file so that apexd can read them
- rule.Command().Text("echo").Flag("/apex_manifest\\\\.pb u:object_r:system_file:s0").Text(">>").Output(output)
- rule.Command().Text("echo").Flag("/ u:object_r:system_file:s0").Text(">>").Output(output)
+ // force-label /apex_manifest.pb and /
+ rule.Command().Text("echo").Text("/apex_manifest\\\\.pb").Text(forceLabel).Text(">>").Output(output)
+ rule.Command().Text("echo").Text("/").Text(forceLabel).Text(">>").Output(output)
}
case flattenedApex:
// For flattened apexes, install path should be prepended.
@@ -372,9 +395,9 @@
// new line
rule.Command().Text("echo").Text(">>").Output(output)
if !useFileContextsAsIs {
- // force-label /apex_manifest.pb and / as system_file so that apexd can read them
- rule.Command().Text("echo").Flag(apexPath + `/apex_manifest\\.pb u:object_r:system_file:s0`).Text(">>").Output(output)
- rule.Command().Text("echo").Flag(apexPath + "/ u:object_r:system_file:s0").Text(">>").Output(output)
+ // force-label /apex_manifest.pb and /
+ rule.Command().Text("echo").Text(apexPath + "/apex_manifest\\\\.pb").Text(forceLabel).Text(">>").Output(output)
+ rule.Command().Text("echo").Text(apexPath + "/").Text(forceLabel).Text(">>").Output(output)
}
default:
panic(fmt.Errorf("unsupported type %v", a.properties.ApexType))
diff --git a/bazel/bazel_proxy.go b/bazel/bazel_proxy.go
index 2940b99..229818d 100644
--- a/bazel/bazel_proxy.go
+++ b/bazel/bazel_proxy.go
@@ -26,10 +26,11 @@
"time"
)
-// Logs fatal events of ProxyServer.
+// Logs events of ProxyServer.
type ServerLogger interface {
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
+ Println(v ...interface{})
}
// CmdRequest is a request to the Bazel Proxy server.
@@ -71,9 +72,10 @@
// The ProxyServer will only live as long as soong_ui does; the
// underlying Bazel server will live past the duration of the build.
type ProxyServer struct {
- logger ServerLogger
- outDir string
- workspaceDir string
+ logger ServerLogger
+ outDir string
+ workspaceDir string
+ bazeliskVersion string
// The server goroutine will listen on this channel and stop handling requests
// once it is written to.
done chan struct{}
@@ -119,12 +121,17 @@
}
// NewProxyServer is a constructor for a ProxyServer.
-func NewProxyServer(logger ServerLogger, outDir string, workspaceDir string) *ProxyServer {
+func NewProxyServer(logger ServerLogger, outDir string, workspaceDir string, bazeliskVersion string) *ProxyServer {
+ if len(bazeliskVersion) > 0 {
+ logger.Println("** Using Bazelisk for this build, due to env var USE_BAZEL_VERSION=" + bazeliskVersion + " **")
+ }
+
return &ProxyServer{
- logger: logger,
- outDir: outDir,
- workspaceDir: workspaceDir,
- done: make(chan struct{}),
+ logger: logger,
+ outDir: outDir,
+ workspaceDir: workspaceDir,
+ done: make(chan struct{}),
+ bazeliskVersion: bazeliskVersion,
}
}
@@ -155,6 +162,9 @@
return fmt.Errorf("Error decoding request: %s", err)
}
+ if len(b.bazeliskVersion) > 0 {
+ req.Env = append(req.Env, "USE_BAZEL_VERSION="+b.bazeliskVersion)
+ }
stdout, stderr, cmdErr := ExecBazel("./build/bazel/bin/bazel", b.workspaceDir, req)
errorString := ""
if cmdErr != nil {
diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go
index ca96f23..791c6bc 100644
--- a/bazel/cquery/request_type.go
+++ b/bazel/cquery/request_type.go
@@ -11,6 +11,7 @@
GetCcInfo = &getCcInfoType{}
GetApexInfo = &getApexInfoType{}
GetCcUnstrippedInfo = &getCcUnstrippedInfoType{}
+ GetPrebuiltFileInfo = &getPrebuiltFileInfo{}
)
type CcAndroidMkInfo struct {
@@ -375,3 +376,51 @@
}
return nil
}
+
+type getPrebuiltFileInfo struct{}
+
+// Name returns a string name for this request type. Such request type names must be unique,
+// and must only consist of alphanumeric characters.
+func (g getPrebuiltFileInfo) Name() string {
+ return "getPrebuiltFileInfo"
+}
+
+// StarlarkFunctionBody returns a starlark function body to process this request type.
+// The returned string is the body of a Starlark function which obtains
+// all request-relevant information about a target and returns a string containing
+// this information.
+// The function should have the following properties:
+// - The arguments are `target` (a configured target) and `id_string` (the label + configuration).
+// - The return value must be a string.
+// - The function body should not be indented outside of its own scope.
+func (g getPrebuiltFileInfo) StarlarkFunctionBody() string {
+ return `
+p = providers(target)
+prebuilt_file_info = p.get("//build/bazel/rules:prebuilt_file.bzl%PrebuiltFileInfo")
+if not prebuilt_file_info:
+ fail("%s did not provide PrebuiltFileInfo" % id_string)
+
+return json.encode({
+ "Src": prebuilt_file_info.src.path,
+ "Dir": prebuilt_file_info.dir,
+ "Filename": prebuilt_file_info.filename,
+ "Installable": prebuilt_file_info.installable,
+})`
+}
+
+type PrebuiltFileInfo struct {
+ // TODO: b/207489266 - Fully support all properties in prebuilt_file
+ Src string
+ Dir string
+ Filename string
+ Installable bool
+}
+
+// ParseResult returns a value obtained by parsing the result of the request's Starlark function.
+// The given rawString must correspond to the string output which was created by evaluating the
+// Starlark given in StarlarkFunctionBody.
+func (g getPrebuiltFileInfo) ParseResult(rawString string) (PrebuiltFileInfo, error) {
+ var info PrebuiltFileInfo
+ err := parseJson(rawString, &info)
+ return info, err
+}
diff --git a/bp2build/Android.bp b/bp2build/Android.bp
index 4ecd05d..782a88c 100644
--- a/bp2build/Android.bp
+++ b/bp2build/Android.bp
@@ -74,6 +74,7 @@
"linker_config_conversion_test.go",
"package_conversion_test.go",
"performance_test.go",
+ "platform_compat_config_conversion_test.go",
"prebuilt_etc_conversion_test.go",
"python_binary_conversion_test.go",
"python_library_conversion_test.go",
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go
index 390cabe..84c7ea2 100644
--- a/bp2build/apex_conversion_test.go
+++ b/bp2build/apex_conversion_test.go
@@ -123,6 +123,7 @@
name: "com.android.apogee",
manifest: "apogee_manifest.json",
androidManifest: "ApogeeAndroidManifest.xml",
+ apex_available_name: "apogee_apex_name",
file_contexts: ":com.android.apogee-file_contexts",
min_sdk_version: "29",
key: "com.android.apogee.key",
@@ -144,11 +145,13 @@
],
package_name: "com.android.apogee.test.package",
logging_parent: "logging.parent",
+ variant_version: "3",
}
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("apex", "com.android.apogee", AttrNameToString{
- "android_manifest": `"ApogeeAndroidManifest.xml"`,
+ "android_manifest": `"ApogeeAndroidManifest.xml"`,
+ "apex_available_name": `"apogee_apex_name"`,
"binaries": `[
":cc_binary_1",
":sh_binary_2",
@@ -185,10 +188,11 @@
":prebuilt_1",
":prebuilt_2",
]`,
- "updatable": "False",
- "compressible": "False",
- "package_name": `"com.android.apogee.test.package"`,
- "logging_parent": `"logging.parent"`,
+ "updatable": "False",
+ "compressible": "False",
+ "package_name": `"com.android.apogee.test.package"`,
+ "logging_parent": `"logging.parent"`,
+ "variant_version": `"3"`,
}),
}})
}
diff --git a/bp2build/bp2build_product_config.go b/bp2build/bp2build_product_config.go
index 66d0cc5..7224496 100644
--- a/bp2build/bp2build_product_config.go
+++ b/bp2build/bp2build_product_config.go
@@ -72,8 +72,13 @@
load("//{PRODUCT_FOLDER}:soong.variables.bzl", _soong_variables = "variables")
load("@//build/bazel/product_config:android_product.bzl", "android_product")
+# Bazel will qualify its outputs by the platform name. When switching between products, this
+# means that soong-built files that depend on bazel-built files will suddenly get different
+# dependency files, because the path changes, and they will be rebuilt. In order to avoid this
+# extra rebuilding, make mixed builds always use a single platform so that the bazel artifacts
+# are always under the same path.
android_product(
- name = "current_product-{VARIANT}",
+ name = "mixed_builds_product-{VARIANT}",
soong_variables = _soong_variables,
)
`)),
@@ -86,7 +91,7 @@
# TODO: When we start generating the platforms for more than just the
# currently lunched product, they should all be listed here
product_labels = [
- "@soong_injection//product_config_platforms:current_product-{VARIANT}",
+ "@soong_injection//product_config_platforms:mixed_builds_product-{VARIANT}",
"@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}"
]
`)),
@@ -94,38 +99,25 @@
"product_config_platforms",
"common.bazelrc",
productReplacer.Replace(`
-# current_product refers to the current TARGET_PRODUCT set, usually through
-# 'lunch' or 'banchan'. Every build will have a primary TARGET_PRODUCT, but
-# bazel supports using other products in tests or configuration transitions. The
-# other products can be found in
-# @soong_injection//product_config_platforms/products/...
-build --platforms @soong_injection//product_config_platforms:current_product-{VARIANT}_linux_x86_64
+build --platforms @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_x86_64
-build:android --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}
-build:linux_x86_64 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_x86_64
-build:linux_bionic_x86_64 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_bionic_x86_64
-build:linux_musl_x86 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_musl_x86
-build:linux_musl_x86_64 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_musl_x86_64
+build:android --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}
+build:linux_x86_64 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_x86_64
+build:linux_bionic_x86_64 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_bionic_x86_64
+build:linux_musl_x86 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_musl_x86
+build:linux_musl_x86_64 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_musl_x86_64
`)),
newFile(
"product_config_platforms",
"linux.bazelrc",
productReplacer.Replace(`
-build --host_platform @soong_injection//product_config_platforms:current_product-{VARIANT}_linux_x86_64
+build --host_platform @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_x86_64
`)),
newFile(
"product_config_platforms",
"darwin.bazelrc",
productReplacer.Replace(`
-build --host_platform product_config_platforms:current_product-{VARIANT}_darwin_x86_64
-`)),
- newFile(
- "product_config_platforms",
- "platform_mappings",
- productReplacer.Replace(`
-flags:
- --cpu=k8
- @soong_injection//product_config_platforms:current_product-{VARIANT}
+build --host_platform @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_darwin_x86_64
`)),
}
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index 8a83cc0..d37722b 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -1036,3 +1036,110 @@
},
})
}
+
+func TestCcBinaryWithCfi(t *testing.T) {
+ runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
+ description: "cc_binary has correct features when cfi is enabled",
+ blueprint: `
+{rule_name} {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ },
+}`,
+ targets: []testBazelTarget{
+ {"cc_binary", "foo", AttrNameToString{
+ "features": `["android_cfi"]`,
+ "local_includes": `["."]`,
+ }},
+ },
+ })
+}
+
+func TestCcBinaryWithCfiOsSpecific(t *testing.T) {
+ runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
+ description: "cc_binary has correct features when cfi is enabled for specific variants",
+ blueprint: `
+{rule_name} {
+ name: "foo",
+ target: {
+ android: {
+ sanitize: {
+ cfi: true,
+ },
+ },
+ },
+}`,
+ targets: []testBazelTarget{
+ {"cc_binary", "foo", AttrNameToString{
+ "features": `select({
+ "//build/bazel/platforms/os:android": ["android_cfi"],
+ "//conditions:default": [],
+ })`,
+ "local_includes": `["."]`,
+ }},
+ },
+ })
+}
+
+func TestCcBinaryWithCfiAndCfiAssemblySupport(t *testing.T) {
+ runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
+ description: "cc_binary has correct features when cfi is enabled with cfi assembly support",
+ blueprint: `
+{rule_name} {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ config: {
+ cfi_assembly_support: true,
+ },
+ },
+}`,
+ targets: []testBazelTarget{
+ {"cc_binary", "foo", AttrNameToString{
+ "features": `[
+ "android_cfi",
+ "android_cfi_assembly_support",
+ ]`,
+ "local_includes": `["."]`,
+ }},
+ },
+ })
+}
+
+func TestCcBinaryStem(t *testing.T) {
+ runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
+ description: "cc_binary with stem property",
+ blueprint: `
+cc_binary {
+ name: "foo_with_stem_simple",
+ stem: "foo",
+}
+cc_binary {
+ name: "foo_with_arch_variant_stem",
+ arch: {
+ arm: {
+ stem: "foo-arm",
+ },
+ arm64: {
+ stem: "foo-arm64",
+ },
+ },
+}
+`,
+ targets: []testBazelTarget{
+ {"cc_binary", "foo_with_stem_simple", AttrNameToString{
+ "stem": `"foo"`,
+ "local_includes": `["."]`,
+ }},
+ {"cc_binary", "foo_with_arch_variant_stem", AttrNameToString{
+ "stem": `select({
+ "//build/bazel/platforms/arch:arm": "foo-arm",
+ "//build/bazel/platforms/arch:arm64": "foo-arm64",
+ "//conditions:default": None,
+ })`,
+ "local_includes": `["."]`,
+ }},
+ },
+ })
+}
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 3dd9373..20f3bf6 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -4718,3 +4718,136 @@
},
})
}
+
+func TestCcLibraryWithCfi(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library has correct features when cfi is enabled",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `
+cc_library {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
+ "features": `["android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `["android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
+func TestCcLibraryWithCfiOsSpecific(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library has correct features when cfi is enabled for specific variants",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `
+cc_library {
+ name: "foo",
+ target: {
+ android: {
+ sanitize: {
+ cfi: true,
+ },
+ },
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
+ "features": `select({
+ "//build/bazel/platforms/os:android": ["android_cfi"],
+ "//conditions:default": [],
+ })`,
+ "local_includes": `["."]`,
+ }),
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `select({
+ "//build/bazel/platforms/os:android": ["android_cfi"],
+ "//conditions:default": [],
+ })`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
+func TestCcLibraryWithCfiAndCfiAssemblySupport(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library has correct features when cfi is enabled with cfi_assembly_support",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `
+cc_library {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ config: {
+ cfi_assembly_support: true,
+ },
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
+ "features": `[
+ "android_cfi",
+ "android_cfi_assembly_support",
+ ]`,
+ "local_includes": `["."]`,
+ }),
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `[
+ "android_cfi",
+ "android_cfi_assembly_support",
+ ]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
+func TestCcLibraryWithStem(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library with stem property",
+ ModuleTypeUnderTest: "cc_library_shared",
+ ModuleTypeUnderTestFactory: cc.LibrarySharedFactory,
+ Blueprint: soongCcLibraryPreamble + `
+cc_library_shared {
+ name: "foo_with_stem_simple",
+ stem: "foo",
+}
+cc_library_shared {
+ name: "foo_with_arch_variant_stem",
+ arch: {
+ arm: {
+ stem: "foo-arm",
+ },
+ arm64: {
+ stem: "foo-arm64",
+ },
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_shared", "foo_with_stem_simple", AttrNameToString{
+ "stem": `"foo"`,
+ "local_includes": `["."]`,
+ }),
+ MakeBazelTarget("cc_library_shared", "foo_with_arch_variant_stem", AttrNameToString{
+ "stem": `select({
+ "//build/bazel/platforms/arch:arm": "foo-arm",
+ "//build/bazel/platforms/arch:arm64": "foo-arm64",
+ "//conditions:default": None,
+ })`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 6c9f9a1..7f0ba44 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -1445,3 +1445,73 @@
},
})
}
+
+func TestCcLibrarySharedWithCfi(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_shared has correct features when cfi is enabled for specific variants",
+ Blueprint: `
+cc_library_shared {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `["android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
+func TestCcLibrarySharedWithCfiOsSpecific(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_shared has correct features when cfi is enabled",
+ Blueprint: `
+cc_library_shared {
+ name: "foo",
+ target: {
+ android: {
+ sanitize: {
+ cfi: true,
+ },
+ },
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `select({
+ "//build/bazel/platforms/os:android": ["android_cfi"],
+ "//conditions:default": [],
+ })`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
+func TestCcLibrarySharedWithCfiAndCfiAssemblySupport(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_shared has correct features when cfi is enabled with cfi assembly support",
+ Blueprint: `
+cc_library_static {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ config: {
+ cfi_assembly_support: true,
+ },
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "features": `[
+ "android_cfi",
+ "android_cfi_assembly_support",
+ ]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index 2705aaf..f537871 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -2075,3 +2075,73 @@
},
})
}
+
+func TestCcLibraryStaticWithCfi(t *testing.T) {
+ runCcLibraryStaticTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_static has correct features when cfi is enabled",
+ Blueprint: `
+cc_library_static {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "features": `["android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
+func TestCcLibraryStaticWithCfiOsSpecific(t *testing.T) {
+ runCcLibraryStaticTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_static has correct features when cfi is enabled for specific variants",
+ Blueprint: `
+cc_library_static {
+ name: "foo",
+ target: {
+ android: {
+ sanitize: {
+ cfi: true,
+ },
+ },
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "features": `select({
+ "//build/bazel/platforms/os:android": ["android_cfi"],
+ "//conditions:default": [],
+ })`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
+func TestCcLibraryStaticWithCfiAndCfiAssemblySupport(t *testing.T) {
+ runCcLibraryStaticTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_static has correct features when cfi is enabled with cfi_assembly_support",
+ Blueprint: `
+cc_library_static {
+ name: "foo",
+ sanitize: {
+ cfi: true,
+ config: {
+ cfi_assembly_support: true,
+ },
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "features": `[
+ "android_cfi",
+ "android_cfi_assembly_support",
+ ]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
diff --git a/bp2build/genrule_conversion_test.go b/bp2build/genrule_conversion_test.go
index 3490881..5cf4fb2 100644
--- a/bp2build/genrule_conversion_test.go
+++ b/bp2build/genrule_conversion_test.go
@@ -49,6 +49,7 @@
srcs: ["other_tool.in"],
cmd: "cp $(in) $(out)",
}`, genruleTarget, genruleTarget),
+ "other/file.txt": "",
}
}
@@ -293,17 +294,20 @@
bp := `%s {
name: "foo",
out: ["foo.out"],
- srcs: [":other.tool"],
+ srcs: [":other.tool", "other/file.txt",],
tool_files: [":foo.tool"],
- cmd: "$(locations :foo.tool) -s $(out) $(location :other.tool)",
+ cmd: "$(locations :foo.tool) $(location other/file.txt) -s $(out) $(location :other.tool)",
bazel_module: { bp2build_available: true },
}`
for _, tc := range testCases {
moduleAttrs := AttrNameToString{
- "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(location //other:other.tool)"`,
- "outs": `["foo.out"]`,
- "srcs": `["//other:other.tool"]`,
+ "cmd": `"$(locations //other:foo.tool) $(location //other:file.txt) -s $(OUTS) $(location //other:other.tool)"`,
+ "outs": `["foo.out"]`,
+ "srcs": `[
+ "//other:other.tool",
+ "//other:file.txt",
+ ]`,
"tools": `["//other:foo.tool"]`,
}
diff --git a/bp2build/gensrcs_conversion_test.go b/bp2build/gensrcs_conversion_test.go
index 4845973..e808340 100644
--- a/bp2build/gensrcs_conversion_test.go
+++ b/bp2build/gensrcs_conversion_test.go
@@ -33,7 +33,8 @@
name: "foo",
srcs: ["test/input.txt", ":external_files"],
tool_files: ["program.py"],
- cmd: "$(location program.py) $(in) $(out)",
+ cmd: "$(location program.py) $(in) $(out) $(location foo/file.txt) $(location :external_files)",
+ data: ["foo/file.txt", ":external_files"],
output_extension: "out",
bazel_module: { bp2build_available: true },
}`,
@@ -44,7 +45,11 @@
]`,
"tools": `["program.py"]`,
"output_extension": `"out"`,
- "cmd": `"$(location program.py) $(SRC) $(OUT)"`,
+ "cmd": `"$(location program.py) $(SRC) $(OUT) $(location foo/file.txt) $(location :external_files__BP2BUILD__MISSING__DEP)"`,
+ "data": `[
+ "foo/file.txt",
+ ":external_files__BP2BUILD__MISSING__DEP",
+ ]`,
},
},
{
diff --git a/bp2build/java_binary_host_conversion_test.go b/bp2build/java_binary_host_conversion_test.go
index e51f608..39e55c4 100644
--- a/bp2build/java_binary_host_conversion_test.go
+++ b/bp2build/java_binary_host_conversion_test.go
@@ -68,7 +68,7 @@
}),
MakeBazelTarget("java_binary", "java-binary-host-1", AttrNameToString{
"main_class": `"com.android.test.MainClass"`,
- "jvm_flags": `["-Djava.library.path=$${RUNPATH}other"]`,
+ "jvm_flags": `["-Djava.library.path=$${RUNPATH}other/jni-lib-1"]`,
"target_compatible_with": `select({
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
"//conditions:default": [],
diff --git a/bp2build/java_test_host_conversion_test.go b/bp2build/java_test_host_conversion_test.go
new file mode 100644
index 0000000..f411ffb
--- /dev/null
+++ b/bp2build/java_test_host_conversion_test.go
@@ -0,0 +1,149 @@
+// Copyright 2023 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bp2build
+
+import (
+ "testing"
+
+ "android/soong/android"
+ "android/soong/java"
+)
+
+func runJavaTestHostTestCase(t *testing.T, tc Bp2buildTestCase) {
+ t.Helper()
+ (&tc).ModuleTypeUnderTest = "java_test_host"
+ (&tc).ModuleTypeUnderTestFactory = java.TestHostFactory
+ RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("java_library", java.LibraryFactory)
+ }, tc)
+}
+
+func TestJavaTestHostGeneral(t *testing.T) {
+ runJavaTestHostTestCase(t, Bp2buildTestCase{
+ Description: "java_test_host general",
+ Filesystem: map[string]string{},
+ Blueprint: `
+java_test_host {
+ name: "java_test_host-1",
+ srcs: ["a.java", "b.java"],
+ libs: ["lib_a"],
+ static_libs: ["static_libs_a"],
+ exclude_srcs: ["b.java"],
+ javacflags: ["-Xdoclint:all/protected"],
+ java_version: "8",
+}
+
+java_library {
+ name: "lib_a",
+ bazel_module: { bp2build_available: false },
+}
+
+java_library {
+ name: "static_libs_a",
+ bazel_module: { bp2build_available: false },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("java_library", "java_test_host-1_lib", AttrNameToString{
+ "deps": `[
+ ":lib_a-neverlink",
+ ":static_libs_a",
+ ]`,
+ "java_version": `"8"`,
+ "javacopts": `["-Xdoclint:all/protected"]`,
+ "srcs": `["a.java"]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ MakeBazelTarget("java_test", "java_test_host-1", AttrNameToString{
+ "runtime_deps": `[":java_test_host-1_lib"]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
+
+func TestJavaTestHostNoSrcs(t *testing.T) {
+ runJavaTestHostTestCase(t, Bp2buildTestCase{
+ Description: "java_test_host without srcs",
+ Filesystem: map[string]string{},
+ Blueprint: `
+java_test_host {
+ name: "java_test_host-1",
+ libs: ["lib_a"],
+ static_libs: ["static_libs_a"],
+}
+
+java_library {
+ name: "lib_a",
+ bazel_module: { bp2build_available: false },
+}
+
+java_library {
+ name: "static_libs_a",
+ bazel_module: { bp2build_available: false },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("java_test", "java_test_host-1", AttrNameToString{
+ "runtime_deps": `[
+ ":lib_a-neverlink",
+ ":static_libs_a",
+ ]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
+
+func TestJavaTestHostKotlinSrcs(t *testing.T) {
+ runJavaTestHostTestCase(t, Bp2buildTestCase{
+ Description: "java_test_host with .kt in srcs",
+ Filesystem: map[string]string{},
+ Blueprint: `
+java_test_host {
+ name: "java_test_host-1",
+ srcs: ["a.java", "b.kt"],
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("java_test", "java_test_host-1", AttrNameToString{
+ "runtime_deps": `[":java_test_host-1_lib"]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ MakeBazelTarget("kt_jvm_library", "java_test_host-1_lib", AttrNameToString{
+ "srcs": `[
+ "a.java",
+ "b.kt",
+ ]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
diff --git a/bp2build/platform_compat_config_conversion_test.go b/bp2build/platform_compat_config_conversion_test.go
new file mode 100644
index 0000000..4dfcce3
--- /dev/null
+++ b/bp2build/platform_compat_config_conversion_test.go
@@ -0,0 +1,53 @@
+// Copyright 2023 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bp2build
+
+import (
+ "testing"
+
+ "android/soong/android"
+ "android/soong/java"
+)
+
+func runPlatformCompatConfigTestCase(t *testing.T, tc Bp2buildTestCase) {
+ t.Helper()
+ RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("java_library", java.LibraryFactory)
+ ctx.RegisterModuleType("platform_compat_config", java.PlatformCompatConfigFactory)
+ }, tc)
+}
+
+func TestPlatformCompatConfig(t *testing.T) {
+ runPlatformCompatConfigTestCase(t, Bp2buildTestCase{
+ Description: "platform_compat_config - conversion test",
+ Blueprint: `
+ platform_compat_config {
+ name: "foo",
+ src: ":lib",
+ }`,
+ Filesystem: map[string]string{
+ "a/b/Android.bp": `
+ java_library {
+ name: "lib",
+ srcs: ["a.java"],
+ }`,
+ },
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("platform_compat_config", "foo", AttrNameToString{
+ "src": `"//a/b:lib"`,
+ }),
+ },
+ })
+}
diff --git a/cc/afdo.go b/cc/afdo.go
index 49f6987..137ea97 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -34,7 +34,7 @@
var afdoProfileProjectsConfigKey = android.NewOnceKey("AfdoProfileProjects")
-const afdoCFlagsFormat = "-fprofile-sample-accurate -fprofile-sample-use=%s"
+const afdoCFlagsFormat = "-fprofile-sample-use=%s"
func recordMissingAfdoProfileFile(ctx android.BaseModuleContext, missing string) {
getNamedMapForConfig(ctx.Config(), modulesMissingProfileFileKey).Store(missing, true)
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 259ba39..1e83ca3 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -434,6 +434,7 @@
features bazel.StringListAttribute
+ stem bazel.StringAttribute
suffix bazel.StringAttribute
fdoProfile bazel.LabelAttribute
@@ -591,7 +592,8 @@
anySrcs := false
// Add srcs-like dependencies such as generated files.
// First create a LabelList containing these dependencies, then merge the values with srcs.
- generatedSrcsLabelList := android.BazelLabelForModuleDepsExcludes(ctx, props.Generated_sources, props.Exclude_generated_sources)
+ genSrcs, _ := android.PartitionXsdSrcs(ctx, props.Generated_sources)
+ generatedSrcsLabelList := android.BazelLabelForModuleDepsExcludes(ctx, genSrcs, props.Exclude_generated_sources)
if len(props.Generated_sources) > 0 || len(props.Exclude_generated_sources) > 0 {
anySrcs = true
}
@@ -716,6 +718,14 @@
return ret
}
+// Replaces //a/b/my_xsd_config with //a/b/my_xsd_config-cpp
+func xsdConfigCppTarget(ctx android.BazelConversionPathContext, mod blueprint.Module) string {
+ callback := func(xsd android.XsdConfigBp2buildTargets) string {
+ return xsd.CppBp2buildTargetName()
+ }
+ return android.XsdConfigBp2buildTarget(ctx, mod, callback)
+}
+
// bp2BuildParseBaseProps returns all compiler, linker, library attributes of a cc module..
func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module) baseAttributes {
archVariantCompilerProps := module.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
@@ -754,7 +764,14 @@
for cfg := range configs {
var allHdrs []string
if baseCompilerProps, ok := archVariantCompilerProps[axis][cfg].(*BaseCompilerProperties); ok {
- allHdrs = baseCompilerProps.Generated_headers
+ ah, allHdrsXsd := android.PartitionXsdSrcs(ctx, baseCompilerProps.Generated_headers)
+ allHdrs = ah
+ // in the synthetic bp2build workspace, xsd sources are compiled to a static library
+ xsdCppConfigLibraryLabels := android.BazelLabelForModuleDepsWithFn(ctx, allHdrsXsd, xsdConfigCppTarget)
+ iwad := linkerAttrs.implementationWholeArchiveDeps.SelectValue(axis, cfg)
+ (&iwad).Append(xsdCppConfigLibraryLabels)
+ linkerAttrs.implementationWholeArchiveDeps.SetSelectValue(axis, cfg, bazel.FirstUniqueBazelLabelList(iwad))
+
if baseCompilerProps.Lex != nil {
compilerAttrs.lexopts.SetSelectValue(axis, cfg, baseCompilerProps.Lex.Flags)
}
@@ -803,6 +820,9 @@
compilerAttrs.stubsVersions.SetSelectValue(axis, cfg, versions)
}
}
+ if stem := libraryProps.Stem; stem != nil {
+ compilerAttrs.stem.SetSelectValue(axis, cfg, stem)
+ }
if suffix := libraryProps.Suffix; suffix != nil {
compilerAttrs.suffix.SetSelectValue(axis, cfg, suffix)
}
@@ -1721,6 +1741,7 @@
type binaryLinkerAttrs struct {
Linkshared *bool
+ Stem bazel.StringAttribute
Suffix bazel.StringAttribute
}
@@ -1738,6 +1759,9 @@
// nonconfigurable attribute. Only 4 AOSP modules use this feature, defer handling
ctx.ModuleErrorf("bp2build cannot migrate a module with arch/target-specific static_executable values")
}
+ if stem := linkerProps.Stem; stem != nil {
+ attrs.Stem.SetSelectValue(axis, config, stem)
+ }
if suffix := linkerProps.Suffix; suffix != nil {
attrs.Suffix.SetSelectValue(axis, config, suffix)
}
@@ -1757,6 +1781,12 @@
for _, sanitizer := range sanitizerProps.Sanitize.Misc_undefined {
features = append(features, "ubsan_"+sanitizer)
}
+ if proptools.Bool(sanitizerProps.Sanitize.Cfi) {
+ features = append(features, "android_cfi")
+ if proptools.Bool(sanitizerProps.Sanitize.Config.Cfi_assembly_support) {
+ features = append(features, "android_cfi_assembly_support")
+ }
+ }
sanitizerFeatures.SetSelectValue(axis, config, features)
}
})
diff --git a/cc/cc.go b/cc/cc.go
index ddff2b0..a7d6ff5 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -524,6 +524,7 @@
isAfdoCompile() bool
isPgoCompile() bool
isCfi() bool
+ isFuzzer() bool
isNDKStubLibrary() bool
useClangLld(actx ModuleContext) bool
isForPlatform() bool
@@ -1369,6 +1370,13 @@
return false
}
+func (c *Module) isFuzzer() bool {
+ if sanitize := c.sanitize; sanitize != nil {
+ return Bool(sanitize.Properties.SanitizeMutated.Fuzzer)
+ }
+ return false
+}
+
func (c *Module) isNDKStubLibrary() bool {
if _, ok := c.compiler.(*stubDecorator); ok {
return true
@@ -1664,6 +1672,10 @@
return ctx.mod.isCfi()
}
+func (ctx *moduleContextImpl) isFuzzer() bool {
+ return ctx.mod.isFuzzer()
+}
+
func (ctx *moduleContextImpl) isNDKStubLibrary() bool {
return ctx.mod.isNDKStubLibrary()
}
@@ -1905,14 +1917,14 @@
// IsMixedBuildSupported returns true if the module should be analyzed by Bazel
// in any of the --bazel-mode(s).
func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
- if !allEnabledSanitizersSupportedByBazel(c) {
+ if !allEnabledSanitizersSupportedByBazel(ctx, c) {
//TODO(b/278772861) support sanitizers in Bazel rules
return false
}
return c.bazelHandler != nil
}
-func allEnabledSanitizersSupportedByBazel(c *Module) bool {
+func allEnabledSanitizersSupportedByBazel(ctx android.BaseModuleContext, c *Module) bool {
if c.sanitize == nil {
return true
}
@@ -1920,7 +1932,6 @@
unsupportedSanitizers := []*bool{
sanitizeProps.Safestack,
- sanitizeProps.Cfi,
sanitizeProps.Scudo,
BoolPtr(len(c.sanitize.Properties.Sanitize.Recover) > 0),
BoolPtr(c.sanitize.Properties.Sanitize.Blocklist != nil),
@@ -1936,10 +1947,17 @@
// TODO(b/261058727): enable mixed builds for all modules with UBSan
// Currently we can only support ubsan when minimum runtime is used.
ubsanEnabled := Bool(sanitizeProps.Integer_overflow) || len(sanitizeProps.Misc_undefined) > 0
- if ubsanEnabled && !c.MinimalRuntimeNeeded() {
- return false
+ if !ubsanEnabled || c.MinimalRuntimeNeeded() {
+ continue
}
- } else if c.sanitize.isSanitizerEnabled(san) {
+ } else if san == cfi {
+ apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
+ // Only allow cfi if this is an apex variant
+ if !apexInfo.IsForPlatform() {
+ continue
+ }
+ }
+ if c.sanitize.isSanitizerEnabled(san) {
return false
}
}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 173911b..701c3bb 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -5538,7 +5538,7 @@
name: "foo_cfi",
variant: "android_arm64_armv8-a_static_cfi_apex28",
expectedOutputPaths: []string{
- "out/soong/.intermediates/foo_cfi/android_arm64_armv8-a_static_cfi_apex28/foo_cfi.a",
+ "outputbase/execroot/__main__/foo_cfi.a",
},
},
{
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index a63d5c2..d66697c 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -29,12 +29,14 @@
// A temporary fix for SExtWRemoval miscompilation bug.
"-mllvm",
"-riscv-disable-sextw-removal=true",
+ "-march=rv64gc_zbb",
}
riscv64ArchVariantCflags = map[string][]string{}
riscv64Ldflags = []string{
"-Wl,--hash-style=gnu",
+ "-march=rv64gc_zbb",
}
riscv64Lldflags = append(riscv64Ldflags,
diff --git a/cc/config/tidy.go b/cc/config/tidy.go
index d55a13d..efa4549 100644
--- a/cc/config/tidy.go
+++ b/cc/config/tidy.go
@@ -42,6 +42,8 @@
"-bugprone-unchecked-optional-access",
// http://b/265438407
"-misc-use-anonymous-namespace",
+ // http://b/285005947
+ "-performance-avoid-endl",
}
// Some clang-tidy checks are included in some tidy_checks_as_errors lists,
@@ -56,6 +58,14 @@
"-bugprone-signed-char-misuse",
// http://b/241819232
"-misc-const-correctness",
+ // http://b/285356805
+ "-bugprone-unsafe-functions",
+ "-cert-msc24-c",
+ "-cert-msc33-c",
+ // http://b/285356799
+ "-modernize-type-traits",
+ // http://b/285361108
+ "-readability-avoid-unconditional-preprocessor-if",
}
extraArgFlags = []string{
diff --git a/cc/library.go b/cc/library.go
index 98096a8..47df53e 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -408,6 +408,7 @@
sharedTargetAttrs.Stubs_symbol_file = compilerAttrs.stubsSymbolFile
}
+ sharedTargetAttrs.Stem = compilerAttrs.stem
sharedTargetAttrs.Suffix = compilerAttrs.suffix
for axis, configToProps := range m.GetArchVariantProperties(ctx, &LibraryProperties{}) {
@@ -2987,6 +2988,7 @@
Features: *features,
+ Stem: compilerAttrs.stem,
Suffix: compilerAttrs.suffix,
bazelCcHeaderAbiCheckerAttributes: bp2buildParseAbiCheckerProps(ctx, module),
@@ -3072,6 +3074,7 @@
Inject_bssl_hash bazel.BoolAttribute
+ Stem bazel.StringAttribute
Suffix bazel.StringAttribute
bazelCcHeaderAbiCheckerAttributes
diff --git a/cc/lto.go b/cc/lto.go
index be8fc56..878c21f 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -43,18 +43,15 @@
// referred to in blueprint files as "lto"
Lto struct {
Never *bool `android:"arch_variant"`
- Full *bool `android:"arch_variant"`
Thin *bool `android:"arch_variant"`
} `android:"arch_variant"`
+ LtoEnabled bool `blueprint:"mutated"`
+
// Dep properties indicate that this module needs to be built with LTO
// since it is an object dependency of an LTO module.
- FullEnabled bool `blueprint:"mutated"`
- ThinEnabled bool `blueprint:"mutated"`
- NoLtoEnabled bool `blueprint:"mutated"`
- FullDep bool `blueprint:"mutated"`
- ThinDep bool `blueprint:"mutated"`
- NoLtoDep bool `blueprint:"mutated"`
+ LtoDep bool `blueprint:"mutated"`
+ NoLtoDep bool `blueprint:"mutated"`
// Use -fwhole-program-vtables cflag.
Whole_program_vtables *bool
@@ -69,25 +66,20 @@
}
func (lto *lto) begin(ctx BaseModuleContext) {
- if ctx.Config().IsEnvTrue("DISABLE_LTO") {
- lto.Properties.NoLtoEnabled = true
- }
+ lto.Properties.LtoEnabled = lto.LTO(ctx)
}
func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
- // TODO(b/131771163): Disable LTO when using explicit fuzzing configurations.
- // LTO breaks fuzzer builds.
- if inList("-fsanitize=fuzzer-no-link", flags.Local.CFlags) {
+ // TODO(b/131771163): CFI and Fuzzer controls LTO flags by themselves.
+ // This has be checked late because these properties can be mutated.
+ if ctx.isCfi() || ctx.isFuzzer() {
return flags
}
-
- if lto.LTO(ctx) {
+ if lto.Properties.LtoEnabled {
var ltoCFlag string
var ltoLdFlag string
if lto.ThinLTO() {
ltoCFlag = "-flto=thin -fsplit-lto-unit"
- } else if lto.FullLTO() {
- ltoCFlag = "-flto"
} else {
ltoCFlag = "-flto=thin -fsplit-lto-unit"
ltoLdFlag = "-Wl,--lto-O0"
@@ -102,7 +94,7 @@
flags.Local.CFlags = append(flags.Local.CFlags, "-fwhole-program-vtables")
}
- if (lto.DefaultThinLTO(ctx) || lto.ThinLTO()) && ctx.Config().IsEnvTrue("USE_THINLTO_CACHE") {
+ if ctx.Config().IsEnvTrue("USE_THINLTO_CACHE") {
// Set appropriate ThinLTO cache policy
cacheDirFormat := "-Wl,--thinlto-cache-dir="
cacheDir := android.PathForOutput(ctx, "thinlto-cache").String()
@@ -125,34 +117,40 @@
return flags
}
+// Determine which LTO mode to use for the given module.
func (lto *lto) LTO(ctx BaseModuleContext) bool {
- return lto.ThinLTO() || lto.FullLTO() || lto.DefaultThinLTO(ctx)
-}
-
-func (lto *lto) DefaultThinLTO(ctx BaseModuleContext) bool {
+ if lto.Never() {
+ return false
+ }
+ if ctx.Config().IsEnvTrue("DISABLE_LTO") {
+ return false
+ }
+ // Module explicitly requests for LTO.
+ if lto.ThinLTO() {
+ return true
+ }
// LP32 has many subtle issues and less test coverage.
- lib32 := ctx.Arch().ArchType.Multilib == "lib32"
- // CFI enables full LTO.
- cfi := ctx.isCfi()
+ if ctx.Arch().ArchType.Multilib == "lib32" {
+ return false
+ }
// Performance and binary size are less important for host binaries and tests.
- host := ctx.Host()
- test := ctx.testBinary() || ctx.testLibrary()
+ if ctx.Host() || ctx.testBinary() || ctx.testLibrary() {
+ return false
+ }
// FIXME: ThinLTO for VNDK produces different output.
// b/169217596
- vndk := ctx.isVndk()
- return GlobalThinLTO(ctx) && !lto.Never() && !lib32 && !cfi && !host && !test && !vndk
-}
-
-func (lto *lto) FullLTO() bool {
- return lto != nil && (proptools.Bool(lto.Properties.Lto.Full) || lto.Properties.FullEnabled)
+ if ctx.isVndk() {
+ return false
+ }
+ return GlobalThinLTO(ctx)
}
func (lto *lto) ThinLTO() bool {
- return lto != nil && (proptools.Bool(lto.Properties.Lto.Thin) || lto.Properties.ThinEnabled)
+ return lto != nil && proptools.Bool(lto.Properties.Lto.Thin)
}
func (lto *lto) Never() bool {
- return lto != nil && (proptools.Bool(lto.Properties.Lto.Never) || lto.Properties.NoLtoEnabled)
+ return lto != nil && proptools.Bool(lto.Properties.Lto.Never)
}
func GlobalThinLTO(ctx android.BaseModuleContext) bool {
@@ -161,14 +159,11 @@
// Propagate lto requirements down from binaries
func ltoDepsMutator(mctx android.TopDownMutatorContext) {
- globalThinLTO := GlobalThinLTO(mctx)
+ defaultLTOMode := GlobalThinLTO(mctx)
if m, ok := mctx.Module().(*Module); ok {
- full := m.lto.FullLTO()
- thin := m.lto.ThinLTO()
- never := m.lto.Never()
- if full && thin {
- mctx.PropertyErrorf("LTO", "FullLTO and ThinLTO are mutually exclusive")
+ if m.lto == nil || m.lto.Properties.LtoEnabled == defaultLTOMode {
+ return
}
mctx.WalkDeps(func(dep android.Module, parent android.Module) bool {
@@ -187,13 +182,9 @@
}
if dep, ok := dep.(*Module); ok {
- if full && !dep.lto.FullLTO() {
- dep.lto.Properties.FullDep = true
- }
- if !globalThinLTO && thin && !dep.lto.ThinLTO() {
- dep.lto.Properties.ThinDep = true
- }
- if globalThinLTO && never && !dep.lto.Never() {
+ if m.lto.Properties.LtoEnabled {
+ dep.lto.Properties.LtoDep = true
+ } else {
dep.lto.Properties.NoLtoDep = true
}
}
@@ -212,28 +203,19 @@
// Create variations for LTO types required as static
// dependencies
variationNames := []string{""}
- if m.lto.Properties.FullDep && !m.lto.FullLTO() {
- variationNames = append(variationNames, "lto-full")
- }
- if !globalThinLTO && m.lto.Properties.ThinDep && !m.lto.ThinLTO() {
+ if m.lto.Properties.LtoDep {
variationNames = append(variationNames, "lto-thin")
}
- if globalThinLTO && m.lto.Properties.NoLtoDep && !m.lto.Never() {
+ if m.lto.Properties.NoLtoDep {
variationNames = append(variationNames, "lto-none")
}
- // Use correct dependencies if LTO property is explicitly set
- // (mutually exclusive)
- if m.lto.FullLTO() {
- mctx.SetDependencyVariation("lto-full")
- }
- if !globalThinLTO && m.lto.ThinLTO() {
- mctx.SetDependencyVariation("lto-thin")
- }
- // Never must be the last, it overrides Thin or Full.
- if globalThinLTO && m.lto.Never() {
+ if globalThinLTO && !m.lto.Properties.LtoEnabled {
mctx.SetDependencyVariation("lto-none")
}
+ if !globalThinLTO && m.lto.Properties.LtoEnabled {
+ mctx.SetDependencyVariation("lto-thin")
+ }
if len(variationNames) > 1 {
modules := mctx.CreateVariations(variationNames...)
@@ -247,19 +229,15 @@
}
// LTO properties for dependencies
- if name == "lto-full" {
- variation.lto.Properties.FullEnabled = true
- }
if name == "lto-thin" {
- variation.lto.Properties.ThinEnabled = true
+ variation.lto.Properties.LtoEnabled = true
}
if name == "lto-none" {
- variation.lto.Properties.NoLtoEnabled = true
+ variation.lto.Properties.LtoEnabled = false
}
variation.Properties.PreventInstall = true
variation.Properties.HideFromMake = true
- variation.lto.Properties.FullDep = false
- variation.lto.Properties.ThinDep = false
+ variation.lto.Properties.LtoDep = false
variation.lto.Properties.NoLtoDep = false
}
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 6e732b6..a5691ee 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -64,13 +64,14 @@
cfiBlocklistPath = "external/compiler-rt/lib/cfi"
cfiBlocklistFilename = "cfi_blocklist.txt"
+ cfiEnableFlag = "-fsanitize=cfi"
cfiCrossDsoFlag = "-fsanitize-cfi-cross-dso"
cfiCflags = []string{"-flto", cfiCrossDsoFlag,
"-fsanitize-ignorelist=" + cfiBlocklistPath + "/" + cfiBlocklistFilename}
// -flto and -fvisibility are required by clang when -fsanitize=cfi is
// used, but have no effect on assembly files
cfiAsflags = []string{"-flto", "-fvisibility=default"}
- cfiLdflags = []string{"-flto", cfiCrossDsoFlag, "-fsanitize=cfi",
+ cfiLdflags = []string{"-flto", cfiCrossDsoFlag, cfiEnableFlag,
"-Wl,-plugin-opt,O1"}
cfiExportsMapPath = "build/soong/cc/config"
cfiExportsMapFilename = "cfi_exports.map"
@@ -395,8 +396,8 @@
// Leave out "-flto" from the slices exported to bazel, as we will use the
// dedicated LTO feature for this. For C Flags and Linker Flags, also leave
- // out the cross DSO flag which will be added separately by transitions.
- exportedVars.ExportStringList("CfiCFlags", cfiCflags[2:])
+ // out the cross DSO flag which will be added separately under the correct conditions.
+ exportedVars.ExportStringList("CfiCFlags", append(cfiCflags[2:], cfiEnableFlag))
exportedVars.ExportStringList("CfiLdFlags", cfiLdflags[2:])
exportedVars.ExportStringList("CfiAsFlags", cfiAsflags[1:])
diff --git a/cc/test.go b/cc/test.go
index 27de06b..3f5f710 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -70,6 +70,10 @@
// Add MinApiLevelModuleController with ro.vndk.version property. If ro.vndk.version has an
// integer value and the value is less than the min_vndk_version, skip this module.
Min_vndk_version *int64
+
+ // Extra <option> tags to add to the auto generated test xml file under the test runner, e.g., GTest.
+ // The "key" is optional in each of these.
+ Test_runner_options []tradefed.Option
}
type TestBinaryProperties struct {
@@ -398,6 +402,7 @@
TestConfigTemplateProp: test.Properties.Test_config_template,
TestSuites: test.testDecorator.InstallerProperties.Test_suites,
Config: configs,
+ TestRunnerOptions: test.Properties.Test_options.Test_runner_options,
AutoGenConfig: test.Properties.Auto_gen_config,
TestInstallBase: testInstallBase,
DeviceTemplate: "${NativeTestConfigTemplate}",
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index e006c9d..e903c0a 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -16,10 +16,12 @@
import (
"bytes"
+ "errors"
"flag"
"fmt"
"os"
"path/filepath"
+ "regexp"
"strings"
"time"
@@ -135,12 +137,24 @@
writeDepFile(cmdlineArgs.OutFile, ctx.EventHandler, ninjaDeps)
- if ctx.Config().IsEnvTrue("SOONG_GENERATES_NINJA_HINT") {
+ if needToWriteNinjaHint(ctx) {
writeNinjaHint(ctx)
}
return cmdlineArgs.OutFile
}
+func needToWriteNinjaHint(ctx *android.Context) bool {
+ switch ctx.Config().GetenvWithDefault("SOONG_GENERATES_NINJA_HINT", "") {
+ case "always":
+ return true
+ case "depend":
+ if _, err := os.Stat(filepath.Join(ctx.Config().OutDir(), ".ninja_log")); errors.Is(err, os.ErrNotExist) {
+ return true
+ }
+ }
+ return false
+}
+
// Run the code-generation phase to convert BazelTargetModules to BUILD files.
func runQueryView(queryviewDir, queryviewMarker string, ctx *android.Context) {
ctx.EventHandler.Begin("queryview")
@@ -460,7 +474,7 @@
// The actual output (build.ninja) was written in the RunBlueprint() call
// above
writeDepFile(cmdlineArgs.OutFile, ctx.EventHandler, ninjaDeps)
- if ctx.Config().IsEnvTrue("SOONG_GENERATES_NINJA_HINT") {
+ if needToWriteNinjaHint(ctx) {
writeNinjaHint(ctx)
}
return cmdlineArgs.OutFile
@@ -552,6 +566,12 @@
}
writeMetrics(configuration, ctx.EventHandler, metricsDir)
}
+
+ // Register this environment variablesas being an implicit dependencies of
+ // soong_build. Changes to this environment variable will result in
+ // retriggering soong_build.
+ configuration.Getenv("USE_BAZEL_VERSION")
+
writeUsedEnvironmentFile(configuration)
// Touch the output file so that it's the newest file created by soong_build.
@@ -743,6 +763,43 @@
return excluded
}
+// buildTargetsByPackage parses Bazel BUILD.bazel and BUILD files under
+// the workspace, and returns a map containing names of Bazel targets defined in
+// these BUILD files.
+// For example, maps "//foo/bar" to ["baz", "qux"] if `//foo/bar:{baz,qux}` exist.
+func buildTargetsByPackage(ctx *android.Context) map[string][]string {
+ existingBazelFiles, err := getExistingBazelRelatedFiles(topDir)
+ maybeQuit(err, "Error determining existing Bazel-related files")
+
+ result := map[string][]string{}
+
+ // Search for instances of `name = "$NAME"` (with arbitrary spacing).
+ targetNameRegex := regexp.MustCompile(`(?m)^\s*name\s*=\s*\"([^\"]+)\"`)
+
+ for _, path := range existingBazelFiles {
+ if !ctx.Config().Bp2buildPackageConfig.ShouldKeepExistingBuildFileForDir(filepath.Dir(path)) {
+ continue
+ }
+ fullPath := shared.JoinPath(topDir, path)
+ sourceDir := filepath.Dir(path)
+ fileInfo, err := os.Stat(fullPath)
+ maybeQuit(err, "Error accessing Bazel file '%s'", fullPath)
+
+ if !fileInfo.IsDir() &&
+ (fileInfo.Name() == "BUILD" || fileInfo.Name() == "BUILD.bazel") {
+ // Process this BUILD file.
+ buildFileContent, err := os.ReadFile(fullPath)
+ maybeQuit(err, "Error reading Bazel file '%s'", fullPath)
+
+ matches := targetNameRegex.FindAllStringSubmatch(string(buildFileContent), -1)
+ for _, match := range matches {
+ result[sourceDir] = append(result[sourceDir], match[1])
+ }
+ }
+ }
+ return result
+}
+
// Run Soong in the bp2build mode. This creates a standalone context that registers
// an alternate pipeline of mutators and singletons specifically for generating
// Bazel BUILD files instead of Ninja files.
@@ -750,6 +807,10 @@
var codegenMetrics *bp2build.CodegenMetrics
ctx.EventHandler.Do("bp2build", func() {
+ ctx.EventHandler.Do("read_build", func() {
+ ctx.Config().SetBazelBuildFileTargets(buildTargetsByPackage(ctx))
+ })
+
// Propagate "allow misssing dependencies" bit. This is normally set in
// newContext(), but we create ctx without calling that method.
ctx.SetAllowMissingDependencies(ctx.Config().AllowMissingDependencies())
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index eea41e6..682fb75 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -242,9 +242,10 @@
soongMetricsFile := filepath.Join(logsDir, logsPrefix+"soong_metrics")
bp2buildMetricsFile := filepath.Join(logsDir, logsPrefix+"bp2build_metrics.pb")
soongBuildMetricsFile := filepath.Join(logsDir, logsPrefix+"soong_build_metrics.pb")
+ bazelMetricsFile := filepath.Join(logsDir, logsPrefix+"bazel_metrics.pb")
//Delete the stale metrics files
- staleFileSlice := []string{buildErrorFile, rbeMetricsFile, soongMetricsFile, bp2buildMetricsFile, soongBuildMetricsFile}
+ staleFileSlice := []string{buildErrorFile, rbeMetricsFile, soongMetricsFile, bp2buildMetricsFile, soongBuildMetricsFile, bazelMetricsFile}
if err := deleteStaleMetrics(staleFileSlice); err != nil {
log.Fatalln(err)
}
diff --git a/device_config/Android.bp b/device_config/Android.bp
index 360b389..6c44454 100644
--- a/device_config/Android.bp
+++ b/device_config/Android.bp
@@ -12,19 +12,21 @@
"soong",
"soong-android",
"soong-bazel",
- "soong-shared",
+ "soong-android",
+ "soong-java",
],
srcs: [
"device_config_definitions.go",
"device_config_values.go",
"device_config_value_set.go",
"init.go",
- //"testing.go"
+ "java_device_config_definitions_library.go",
+ "testing.go",
],
- /*
testSrcs: [
- "device_config_test.go",
+ "device_config_definitions_test.go",
+ "device_config_values_test.go",
+ "device_config_value_set_test.go",
],
- */
pluginFor: ["soong_build"],
}
diff --git a/device_config/device_config_definitions.go b/device_config/device_config_definitions.go
index c565766..bb78695 100644
--- a/device_config/device_config_definitions.go
+++ b/device_config/device_config_definitions.go
@@ -38,7 +38,6 @@
}
intermediatePath android.WritablePath
- srcJarPath android.WritablePath
}
func DefinitionsFactory() android.Module {
@@ -78,8 +77,6 @@
func (module *DefinitionsModule) OutputFiles(tag string) (android.Paths, error) {
switch tag {
- case ".srcjar":
- return []android.Path{module.srcJarPath}, nil
case "":
// The default output of this module is the intermediates format, which is
// not installable and in a private format that no other rules can handle
@@ -99,6 +96,14 @@
return sb.String()
}
+// Provider published by device_config_value_set
+type definitionsProviderData struct {
+ namespace string
+ intermediatePath android.WritablePath
+}
+
+var definitionsProviderKey = blueprint.NewProvider(definitionsProviderData{})
+
func (module *DefinitionsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Get the values that came from the global RELEASE_DEVICE_CONFIG_VALUE_SETS flag
ctx.VisitDirectDeps(func(dep android.Module) {
@@ -117,11 +122,11 @@
// Intermediate format
inputFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
- module.intermediatePath = android.PathForModuleOut(ctx, "intermediate.json")
+ intermediatePath := android.PathForModuleOut(ctx, "intermediate.json")
ctx.Build(pctx, android.BuildParams{
Rule: aconfigRule,
Inputs: inputFiles,
- Output: module.intermediatePath,
+ Output: intermediatePath,
Description: "device_config_definitions",
Args: map[string]string{
"release_version": ctx.Config().ReleaseVersion(),
@@ -130,21 +135,9 @@
},
})
- // Generated java inside a srcjar
- module.srcJarPath = android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
- ctx.Build(pctx, android.BuildParams{
- Rule: srcJarRule,
- Input: module.intermediatePath,
- Output: module.srcJarPath,
- Description: "device_config.srcjar",
+ ctx.SetProvider(definitionsProviderKey, definitionsProviderData{
+ namespace: module.properties.Namespace,
+ intermediatePath: intermediatePath,
})
- // TODO: C++
-
- // Phony target for debugging convenience
- ctx.Build(pctx, android.BuildParams{
- Rule: blueprint.Phony,
- Output: android.PathForPhony(ctx, ctx.ModuleName()),
- Inputs: []android.Path{module.srcJarPath}, // TODO: C++
- })
}
diff --git a/device_config/device_config_definitions_test.go b/device_config/device_config_definitions_test.go
new file mode 100644
index 0000000..49afcc4
--- /dev/null
+++ b/device_config/device_config_definitions_test.go
@@ -0,0 +1,42 @@
+// Copyright 2018 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package device_config
+
+import (
+ "strings"
+ "testing"
+
+ "android/soong/android"
+)
+
+func TestDeviceConfigDefinitions(t *testing.T) {
+ bp := `
+ device_config_definitions {
+ name: "module_name",
+ namespace: "com.example.package",
+ srcs: ["foo.aconfig"],
+ }
+ `
+ result := runTest(t, android.FixtureExpectsNoErrors, bp)
+
+ module := result.ModuleForTests("module_name", "").Module().(*DefinitionsModule)
+
+ // Check that the provider has the right contents
+ depData := result.ModuleProvider(module, definitionsProviderKey).(definitionsProviderData)
+ android.AssertStringEquals(t, "namespace", depData.namespace, "com.example.package")
+ if !strings.HasSuffix(depData.intermediatePath.String(), "/intermediate.json") {
+ t.Errorf("Missing intermediates path in provider: %s", depData.intermediatePath.String())
+ }
+}
diff --git a/device_config/device_config_test.go b/device_config/device_config_test.go
deleted file mode 100644
index 91a06a7..0000000
--- a/device_config/device_config_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2019 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package device_config
-
-import (
- "os"
- "testing"
-
- "android/soong/android"
- "android/soong/java"
-)
-
-func TestMain(m *testing.M) {
- os.Exit(m.Run())
-}
-
-func test(t *testing.T, bp string) *android.TestResult {
- t.Helper()
-
- mockFS := android.MockFS{
- "config.aconfig": nil,
- }
-
- result := android.GroupFixturePreparers(
- java.PrepareForTestWithJavaDefaultModules,
- PrepareForTestWithSyspropBuildComponents,
- // TODO: Consider values files, although maybe in its own test
- // android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
- // variables.ReleaseConfigValuesBasePaths = ...
- //})
- mockFS.AddToFixture(),
- android.FixtureWithRootAndroidBp(bp),
- ).RunTest(t)
-
- return result
-}
-
-func TestOutputs(t *testing.T) {
- /*result := */ test(t, `
- device_config {
- name: "my_device_config",
- srcs: ["config.aconfig"],
- }
- `)
-
- // TODO: Make sure it exports a .srcjar, which is used by java libraries
- // TODO: Make sure it exports an intermediates file
- // TODO: Make sure the intermediates file is propagated to the Android.mk file
-}
diff --git a/device_config/device_config_value_set_test.go b/device_config/device_config_value_set_test.go
new file mode 100644
index 0000000..f9e7c38
--- /dev/null
+++ b/device_config/device_config_value_set_test.go
@@ -0,0 +1,43 @@
+// Copyright 2018 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package device_config
+
+import (
+ "testing"
+
+ "android/soong/android"
+)
+
+func TestDeviceConfigValueSet(t *testing.T) {
+ bp := `
+ device_config_values {
+ name: "one",
+ srcs: [ "blah.aconfig_values" ],
+ namespace: "foo.namespace"
+ }
+
+ device_config_value_set {
+ name: "module_name",
+ values: [ "one" ],
+ }
+ `
+ result := runTest(t, android.FixtureExpectsNoErrors, bp)
+
+ module := result.ModuleForTests("module_name", "").Module().(*ValueSetModule)
+
+ // Check that the provider has the right contents
+ depData := result.ModuleProvider(module, valueSetProviderKey).(valueSetProviderData)
+ android.AssertStringEquals(t, "AvailableNamespaces", "blah.aconfig_values", depData.AvailableNamespaces["foo.namespace"][0].String())
+}
diff --git a/device_config/device_config_values_test.go b/device_config/device_config_values_test.go
new file mode 100644
index 0000000..64c57eb
--- /dev/null
+++ b/device_config/device_config_values_test.go
@@ -0,0 +1,39 @@
+// Copyright 2018 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package device_config
+
+import (
+ "testing"
+
+ "android/soong/android"
+)
+
+func TestDeviceConfigValues(t *testing.T) {
+ bp := `
+ device_config_values {
+ name: "module_name",
+ srcs: [ "blah.aconfig_values" ],
+ namespace: "foo.namespace"
+ }
+ `
+ result := runTest(t, android.FixtureExpectsNoErrors, bp)
+
+ module := result.ModuleForTests("module_name", "").Module().(*ValuesModule)
+
+ // Check that the provider has the right contents
+ depData := result.ModuleProvider(module, valuesProviderKey).(valuesProviderData)
+ android.AssertStringEquals(t, "namespace", "foo.namespace", depData.Namespace)
+ android.AssertPathsEndWith(t, "srcs", []string{"blah.aconfig_values"}, depData.Values)
+}
diff --git a/device_config/init.go b/device_config/init.go
index 0a4645b..04bbab6 100644
--- a/device_config/init.go
+++ b/device_config/init.go
@@ -23,11 +23,10 @@
pctx = android.NewPackageContext("android/soong/device_config")
// For device_config_definitions: Generate cache file
- // TODO: Restat
aconfigRule = pctx.AndroidStaticRule("aconfig",
blueprint.RuleParams{
Command: `${aconfig} create-cache` +
- ` --namespace ${namespace}` +
+ ` --package ${namespace}` +
` --declarations ${in}` +
` ${values}` +
` --cache ${out}.tmp` +
@@ -39,7 +38,7 @@
Restat: true,
}, "release_version", "namespace", "values")
- // For device_config_definitions: Generate java file
+ // For java_device_config_definitions_library: Generate java file
srcJarRule = pctx.AndroidStaticRule("aconfig_srcjar",
blueprint.RuleParams{
Command: `rm -rf ${out}.tmp` +
@@ -59,12 +58,13 @@
func init() {
registerBuildComponents(android.InitRegistrationContext)
+ pctx.HostBinToolVariable("aconfig", "aconfig")
+ pctx.HostBinToolVariable("soong_zip", "soong_zip")
}
func registerBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("device_config_definitions", DefinitionsFactory)
ctx.RegisterModuleType("device_config_values", ValuesFactory)
ctx.RegisterModuleType("device_config_value_set", ValueSetFactory)
- pctx.HostBinToolVariable("aconfig", "aconfig")
- pctx.HostBinToolVariable("soong_zip", "soong_zip")
+ ctx.RegisterModuleType("java_device_config_definitions_library", JavaDefinitionsLibraryFactory)
}
diff --git a/device_config/java_device_config_definitions_library.go b/device_config/java_device_config_definitions_library.go
new file mode 100644
index 0000000..6e48ece
--- /dev/null
+++ b/device_config/java_device_config_definitions_library.go
@@ -0,0 +1,71 @@
+// Copyright 2023 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package device_config
+
+import (
+ "android/soong/android"
+ "android/soong/java"
+ "fmt"
+ "github.com/google/blueprint"
+)
+
+type definitionsTagType struct {
+ blueprint.BaseDependencyTag
+}
+
+var definitionsTag = definitionsTagType{}
+
+type JavaDeviceConfigDefinitionsLibraryProperties struct {
+ // name of the device_config_definitions module to generate a library for
+ Device_config_definitions string
+}
+
+type JavaDeviceConfigDefinitionsLibraryCallbacks struct {
+ properties JavaDeviceConfigDefinitionsLibraryProperties
+}
+
+func JavaDefinitionsLibraryFactory() android.Module {
+ callbacks := &JavaDeviceConfigDefinitionsLibraryCallbacks{}
+ return java.GeneratedJavaLibraryModuleFactory("java_device_config_definitions_library", callbacks, &callbacks.properties)
+}
+
+func (callbacks *JavaDeviceConfigDefinitionsLibraryCallbacks) DepsMutator(module *java.GeneratedJavaLibraryModule, ctx android.BottomUpMutatorContext) {
+ definitions := callbacks.properties.Device_config_definitions
+ if len(definitions) == 0 {
+ // TODO: Add test for this case
+ ctx.PropertyErrorf("device_config_definitions", "device_config_definitions property required")
+ } else {
+ ctx.AddDependency(ctx.Module(), definitionsTag, definitions)
+ }
+}
+
+func (callbacks *JavaDeviceConfigDefinitionsLibraryCallbacks) GenerateSourceJarBuildActions(ctx android.ModuleContext) android.Path {
+ // Get the values that came from the global RELEASE_DEVICE_CONFIG_VALUE_SETS flag
+ definitionsModules := ctx.GetDirectDepsWithTag(definitionsTag)
+ if len(definitionsModules) != 1 {
+ panic(fmt.Errorf("Exactly one device_config_definitions property required"))
+ }
+ definitions := ctx.OtherModuleProvider(definitionsModules[0], definitionsProviderKey).(definitionsProviderData)
+
+ srcJarPath := android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: srcJarRule,
+ Input: definitions.intermediatePath,
+ Output: srcJarPath,
+ Description: "device_config.srcjar",
+ })
+
+ return srcJarPath
+}
diff --git a/device_config/testing.go b/device_config/testing.go
index f054476..284a7fa 100644
--- a/device_config/testing.go
+++ b/device_config/testing.go
@@ -14,6 +14,16 @@
package device_config
-import "android/soong/android"
+import (
+ "testing"
-var PrepareForTestWithSyspropBuildComponents = android.FixtureRegisterWithContext(registerBuildComponents)
+ "android/soong/android"
+)
+
+var PrepareForTestWithDeviceConfigBuildComponents = android.FixtureRegisterWithContext(registerBuildComponents)
+
+func runTest(t *testing.T, errorHandler android.FixtureErrorHandler, bp string) *android.TestResult {
+ return android.GroupFixturePreparers(PrepareForTestWithDeviceConfigBuildComponents).
+ ExtendWithErrorHandler(errorHandler).
+ RunTestWithBp(t, bp)
+}
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index 3e1bbde..370a423 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -38,6 +38,7 @@
"android/soong/android"
"android/soong/bazel"
+ "android/soong/bazel/cquery"
"android/soong/snapshot"
)
@@ -329,7 +330,6 @@
ctx.PropertyErrorf("src", "missing prebuilt source file")
return
}
- p.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
if strings.Contains(filename, "/") {
ctx.PropertyErrorf("filename", "filename cannot contain separator '/'")
@@ -349,21 +349,42 @@
}
p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, p.SubDir())
- // This ensures that outputFilePath has the correct name for others to
- // use, as the source file may have a different name.
- ctx.Build(pctx, android.BuildParams{
- Rule: android.Cp,
- Output: p.outputFilePath,
- Input: p.sourceFilePath,
- })
+ // Call InstallFile even when uninstallable to make the module included in the package
+ ip := installProperties{
+ installable: p.Installable(),
+ filename: filename,
+ sourceFilePath: p.sourceFilePath,
+ symlinks: p.properties.Symlinks,
+ }
+ p.addInstallRules(ctx, ip)
+}
- if !p.Installable() {
+type installProperties struct {
+ installable bool
+ filename string
+ sourceFilePath android.Path
+ symlinks []string
+}
+
+// utility function to add install rules to the build graph.
+// Reduces code duplication between Soong and Mixed build analysis
+func (p *PrebuiltEtc) addInstallRules(ctx android.ModuleContext, ip installProperties) {
+ if !ip.installable {
p.SkipInstall()
}
- // Call InstallFile even when uninstallable to make the module included in the package
- installPath := ctx.InstallFile(p.installDirPath, p.outputFilePath.Base(), p.outputFilePath)
- for _, sl := range p.properties.Symlinks {
+ // Copy the file from src to a location in out/ with the correct `filename`
+ // This ensures that outputFilePath has the correct name for others to
+ // use, as the source file may have a different name.
+ p.outputFilePath = android.PathForModuleOut(ctx, ip.filename).OutputPath
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
+ Output: p.outputFilePath,
+ Input: ip.sourceFilePath,
+ })
+
+ installPath := ctx.InstallFile(p.installDirPath, ip.filename, p.outputFilePath)
+ for _, sl := range ip.symlinks {
ctx.InstallSymlink(p.installDirPath, sl, installPath)
}
}
@@ -781,3 +802,38 @@
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs)
}
+
+var _ android.MixedBuildBuildable = (*PrebuiltEtc)(nil)
+
+func (pe *PrebuiltEtc) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
+ return true
+}
+
+func (pe *PrebuiltEtc) QueueBazelCall(ctx android.BaseModuleContext) {
+ ctx.Config().BazelContext.QueueBazelRequest(
+ pe.GetBazelLabel(ctx, pe),
+ cquery.GetPrebuiltFileInfo,
+ android.GetConfigKey(ctx),
+ )
+}
+
+func (pe *PrebuiltEtc) ProcessBazelQueryResponse(ctx android.ModuleContext) {
+ bazelCtx := ctx.Config().BazelContext
+ pfi, err := bazelCtx.GetPrebuiltFileInfo(pe.GetBazelLabel(ctx, pe), android.GetConfigKey(ctx))
+ if err != nil {
+ ctx.ModuleErrorf(err.Error())
+ return
+ }
+
+ // Set properties for androidmk
+ pe.installDirPath = android.PathForModuleInstall(ctx, pfi.Dir)
+
+ // Installation rules
+ ip := installProperties{
+ installable: pfi.Installable,
+ filename: pfi.Filename,
+ sourceFilePath: android.PathForSource(ctx, pfi.Src),
+ // symlinks: pe.properties.Symlinks, // TODO: b/207489266 - Fully support all properties in prebuilt_file
+ }
+ pe.addInstallRules(ctx, ip)
+}
diff --git a/etc/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go
index 0d44c31..df7664d 100644
--- a/etc/prebuilt_etc_test.go
+++ b/etc/prebuilt_etc_test.go
@@ -23,6 +23,7 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/bazel/cquery"
"android/soong/snapshot"
)
@@ -494,3 +495,41 @@
checkIfSnapshotNotTaken(t, result, "recovery", "prebuilt_recovery_indirect")
})
}
+
+func TestPrebuiltEtcAndroidMkEntriesWithBazel(t *testing.T) {
+ t.Parallel()
+ bp := `
+prebuilt_etc {
+ name: "myetc",
+ src: "prebuilt_etc.rc", // filename in src tree
+ filename: "init.rc", // target filename on device
+ sub_dir: "subdir", // relative subdir for installation
+ bazel_module: { label: "//foo/bar:myetc" },
+}
+`
+ res := android.GroupFixturePreparers(
+ prepareForPrebuiltEtcTest,
+ android.FixtureModifyConfig(func(cfg android.Config) {
+ cfg.BazelContext = android.MockBazelContext{
+ LabelToPrebuiltFileInfo: map[string]cquery.PrebuiltFileInfo{
+ "//foo/bar:myetc": cquery.PrebuiltFileInfo{
+ Src: "foo/bar/prebuilt_etc.rc",
+ Dir: "etc/subdir",
+ Filename: "init.rc",
+ Installable: true,
+ },
+ },
+ }
+ }),
+ ).RunTestWithBp(t, bp)
+ ctx := res.ModuleForTests("myetc", "android_arm64_armv8-a")
+ mod := ctx.Module()
+ entries := android.AndroidMkEntriesForTest(t, res.TestContext, mod)[0]
+ // verify androidmk entries
+ android.AssertStringDoesContain(t, "LOCAL_MODULE_PATH should contain", entries.EntryMap["LOCAL_MODULE_PATH"][0], "etc/subdir")
+ android.AssertStringEquals(t, "LOCAL_INSTALLED_MODULE_STEM is incorrect", "init.rc", entries.EntryMap["LOCAL_INSTALLED_MODULE_STEM"][0])
+ // verify installation rules
+ install := ctx.Description("install")
+ android.AssertStringEquals(t, "Source location of prebuilt_etc installation", "out/soong/.intermediates/myetc/android_arm64_armv8-a/init.rc", install.Input.String())
+ android.AssertStringEquals(t, "Target location of prebuilt_etc installation", "out/soong/target/product/test_device/system/etc/subdir/init.rc", install.Output.String())
+}
diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go
index 2a1b404..b470304 100644
--- a/fuzz/fuzz_common.go
+++ b/fuzz/fuzz_common.go
@@ -170,6 +170,27 @@
return false
}
+type UsePlatformLibs string
+
+const (
+ unknown_use_platform_libs UsePlatformLibs = "unknown_use_platform_libs"
+ // Use the native libraries on the device, typically in /system directory
+ use_platform_libs = "use_platform_libs"
+ // Do not use any native libraries (ART will not be initialized)
+ use_none = "use_none"
+)
+
+func (use_platform_libs UsePlatformLibs) isValidUsePlatformLibs() bool {
+ switch use_platform_libs {
+ case "",
+ unknown_use_platform_libs,
+ use_platform_libs,
+ use_none:
+ return true
+ }
+ return false
+}
+
type UserData string
const (
@@ -284,6 +305,10 @@
if !config.Automatically_route_to.isValidAutomaticallyRouteTo() {
panic(fmt.Errorf("Invalid automatically_route_to in fuzz config in %s", moduleName))
}
+
+ if !config.Use_platform_libs.isValidUsePlatformLibs() {
+ panic(fmt.Errorf("Invalid use_platform_libs in fuzz config in %s", moduleName))
+ }
}
return true
}
@@ -341,6 +366,8 @@
Target_modules []string `json:"target_modules,omitempty"`
// Specifies a bug assignee to replace default ISE assignment
Triage_assignee string `json:"triage_assignee,omitempty"`
+ // Specifies libs used to initialize ART (java only, 'use_none' for no initialization)
+ Use_platform_libs UsePlatformLibs `json:"use_platform_libs,omitempty"`
}
type FuzzFrameworks struct {
diff --git a/genrule/allowlists.go b/genrule/allowlists.go
index 2954f8b..b0508cb 100644
--- a/genrule/allowlists.go
+++ b/genrule/allowlists.go
@@ -47,7 +47,6 @@
}
SandboxingDenyModuleList = []string{
- "framework-javastream-protos",
"RsBalls-rscript",
"CtsRsBlasTestCases-rscript",
"pvmfw_fdt_template_rs",
@@ -88,7 +87,6 @@
"vm-tests-tf-lib",
"hidl_cpp_impl_test_gen-headers",
"pandora_experimental-python-gen-src",
- "framework-cppstream-protos",
"Refocus-rscript",
"RSTest_v11-rscript",
"RSTest_v16-rscript",
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 4992625..889bccd 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -203,12 +203,13 @@
type taskFunc func(ctx android.ModuleContext, rawCommand string, srcFiles android.Paths) []generateTask
type generateTask struct {
- in android.Paths
- out android.WritablePaths
- depFile android.WritablePath
- copyTo android.WritablePaths // For gensrcs to set on gensrcsMerge rule.
- genDir android.WritablePath
- extraTools android.Paths // dependencies on tools used by the generator
+ in android.Paths
+ out android.WritablePaths
+ depFile android.WritablePath
+ copyTo android.WritablePaths // For gensrcs to set on gensrcsMerge rule.
+ genDir android.WritablePath
+ extraTools android.Paths // dependencies on tools used by the generator
+ extraInputs map[string][]string
cmd string
// For gensrsc sharding.
@@ -402,30 +403,35 @@
addLocationLabel(toolFile, toolLocation{paths})
}
- includeDirInPaths := ctx.DeviceConfig().BuildBrokenInputDir(g.Name())
- var srcFiles android.Paths
- for _, in := range g.properties.Srcs {
- paths, missingDeps := android.PathsAndMissingDepsRelativeToModuleSourceDir(android.SourceInput{
- Context: ctx, Paths: []string{in}, ExcludePaths: g.properties.Exclude_srcs, IncludeDirs: includeDirInPaths,
- })
- if len(missingDeps) > 0 {
- if !ctx.Config().AllowMissingDependencies() {
- panic(fmt.Errorf("should never get here, the missing dependencies %q should have been reported in DepsMutator",
- missingDeps))
- }
+ addLabelsForInputs := func(propName string, include, exclude []string) android.Paths {
- // If AllowMissingDependencies is enabled, the build will not have stopped when
- // the dependency was added on a missing SourceFileProducer module, which will result in nonsensical
- // "cmd: label ":..." has no files" errors later. Add a placeholder file to the local label.
- // The command that uses this placeholder file will never be executed because the rule will be
- // replaced with an android.Error rule reporting the missing dependencies.
- ctx.AddMissingDependencies(missingDeps)
- addLocationLabel(in, errorLocation{"***missing srcs " + in + "***"})
- } else {
- srcFiles = append(srcFiles, paths...)
- addLocationLabel(in, inputLocation{paths})
+ includeDirInPaths := ctx.DeviceConfig().BuildBrokenInputDir(g.Name())
+ var srcFiles android.Paths
+ for _, in := range include {
+ paths, missingDeps := android.PathsAndMissingDepsRelativeToModuleSourceDir(android.SourceInput{
+ Context: ctx, Paths: []string{in}, ExcludePaths: exclude, IncludeDirs: includeDirInPaths,
+ })
+ if len(missingDeps) > 0 {
+ if !ctx.Config().AllowMissingDependencies() {
+ panic(fmt.Errorf("should never get here, the missing dependencies %q should have been reported in DepsMutator",
+ missingDeps))
+ }
+
+ // If AllowMissingDependencies is enabled, the build will not have stopped when
+ // the dependency was added on a missing SourceFileProducer module, which will result in nonsensical
+ // "cmd: label ":..." has no files" errors later. Add a placeholder file to the local label.
+ // The command that uses this placeholder file will never be executed because the rule will be
+ // replaced with an android.Error rule reporting the missing dependencies.
+ ctx.AddMissingDependencies(missingDeps)
+ addLocationLabel(in, errorLocation{"***missing " + propName + " " + in + "***"})
+ } else {
+ srcFiles = append(srcFiles, paths...)
+ addLocationLabel(in, inputLocation{paths})
+ }
}
+ return srcFiles
}
+ srcFiles := addLabelsForInputs("srcs", g.properties.Srcs, g.properties.Exclude_srcs)
var copyFrom android.Paths
var outputFiles android.WritablePaths
@@ -437,12 +443,20 @@
}
// Generate tasks, either from genrule or gensrcs.
- for _, task := range g.taskGenerator(ctx, cmd, srcFiles) {
+ for i, task := range g.taskGenerator(ctx, cmd, srcFiles) {
if len(task.out) == 0 {
ctx.ModuleErrorf("must have at least one output file")
return
}
+ var extraInputs android.Paths
+ // Only handle extra inputs once as these currently are the same across all tasks
+ if i == 0 {
+ for name, values := range task.extraInputs {
+ extraInputs = append(extraInputs, addLabelsForInputs(name, values, []string{})...)
+ }
+ }
+
// Pick a unique path outside the task.genDir for the sbox manifest textproto,
// a unique rule name, and the user-visible description.
manifestName := "genrule.sbox.textproto"
@@ -551,6 +565,8 @@
g.rawCommands = append(g.rawCommands, rawCommand)
cmd.Text(rawCommand)
+ cmd.Implicits(srcFiles) // need to be able to reference other srcs
+ cmd.Implicits(extraInputs)
cmd.ImplicitOutputs(task.out)
cmd.Implicits(task.in)
cmd.ImplicitTools(tools)
@@ -820,6 +836,9 @@
shard: i,
shards: len(shards),
extraTools: extraTools,
+ extraInputs: map[string][]string{
+ "data": properties.Data,
+ },
})
}
@@ -844,6 +863,9 @@
// maximum number of files that will be passed on a single command line.
Shard_size *int64
+
+ // Additional files needed for build that are not tooling related.
+ Data []string `android:"path"`
}
type bazelGensrcsAttributes struct {
@@ -851,6 +873,7 @@
Output_extension *string
Tools bazel.LabelListAttribute
Cmd string
+ Data bazel.LabelListAttribute
}
const defaultShardSize = 50
@@ -930,6 +953,23 @@
allReplacements.Append(tools.Value)
allReplacements.Append(bazel.FirstUniqueBazelLabelList(srcs_labels))
+ // The Output_extension prop is not in an immediately accessible field
+ // in the Module struct, so use GetProperties and cast it
+ // to the known struct prop.
+ var outputExtension *string
+ var data bazel.LabelListAttribute
+ if ctx.ModuleType() == "gensrcs" {
+ for _, propIntf := range m.GetProperties() {
+ if props, ok := propIntf.(*genSrcsProperties); ok {
+ outputExtension = props.Output_extension
+ dataFiles := android.BazelLabelForModuleSrc(ctx, props.Data)
+ allReplacements.Append(bazel.FirstUniqueBazelLabelList(dataFiles))
+ data = bazel.MakeLabelListAttribute(dataFiles)
+ break
+ }
+ }
+ }
+
// Replace in and out variables with $< and $@
var cmd string
if m.properties.Cmd != nil {
@@ -958,16 +998,6 @@
tags := android.ApexAvailableTagsWithoutTestApexes(ctx, m)
if ctx.ModuleType() == "gensrcs" {
- // The Output_extension prop is not in an immediately accessible field
- // in the Module struct, so use GetProperties and cast it
- // to the known struct prop.
- var outputExtension *string
- for _, propIntf := range m.GetProperties() {
- if props, ok := propIntf.(*genSrcsProperties); ok {
- outputExtension = props.Output_extension
- break
- }
- }
props := bazel.BazelTargetModuleProperties{
Rule_class: "gensrcs",
Bzl_load_location: "//build/bazel/rules:gensrcs.bzl",
@@ -977,6 +1007,7 @@
Output_extension: outputExtension,
Cmd: cmd,
Tools: tools,
+ Data: data,
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{
Name: m.Name(),
diff --git a/genrule/genrule_test.go b/genrule/genrule_test.go
index 370fe3d..7c17db1 100644
--- a/genrule/genrule_test.go
+++ b/genrule/genrule_test.go
@@ -604,6 +604,30 @@
"out/soong/.intermediates/gen/gen/gensrcs/in3.h",
},
},
+ {
+ name: "data",
+ prop: `
+ tools: ["tool"],
+ srcs: ["in1.txt", "in2.txt", "in3.txt"],
+ cmd: "$(location) $(in) --extra_input=$(location baz.txt) > $(out)",
+ data: ["baz.txt"],
+ shard_size: 2,
+ `,
+ cmds: []string{
+ "bash -c '__SBOX_SANDBOX_DIR__/tools/out/bin/tool in1.txt --extra_input=baz.txt > __SBOX_SANDBOX_DIR__/out/in1.h' && bash -c '__SBOX_SANDBOX_DIR__/tools/out/bin/tool in2.txt --extra_input=baz.txt > __SBOX_SANDBOX_DIR__/out/in2.h'",
+ "bash -c '__SBOX_SANDBOX_DIR__/tools/out/bin/tool in3.txt --extra_input=baz.txt > __SBOX_SANDBOX_DIR__/out/in3.h'",
+ },
+ deps: []string{
+ "out/soong/.intermediates/gen/gen/gensrcs/in1.h",
+ "out/soong/.intermediates/gen/gen/gensrcs/in2.h",
+ "out/soong/.intermediates/gen/gen/gensrcs/in3.h",
+ },
+ files: []string{
+ "out/soong/.intermediates/gen/gen/gensrcs/in1.h",
+ "out/soong/.intermediates/gen/gen/gensrcs/in2.h",
+ "out/soong/.intermediates/gen/gen/gensrcs/in3.h",
+ },
+ },
}
for _, test := range testcases {
diff --git a/java/Android.bp b/java/Android.bp
index 4af2a14..e079869 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -48,6 +48,7 @@
"droidstubs.go",
"fuzz.go",
"gen.go",
+ "generated_java_library.go",
"genrule.go",
"hiddenapi.go",
"hiddenapi_modular.go",
@@ -92,6 +93,7 @@
"droidstubs_test.go",
"fuzz_test.go",
"genrule_test.go",
+ "generated_java_library_test.go",
"hiddenapi_singleton_test.go",
"jacoco_test.go",
"java_test.go",
diff --git a/java/app.go b/java/app.go
index 561ce1d..d9272e4 100755
--- a/java/app.go
+++ b/java/app.go
@@ -18,6 +18,7 @@
// related module types, including their override variants.
import (
+ "fmt"
"path/filepath"
"strings"
@@ -288,7 +289,13 @@
}
if a.appProperties.Privapp_allowlist != nil && !Bool(a.appProperties.Privileged) {
- ctx.PropertyErrorf("privapp_allowlist", "privileged must be set in order to use privapp_allowlist")
+ // There are a few uids that are explicitly considered privileged regardless of their
+ // app's location. Bluetooth is one such app. It should arguably be moved to priv-app,
+ // but for now, allow it not to be in priv-app.
+ privilegedBecauseOfUid := ctx.ModuleName() == "Bluetooth"
+ if !privilegedBecauseOfUid {
+ ctx.PropertyErrorf("privapp_allowlist", "privileged must be set in order to use privapp_allowlist (with a few exceptions)")
+ }
}
for _, cert := range a.appProperties.Additional_certificates {
@@ -795,8 +802,9 @@
shouldInstallAppPackage := (Bool(a.Module.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() && !a.appProperties.PreventInstall
if shouldInstallAppPackage {
if a.privAppAllowlist.Valid() {
- installPath := android.PathForModuleInstall(ctx, "etc", "permissions")
- ctx.InstallFile(installPath, a.privAppAllowlist.Path().Base(), a.privAppAllowlist.Path())
+ allowlistInstallPath := android.PathForModuleInstall(ctx, "etc", "permissions")
+ allowlistInstallFilename := a.installApkName + ".xml"
+ ctx.InstallFile(allowlistInstallPath, allowlistInstallFilename, a.privAppAllowlist.Path())
}
var extraInstalledPaths android.Paths
@@ -1390,10 +1398,15 @@
}
}
-// presentOptionalUsesLibs returns optional_uses_libs after filtering out MissingUsesLibraries, which don't exist in the
-// build.
+// presentOptionalUsesLibs returns optional_uses_libs after filtering out libraries that don't exist in the source tree.
func (u *usesLibrary) presentOptionalUsesLibs(ctx android.BaseModuleContext) []string {
- optionalUsesLibs, _ := android.FilterList(u.usesLibraryProperties.Optional_uses_libs, ctx.Config().MissingUsesLibraries())
+ optionalUsesLibs := android.FilterListPred(u.usesLibraryProperties.Optional_uses_libs, func(s string) bool {
+ exists := ctx.OtherModuleExists(s)
+ if !exists && !android.InList(ctx.ModuleName(), ctx.Config().BuildWarningBadOptionalUsesLibsAllowlist()) {
+ fmt.Printf("Warning: Module '%s' depends on non-existing optional_uses_libs '%s'\n", ctx.ModuleName(), s)
+ }
+ return exists
+ })
return optionalUsesLibs
}
diff --git a/java/app_test.go b/java/app_test.go
index 7f9f0ed..cf7d174 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -2645,7 +2645,7 @@
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("runtime-library", "foo", "quuz", "qux", "bar", "fred"),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
- variables.MissingUsesLibraries = []string{"baz"}
+ variables.BuildWarningBadOptionalUsesLibsAllowlist = []string{"app", "prebuilt"}
}),
).RunTestWithBp(t, bp)
@@ -3545,8 +3545,8 @@
}
// verify that permissions are copied to device
- app.Output("out/soong/target/product/test_device/system/etc/permissions/privapp_allowlist_com.android.foo.xml")
- overrideApp.Output("out/soong/target/product/test_device/system/etc/permissions/privapp_allowlist_com.google.android.foo.xml")
+ app.Output("out/soong/target/product/test_device/system/etc/permissions/foo.xml")
+ overrideApp.Output("out/soong/target/product/test_device/system/etc/permissions/bar.xml")
}
func TestPrivappAllowlistAndroidMk(t *testing.T) {
@@ -3597,7 +3597,7 @@
t,
"androidmk has incorrect LOCAL_SOONG_INSTALL_PAIRS; expected to it to include privapp_allowlist",
baseEntries.EntryMap["LOCAL_SOONG_INSTALL_PAIRS"][0],
- "privapp_allowlist_com.android.foo.xml:\\S+/target/product/test_device/system/etc/permissions/privapp_allowlist_com.android.foo.xml",
+ "privapp_allowlist_com.android.foo.xml:\\S+/target/product/test_device/system/etc/permissions/foo.xml",
)
overrideAndroidApp := overrideApp.Module().(*AndroidApp)
@@ -3624,6 +3624,6 @@
t,
"androidmk has incorrect LOCAL_SOONG_INSTALL_PAIRS; expected to it to include privapp_allowlist",
overrideEntries.EntryMap["LOCAL_SOONG_INSTALL_PAIRS"][0],
- "\\S+soong/.intermediates/foo/android_common_bar/privapp_allowlist_com.google.android.foo.xml:\\S+/target/product/test_device/system/etc/permissions/privapp_allowlist_com.google.android.foo.xml",
+ "\\S+soong/.intermediates/foo/android_common_bar/privapp_allowlist_com.google.android.foo.xml:\\S+/target/product/test_device/system/etc/permissions/bar.xml",
)
}
diff --git a/java/base.go b/java/base.go
index 374138c..afb626a 100644
--- a/java/base.go
+++ b/java/base.go
@@ -79,6 +79,9 @@
// list of java libraries that will be compiled into the resulting jar
Static_libs []string `android:"arch_variant"`
+ // list of java libraries that should not be used to build this module
+ Exclude_static_libs []string `android:"arch_variant"`
+
// manifest file to be included in resulting jar
Manifest *string `android:"path"`
@@ -184,6 +187,9 @@
// A list of java_library instances that provide additional hiddenapi annotations for the library.
Hiddenapi_additional_annotations []string
+
+ // Additional srcJars tacked in by GeneratedJavaLibraryModule
+ Generated_srcjars []android.Path `android:"mutated"`
}
// Properties that are specific to device modules. Host module factories should not add these when
@@ -724,6 +730,8 @@
}
libDeps := ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
+
+ j.properties.Static_libs = android.RemoveListFromList(j.properties.Static_libs, j.properties.Exclude_static_libs)
ctx.AddVariationDependencies(nil, staticLibTag, j.properties.Static_libs...)
// Add dependency on libraries that provide additional hidden api annotations.
@@ -1036,6 +1044,10 @@
}
+func (module *Module) addGeneratedSrcJars(path android.Path) {
+ module.properties.Generated_srcjars = append(module.properties.Generated_srcjars, path)
+}
+
func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl.Export_include_dirs)
@@ -1077,6 +1089,10 @@
if aaptSrcJar != nil {
srcJars = append(srcJars, aaptSrcJar)
}
+ srcJars = append(srcJars, j.properties.Generated_srcjars...)
+ if len(j.properties.Generated_srcjars) > 0 {
+ fmt.Printf("Java module %s Generated_srcjars: %v\n", ctx.ModuleName(), j.properties.Generated_srcjars)
+ }
srcFiles = srcFiles.FilterOutByExt(".srcjar")
if j.properties.Jarjar_rules != nil {
@@ -1923,22 +1939,22 @@
func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool) {
switch name {
- case android.SdkCore.JavaLibraryName(ctx.Config()),
- android.JavaApiLibraryName(ctx.Config(), "legacy.core.platform.api.stubs"),
- android.JavaApiLibraryName(ctx.Config(), "stable.core.platform.api.stubs"),
+ case android.SdkCore.DefaultJavaLibraryName(),
+ "legacy.core.platform.api.stubs",
+ "stable.core.platform.api.stubs",
"stub-annotations", "private-stub-annotations-jar",
- android.JavaApiLibraryName(ctx.Config(), "core-lambda-stubs"),
+ "core-lambda-stubs",
"core-generated-annotation-stubs":
return javaCore, true
- case android.SdkPublic.JavaLibraryName(ctx.Config()):
+ case android.SdkPublic.DefaultJavaLibraryName():
return javaSdk, true
- case android.SdkSystem.JavaLibraryName(ctx.Config()):
+ case android.SdkSystem.DefaultJavaLibraryName():
return javaSystem, true
- case android.SdkModule.JavaLibraryName(ctx.Config()):
+ case android.SdkModule.DefaultJavaLibraryName():
return javaModule, true
- case android.SdkSystemServer.JavaLibraryName(ctx.Config()):
+ case android.SdkSystemServer.DefaultJavaLibraryName():
return javaSystemServer, true
- case android.SdkTest.JavaLibraryName(ctx.Config()):
+ case android.SdkTest.DefaultJavaLibraryName():
return javaSystem, true
}
@@ -2188,5 +2204,9 @@
if binary, ok := ctx.Module().(*Binary); ok {
javaBinaryHostBp2Build(ctx, binary)
}
+ case "java_test_host":
+ if testHost, ok := ctx.Module().(*TestHost); ok {
+ javaTestHostBp2Build(ctx, testHost)
+ }
}
}
diff --git a/java/builder.go b/java/builder.go
index 0c57738..c4395e9 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -305,6 +305,12 @@
proto android.ProtoFlags
}
+func DefaultJavaBuilderFlags() javaBuilderFlags {
+ return javaBuilderFlags{
+ javaVersion: JAVA_VERSION_8,
+ }
+}
+
func TransformJavaToClasses(ctx android.ModuleContext, outputFile android.WritablePath, shardIdx int,
srcFiles, srcJars android.Paths, flags javaBuilderFlags, deps android.Paths) {
diff --git a/java/core-libraries/Android.bp b/java/core-libraries/Android.bp
index 958f4ce..eadd9c6 100644
--- a/java/core-libraries/Android.bp
+++ b/java/core-libraries/Android.bp
@@ -33,19 +33,45 @@
"win_sdk",
]
-java_library {
- name: "core.current.stubs",
+java_defaults {
+ name: "core.current.stubs.defaults",
visibility: ["//visibility:public"],
+ sdk_version: "none",
+ system_modules: "none",
+ dist: {
+ targets: dist_targets,
+ },
+}
+
+java_library {
+ name: "core.current.stubs.from-source",
+ defaults: [
+ "core.current.stubs.defaults",
+ ],
static_libs: [
"art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"i18n.module.public.api.stubs",
],
- sdk_version: "none",
- system_modules: "none",
+}
- dist: {
- targets: dist_targets,
+java_library {
+ name: "core.current.stubs",
+ defaults: [
+ "core.current.stubs.defaults",
+ ],
+ static_libs: [
+ "core.current.stubs.from-source",
+ ],
+ product_variables: {
+ build_from_text_stub: {
+ static_libs: [
+ "core.current.stubs.from-text",
+ ],
+ exclude_static_libs: [
+ "core.current.stubs.from-source",
+ ],
+ },
},
}
@@ -199,18 +225,46 @@
// API annotations are available to the dex tools that enable enforcement of runtime
// accessibility. b/119068555
java_library {
- name: "legacy.core.platform.api.stubs",
+ name: "legacy.core.platform.api.stubs.from-source",
visibility: core_platform_visibility,
- hostdex: true,
- compile_dex: true,
-
- sdk_version: "none",
- system_modules: "none",
+ defaults: [
+ "core.platform.api.stubs.defaults",
+ ],
static_libs: [
"art.module.public.api.stubs.module_lib",
"conscrypt.module.platform.api.stubs",
"legacy.i18n.module.platform.api.stubs",
],
+}
+
+java_library {
+ name: "legacy.core.platform.api.stubs",
+ visibility: core_platform_visibility,
+ defaults: [
+ "core.platform.api.stubs.defaults",
+ ],
+ static_libs: [
+ "legacy.core.platform.api.stubs.from-source",
+ ],
+ product_variables: {
+ build_from_text_stub: {
+ static_libs: [
+ "stable.core.platform.api.stubs.from-text",
+ ],
+ exclude_static_libs: [
+ "stable.core.platform.api.stubs.from-source",
+ ],
+ },
+ },
+}
+
+java_defaults {
+ name: "core.platform.api.stubs.defaults",
+ hostdex: true,
+ compile_dex: true,
+
+ sdk_version: "none",
+ system_modules: "none",
patch_module: "java.base",
}
@@ -233,20 +287,38 @@
}
java_library {
- name: "stable.core.platform.api.stubs",
+ name: "stable.core.platform.api.stubs.from-source",
visibility: core_platform_visibility,
- hostdex: true,
- compile_dex: true,
-
- sdk_version: "none",
- system_modules: "none",
+ defaults: [
+ "core.platform.api.stubs.defaults",
+ ],
static_libs: [
"art.module.public.api.stubs.module_lib",
// conscrypt only has a stable version, so it is okay to depend on it here:
"conscrypt.module.platform.api.stubs",
"stable.i18n.module.platform.api.stubs",
],
- patch_module: "java.base",
+}
+
+java_library {
+ name: "stable.core.platform.api.stubs",
+ visibility: core_platform_visibility,
+ defaults: [
+ "core.platform.api.stubs.defaults",
+ ],
+ static_libs: [
+ "stable.core.platform.api.stubs.from-source",
+ ],
+ product_variables: {
+ build_from_text_stub: {
+ static_libs: [
+ "stable.core.platform.api.stubs.from-text",
+ ],
+ exclude_static_libs: [
+ "stable.core.platform.api.stubs.from-source",
+ ],
+ },
+ },
}
// Same as stable.core.platform.api.stubs, but android annotations are
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 116c833..35f6097 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -816,7 +816,7 @@
cmd.FlagWithArg("--instruction-set-features=", global.InstructionSetFeatures[arch])
}
- if global.EnableUffdGc {
+ if global.EnableUffdGc && image.target.Os == android.Android {
cmd.Flag("--runtime-arg").Flag("-Xgc:CMC")
}
diff --git a/java/droiddoc.go b/java/droiddoc.go
index dbe021d..d4ead12 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -608,6 +608,11 @@
FlagWithArg("-Xmaxerrs ", "10").
FlagWithArg("-Xmaxwarns ", "10").
Flag("-J--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.formats.html=ALL-UNNAMED").
+ Flag("-J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED").
+ Flag("-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED").
+ Flag("-J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED").
+ Flag("-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED").
+ Flag("-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED").
Flag("-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED").
FlagWithArg("-hdf page.build ", ctx.Config().BuildId()+"-$(cat "+buildNumberFile.String()+")").OrderOnly(buildNumberFile).
FlagWithArg("-hdf page.now ", `"$(date -d @$(cat `+ctx.Config().Getenv("BUILD_DATETIME_FILE")+`) "+%d %b %Y %k:%M")" `)
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 8a521aa..151c94a 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -535,6 +535,14 @@
// b/223382732
FlagWithArg("--hide ", "ChangedDefault")
+ // Force metalava to ignore classes on the classpath when an API file contains missing classes.
+ // See b/285140653 for more information.
+ cmd.FlagWithArg("--api-class-resolution ", "api")
+
+ // Force metalava to sort overloaded methods by their order in the source code.
+ // See b/285312164 for more information.
+ cmd.FlagWithArg("--api-overloaded-method-order ", "source")
+
return cmd
}
diff --git a/java/fuzz.go b/java/fuzz.go
index 5dfaacf..b3c2fd4 100644
--- a/java/fuzz.go
+++ b/java/fuzz.go
@@ -30,8 +30,12 @@
const (
hostString = "host"
targetString = "target"
+ deviceString = "device"
)
+// Any shared libs for these deps will also be packaged
+var artDeps = []string{"libdl_android"}
+
func init() {
RegisterJavaFuzzBuildComponents(android.InitRegistrationContext)
}
@@ -78,7 +82,18 @@
}
func (j *JavaFuzzTest) DepsMutator(ctx android.BottomUpMutatorContext) {
+ if j.Os().Class.String() == deviceString {
+ j.testProperties.Jni_libs = append(j.testProperties.Jni_libs, artDeps...)
+ }
+
if len(j.testProperties.Jni_libs) > 0 {
+ if j.fuzzPackagedModule.FuzzProperties.Fuzz_config == nil {
+ config := &fuzz.FuzzConfig{}
+ j.fuzzPackagedModule.FuzzProperties.Fuzz_config = config
+ }
+ // this will be used by the ingestion pipeline to determine the version
+ // of jazzer to add to the fuzzer package
+ j.fuzzPackagedModule.FuzzProperties.Fuzz_config.IsJni = proptools.BoolPtr(true)
for _, target := range ctx.MultiTargets() {
sharedLibVariations := append(target.Variations(), blueprint.Variation{Mutator: "link", Variation: "shared"})
ctx.AddFarVariationDependencies(sharedLibVariations, jniLibTag, j.testProperties.Jni_libs...)
diff --git a/java/generated_java_library.go b/java/generated_java_library.go
new file mode 100644
index 0000000..1b3de9f
--- /dev/null
+++ b/java/generated_java_library.go
@@ -0,0 +1,94 @@
+// Copyright 2023 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package java
+
+import (
+ "android/soong/android"
+)
+
+type GeneratedJavaLibraryModule struct {
+ Library
+ callbacks GeneratedJavaLibraryCallbacks
+ moduleName string
+}
+
+type GeneratedJavaLibraryCallbacks interface {
+ // Called from inside DepsMutator, gives a chance to AddDependencies
+ DepsMutator(module *GeneratedJavaLibraryModule, ctx android.BottomUpMutatorContext)
+
+ // Called from inside GenerateAndroidBuildActions. Add the build rules to
+ // make the srcjar, and return the path to it.
+ GenerateSourceJarBuildActions(ctx android.ModuleContext) android.Path
+}
+
+// GeneratedJavaLibraryModuleFactory provides a utility for modules that are generated
+// source code, including ones outside the java package to build jar files
+// from that generated source.
+//
+// To use GeneratedJavaLibraryModule, call GeneratedJavaLibraryModuleFactory with
+// a callback interface and a properties object to add to the module.
+//
+// These modules will have some properties blocked, and it will be an error if
+// modules attempt to set them. See the list of property names in GeneratedAndroidBuildActions
+// for the list of those properties.
+func GeneratedJavaLibraryModuleFactory(moduleName string, callbacks GeneratedJavaLibraryCallbacks, properties interface{}) android.Module {
+ module := &GeneratedJavaLibraryModule{
+ callbacks: callbacks,
+ moduleName: moduleName,
+ }
+ module.addHostAndDeviceProperties()
+ module.initModuleAndImport(module)
+ android.InitApexModule(module)
+ android.InitBazelModule(module)
+ InitJavaModule(module, android.HostAndDeviceSupported)
+ if properties != nil {
+ module.AddProperties(properties)
+ }
+ return module
+}
+
+func (module *GeneratedJavaLibraryModule) DepsMutator(ctx android.BottomUpMutatorContext) {
+ module.callbacks.DepsMutator(module, ctx)
+ module.Library.DepsMutator(ctx)
+}
+
+func checkPropertyEmpty(ctx android.ModuleContext, module *GeneratedJavaLibraryModule, name string, value []string) {
+ if len(value) != 0 {
+ ctx.PropertyErrorf(name, "%s not allowed on %s", name, module.moduleName)
+ }
+}
+
+func (module *GeneratedJavaLibraryModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ // These modules are all-generated, so disallow these properties to keep it simple.
+ // No additional sources
+ checkPropertyEmpty(ctx, module, "srcs", module.Library.properties.Srcs)
+ checkPropertyEmpty(ctx, module, "common_srcs", module.Library.properties.Common_srcs)
+ checkPropertyEmpty(ctx, module, "exclude_srcs", module.Library.properties.Exclude_srcs)
+ checkPropertyEmpty(ctx, module, "java_resource_dirs", module.Library.properties.Java_resource_dirs)
+ checkPropertyEmpty(ctx, module, "exclude_java_resource_dirs", module.Library.properties.Exclude_java_resource_dirs)
+ // No additional libraries. The generator should add anything necessary automatically
+ // by returning something from ____ (TODO: Additional libraries aren't needed now, so
+ // these are just blocked).
+ checkPropertyEmpty(ctx, module, "libs", module.Library.properties.Libs)
+ checkPropertyEmpty(ctx, module, "static_libs", module.Library.properties.Static_libs)
+ // Restrict these for no good reason other than to limit the surface area. If there's a
+ // good use case put them back.
+ checkPropertyEmpty(ctx, module, "plugins", module.Library.properties.Plugins)
+ checkPropertyEmpty(ctx, module, "exported_plugins", module.Library.properties.Exported_plugins)
+
+ srcJarPath := module.callbacks.GenerateSourceJarBuildActions(ctx)
+ module.Library.properties.Generated_srcjars = append(module.Library.properties.Generated_srcjars, srcJarPath)
+ module.Library.GenerateAndroidBuildActions(ctx)
+}
diff --git a/java/generated_java_library_test.go b/java/generated_java_library_test.go
new file mode 100644
index 0000000..68f1f7e
--- /dev/null
+++ b/java/generated_java_library_test.go
@@ -0,0 +1,65 @@
+// Copyright 2018 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package java
+
+import (
+ "testing"
+
+ "android/soong/android"
+)
+
+func JavaGenLibTestFactory() android.Module {
+ callbacks := &JavaGenLibTestCallbacks{}
+ return GeneratedJavaLibraryModuleFactory("test_java_gen_lib", callbacks, &callbacks.properties)
+}
+
+type JavaGenLibTestProperties struct {
+ Foo string
+}
+
+type JavaGenLibTestCallbacks struct {
+ properties JavaGenLibTestProperties
+}
+
+func (callbacks *JavaGenLibTestCallbacks) DepsMutator(module *GeneratedJavaLibraryModule, ctx android.BottomUpMutatorContext) {
+}
+
+func (callbacks *JavaGenLibTestCallbacks) GenerateSourceJarBuildActions(ctx android.ModuleContext) android.Path {
+ return android.PathForOutput(ctx, "blah.srcjar")
+}
+
+func testGenLib(t *testing.T, errorHandler android.FixtureErrorHandler, bp string) *android.TestResult {
+ return android.GroupFixturePreparers(
+ PrepareForIntegrationTestWithJava,
+ android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("test_java_gen_lib", JavaGenLibTestFactory)
+ }),
+ ).
+ ExtendWithErrorHandler(errorHandler).
+ RunTestWithBp(t, bp)
+}
+
+func TestGenLib(t *testing.T) {
+ bp := `
+ test_java_gen_lib {
+ name: "javagenlibtest",
+ foo: "bar", // Note: This won't parse if the property didn't get added
+ }
+ `
+ result := testGenLib(t, android.FixtureExpectsNoErrors, bp)
+
+ javagenlibtest := result.ModuleForTests("javagenlibtest", "android_common").Module().(*GeneratedJavaLibraryModule)
+ android.AssertPathsEndWith(t, "Generated_srcjars", []string{"/blah.srcjar"}, javagenlibtest.Library.properties.Generated_srcjars)
+}
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index e54275b..da9c997 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -236,12 +236,12 @@
testStubModules = append(testStubModules, "sdk_test_current_android")
} else {
// Use stub modules built from source
- publicStubModules = append(publicStubModules, android.SdkPublic.JavaLibraryName(config))
- systemStubModules = append(systemStubModules, android.SdkSystem.JavaLibraryName(config))
- testStubModules = append(testStubModules, android.SdkTest.JavaLibraryName(config))
+ publicStubModules = append(publicStubModules, android.SdkPublic.DefaultJavaLibraryName())
+ systemStubModules = append(systemStubModules, android.SdkSystem.DefaultJavaLibraryName())
+ testStubModules = append(testStubModules, android.SdkTest.DefaultJavaLibraryName())
}
// We do not have prebuilts of the core platform api yet
- corePlatformStubModules = append(corePlatformStubModules, android.JavaApiLibraryName(config, "legacy.core.platform.api.stubs"))
+ corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
// Allow products to define their own stubs for custom product jars that apps can use.
publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...)
diff --git a/java/java.go b/java/java.go
index aa9f936..a026610 100644
--- a/java/java.go
+++ b/java/java.go
@@ -273,6 +273,8 @@
// JacocoReportClassesFile is the path to a jar containing uninstrumented classes that will be
// instrumented by jacoco.
JacocoReportClassesFile android.Path
+
+ // TODO: Add device config declarations here?
}
var JavaInfoProvider = blueprint.NewProvider(JavaInfo{})
@@ -936,6 +938,10 @@
// Extra <option> tags to add to the auto generated test xml file. The "key"
// is optional in each of these.
Tradefed_options []tradefed.Option
+
+ // Extra <option> tags to add to the auto generated test xml file under the test runner, e.g., AndroidJunitTest.
+ // The "key" is optional in each of these.
+ Test_runner_options []tradefed.Option
}
type testProperties struct {
@@ -1218,6 +1224,7 @@
TestSuites: j.testProperties.Test_suites,
Config: configs,
OptionsForAutogenerated: j.testProperties.Test_options.Tradefed_options,
+ TestRunnerOptions: j.testProperties.Test_options.Test_runner_options,
AutoGenConfig: j.testProperties.Auto_gen_config,
UnitTest: j.testProperties.Test_options.Unit_test,
DeviceTemplate: "${JavaTestConfigTemplate}",
@@ -1416,6 +1423,8 @@
nil,
nil)
+ android.InitBazelModule(module)
+
InitJavaModuleMultiTargets(module, android.HostSupported)
return module
@@ -1728,6 +1737,14 @@
FlagWithArg("--hide ", "InvalidNullabilityOverride").
FlagWithArg("--hide ", "ChangedDefault")
+ // Force metalava to ignore classes on the classpath when an API file contains missing classes.
+ // See b/285140653 for more information.
+ cmd.FlagWithArg("--api-class-resolution ", "api")
+
+ // Force metalava to sort overloaded methods by their order in the source code.
+ // See b/285312164 for more information.
+ cmd.FlagWithArg("--api-overloaded-method-order ", "source")
+
return cmd
}
@@ -2798,6 +2815,14 @@
hasKotlin bool
}
+// Replaces //a/b/my_xsd_config with //a/b/my_xsd_config-java
+func xsdConfigJavaTarget(ctx android.BazelConversionPathContext, mod blueprint.Module) string {
+ callback := func(xsd android.XsdConfigBp2buildTargets) string {
+ return xsd.JavaBp2buildTargetName()
+ }
+ return android.XsdConfigBp2buildTarget(ctx, mod, callback)
+}
+
// convertLibraryAttrsBp2Build returns a javaCommonAttributes struct with
// converted attributes shared across java_* modules and a bp2BuildJavaInfo struct
// which has other non-attribute information needed for bp2build conversion
@@ -2812,8 +2837,15 @@
for axis, configToProps := range archVariantProps {
for config, _props := range configToProps {
if archProps, ok := _props.(*CommonProperties); ok {
- archSrcs := android.BazelLabelForModuleSrcExcludes(ctx, archProps.Srcs, archProps.Exclude_srcs)
+ srcsNonXsd, srcsXsd := android.PartitionXsdSrcs(ctx, archProps.Srcs)
+ excludeSrcsNonXsd, _ := android.PartitionXsdSrcs(ctx, archProps.Exclude_srcs)
+ archSrcs := android.BazelLabelForModuleSrcExcludes(ctx, srcsNonXsd, excludeSrcsNonXsd)
srcs.SetSelectValue(axis, config, archSrcs)
+
+ // Add to static deps
+ xsdJavaConfigLibraryLabels := android.BazelLabelForModuleDepsWithFn(ctx, srcsXsd, xsdConfigJavaTarget)
+ staticDeps.Append(xsdJavaConfigLibraryLabels)
+
}
}
}
@@ -3074,24 +3106,15 @@
// Attribute jvm_flags
var jvmFlags bazel.StringListAttribute
if m.binaryProperties.Jni_libs != nil {
- jniLibPackages := map[string]bool{}
- for _, jniLibLabel := range android.BazelLabelForModuleDeps(ctx, m.binaryProperties.Jni_libs).Includes {
- jniLibPackage := jniLibLabel.Label
- indexOfColon := strings.Index(jniLibLabel.Label, ":")
- if indexOfColon > 0 {
- // JNI lib from other package
- jniLibPackage = jniLibLabel.Label[2:indexOfColon]
- } else if indexOfColon == 0 {
- // JNI lib in the same package of java_binary
- packageOfCurrentModule := m.GetBazelLabel(ctx, m)
- jniLibPackage = packageOfCurrentModule[2:strings.Index(packageOfCurrentModule, ":")]
- }
- if _, inMap := jniLibPackages[jniLibPackage]; !inMap {
- jniLibPackages[jniLibPackage] = true
+ jniLibPackages := []string{}
+ for _, jniLib := range m.binaryProperties.Jni_libs {
+ if jniLibModule, exists := ctx.ModuleFromName(jniLib); exists {
+ otherDir := ctx.OtherModuleDir(jniLibModule)
+ jniLibPackages = append(jniLibPackages, filepath.Join(otherDir, jniLib))
}
}
jniLibPaths := []string{}
- for jniLibPackage, _ := range jniLibPackages {
+ for _, jniLibPackage := range jniLibPackages {
// See cs/f:.*/third_party/bazel/.*java_stub_template.txt for the use of RUNPATH
jniLibPaths = append(jniLibPaths, "$${RUNPATH}"+jniLibPackage)
}
@@ -3114,23 +3137,89 @@
return
}
- libName := m.Name() + "_lib"
+ libInfo := libraryCreationInfo{
+ deps: deps,
+ attrs: commonAttrs,
+ baseName: m.Name(),
+ hasKotlin: bp2BuildInfo.hasKotlin,
+ }
+ libName := createLibraryTarget(ctx, libInfo)
+ binAttrs.Runtime_deps.Add(&bazel.LabelAttribute{Value: &bazel.Label{Label: ":" + libName}})
+
+ // Create the BazelTargetModule.
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, binAttrs)
+}
+
+type javaTestHostAttributes struct {
+ *javaCommonAttributes
+ Deps bazel.LabelListAttribute
+ Runtime_deps bazel.LabelListAttribute
+}
+
+// javaTestHostBp2Build is for java_test_host bp2build.
+func javaTestHostBp2Build(ctx android.TopDownMutatorContext, m *TestHost) {
+ commonAttrs, bp2BuildInfo := m.convertLibraryAttrsBp2Build(ctx)
+ depLabels := bp2BuildInfo.DepLabels
+
+ deps := depLabels.Deps
+ deps.Append(depLabels.StaticDeps)
+
+ var runtimeDeps bazel.LabelListAttribute
+ attrs := &javaTestHostAttributes{
+ Runtime_deps: runtimeDeps,
+ }
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "java_test",
+ Bzl_load_location: "//build/bazel/rules/java:test.bzl",
+ }
+
+ if commonAttrs.Srcs.IsEmpty() {
+ // if there are no sources, then the dependencies can only be used at runtime
+ attrs.Runtime_deps = deps
+ attrs.javaCommonAttributes = commonAttrs
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
+ return
+ }
+
+ libInfo := libraryCreationInfo{
+ deps: deps,
+ attrs: commonAttrs,
+ baseName: m.Name(),
+ hasKotlin: bp2BuildInfo.hasKotlin,
+ }
+ libName := createLibraryTarget(ctx, libInfo)
+ attrs.Runtime_deps.Add(&bazel.LabelAttribute{Value: &bazel.Label{Label: ":" + libName}})
+
+ // Create the BazelTargetModule.
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
+}
+
+// libraryCreationInfo encapsulates the info needed to create java_library target from
+// java_binary_host or java_test_host.
+type libraryCreationInfo struct {
+ deps bazel.LabelListAttribute
+ attrs *javaCommonAttributes
+ baseName string
+ hasKotlin bool
+}
+
+// helper function that creates java_library target from java_binary_host or java_test_host,
+// and returns the library target name,
+func createLibraryTarget(ctx android.TopDownMutatorContext, libInfo libraryCreationInfo) string {
+ libName := libInfo.baseName + "_lib"
var libProps bazel.BazelTargetModuleProperties
- if bp2BuildInfo.hasKotlin {
+ if libInfo.hasKotlin {
libProps = ktJvmLibraryBazelTargetModuleProperties()
} else {
libProps = javaLibraryBazelTargetModuleProperties()
}
libAttrs := &javaLibraryAttributes{
- Deps: deps,
- javaCommonAttributes: commonAttrs,
+ Deps: libInfo.deps,
+ javaCommonAttributes: libInfo.attrs,
}
ctx.CreateBazelTargetModule(libProps, android.CommonAttributes{Name: libName}, libAttrs)
- binAttrs.Runtime_deps.Add(&bazel.LabelAttribute{Value: &bazel.Label{Label: ":" + libName}})
-
- // Create the BazelTargetModule.
- ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, binAttrs)
+ return libName
}
type bazelJavaImportAttributes struct {
diff --git a/java/java_test.go b/java/java_test.go
index ea89e6e..561b187 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2298,3 +2298,58 @@
t.Errorf("Expected args[\"extraConfigs\"] to equal %q, was %q", expected, args["extraConfigs"])
}
}
+
+func TestTestRunnerOptions(t *testing.T) {
+ result := PrepareForTestWithJavaBuildComponents.RunTestWithBp(t, `
+java_test_host {
+ name: "foo",
+ test_options: {
+ test_runner_options: [
+ {
+ name: "test-timeout",
+ value: "10m"
+ }
+ ]
+ }
+}
+`)
+
+ buildOS := result.Config.BuildOS.String()
+ args := result.ModuleForTests("foo", buildOS+"_common").
+ Output("out/soong/.intermediates/foo/" + buildOS + "_common/foo.config").Args
+ expected := proptools.NinjaAndShellEscape("<option name=\"test-timeout\" value=\"10m\" />\\n ")
+ if args["extraTestRunnerConfigs"] != expected {
+ t.Errorf("Expected args[\"extraTestRunnerConfigs\"] to equal %q, was %q", expected, args["extraTestRunnerConfigs"])
+ }
+}
+
+func TestJavaExcludeStaticLib(t *testing.T) {
+ ctx, _ := testJava(t, `
+ java_library {
+ name: "bar",
+ }
+ java_library {
+ name: "foo",
+ }
+ java_library {
+ name: "baz",
+ static_libs: [
+ "foo",
+ "bar",
+ ],
+ exclude_static_libs: [
+ "bar",
+ ],
+ }
+ `)
+
+ // "bar" not included as dependency of "baz"
+ CheckModuleDependencies(t, ctx, "baz", "android_common", []string{
+ `core-lambda-stubs`,
+ `ext`,
+ `foo`,
+ `framework`,
+ `stable-core-platform-api-stubs-system-modules`,
+ `stable.core.platform.api.stubs`,
+ })
+}
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index 2197304..1248275 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -19,7 +19,10 @@
"path/filepath"
"android/soong/android"
+ "android/soong/bazel"
+
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
)
func init() {
@@ -54,6 +57,7 @@
type platformCompatConfig struct {
android.ModuleBase
+ android.BazelModuleBase
properties platformCompatConfigProperties
installDirPath android.InstallPath
@@ -122,10 +126,29 @@
}}
}
+type bazelPlatformCompatConfigAttributes struct {
+ Src bazel.LabelAttribute
+}
+
+func (p *platformCompatConfig) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "platform_compat_config",
+ Bzl_load_location: "//build/bazel/rules/java:platform_compat_config.bzl",
+ }
+ attr := &bazelPlatformCompatConfigAttributes{
+ Src: *bazel.MakeLabelAttribute(
+ android.BazelLabelForModuleSrcSingle(ctx, proptools.String(p.properties.Src)).Label),
+ }
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{
+ Name: p.Name(),
+ }, attr)
+}
+
func PlatformCompatConfigFactory() android.Module {
module := &platformCompatConfig{}
module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ android.InitBazelModule(module)
return module
}
diff --git a/java/sdk.go b/java/sdk.go
index 7fa604f..7699aab 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -151,7 +151,7 @@
systemModules := android.JavaApiLibraryName(ctx.Config(), fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind))
return sdkDep{
useModule: true,
- bootclasspath: []string{module, android.JavaApiLibraryName(ctx.Config(), config.DefaultLambdaStubsLibrary)},
+ bootclasspath: []string{module, config.DefaultLambdaStubsLibrary},
systemModules: systemModules,
java9Classpath: []string{module},
frameworkResModule: "framework-res",
@@ -193,20 +193,20 @@
noFrameworksLibs: true,
}
case android.SdkPublic, android.SdkSystem, android.SdkTest:
- return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), sdkFrameworkAidlPath(ctx))
+ return toModule(sdkVersion.Kind.DefaultJavaLibraryName(), sdkFrameworkAidlPath(ctx))
case android.SdkCore:
return sdkDep{
useModule: true,
- bootclasspath: []string{android.SdkCore.JavaLibraryName(ctx.Config()), android.JavaApiLibraryName(ctx.Config(), config.DefaultLambdaStubsLibrary)},
+ bootclasspath: []string{android.SdkCore.DefaultJavaLibraryName(), config.DefaultLambdaStubsLibrary},
systemModules: android.JavaApiLibraryName(ctx.Config(), "core-public-stubs-system-modules"),
noFrameworksLibs: true,
}
case android.SdkModule:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules
- return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), nonUpdatableFrameworkAidlPath(ctx))
+ return toModule(sdkVersion.Kind.DefaultJavaLibraryName(), nonUpdatableFrameworkAidlPath(ctx))
case android.SdkSystemServer:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules
- return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), sdkFrameworkAidlPath(ctx))
+ return toModule(sdkVersion.Kind.DefaultJavaLibraryName(), sdkFrameworkAidlPath(ctx))
default:
panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw))
}
@@ -269,9 +269,9 @@
// Create framework.aidl by extracting anything that implements android.os.Parcelable from the SDK stubs modules.
func createSdkFrameworkAidl(ctx android.SingletonContext) {
stubsModules := []string{
- android.SdkPublic.JavaLibraryName(ctx.Config()),
- android.SdkTest.JavaLibraryName(ctx.Config()),
- android.SdkSystem.JavaLibraryName(ctx.Config()),
+ android.SdkPublic.DefaultJavaLibraryName(),
+ android.SdkTest.DefaultJavaLibraryName(),
+ android.SdkSystem.DefaultJavaLibraryName(),
}
combinedAidl := sdkFrameworkAidlPath(ctx)
@@ -286,7 +286,7 @@
// Creates a version of framework.aidl for the non-updatable part of the platform.
func createNonUpdatableFrameworkAidl(ctx android.SingletonContext) {
- stubsModules := []string{android.SdkModule.JavaLibraryName(ctx.Config())}
+ stubsModules := []string{android.SdkModule.DefaultJavaLibraryName()}
combinedAidl := nonUpdatableFrameworkAidlPath(ctx)
tempPath := tempPathForRestat(ctx, combinedAidl)
diff --git a/licenses/Android.bp b/licenses/Android.bp
index dee72ed..d045725 100644
--- a/licenses/Android.bp
+++ b/licenses/Android.bp
@@ -1027,42 +1027,42 @@
license_kind {
name: "SPDX-license-identifier-OFL",
- conditions: ["by_exception_only"],
+ conditions: ["notice"],
}
license_kind {
name: "SPDX-license-identifier-OFL-1.0",
- conditions: ["by_exception_only"],
+ conditions: ["notice"],
url: "https://spdx.org/licenses/OFL-1.0.html",
}
license_kind {
name: "SPDX-license-identifier-OFL-1.0-RFN",
- conditions: ["by_exception_only"],
+ conditions: ["notice"],
url: "https://spdx.org/licenses/OFL-1.0-RFN.html",
}
license_kind {
name: "SPDX-license-identifier-OFL-1.0-no-RFN",
- conditions: ["by_exception_only"],
+ conditions: ["notice"],
url: "https://spdx.org/licenses/OFL-1.0-no-RFN.html",
}
license_kind {
name: "SPDX-license-identifier-OFL-1.1",
- conditions: ["by_exception_only"],
+ conditions: ["notice"],
url: "https://spdx.org/licenses/OFL-1.1.html",
}
license_kind {
name: "SPDX-license-identifier-OFL-1.1-RFN",
- conditions: ["by_exception_only"],
+ conditions: ["notice"],
url: "https://spdx.org/licenses/OFL-1.1-RFN.html",
}
license_kind {
name: "SPDX-license-identifier-OFL-1.1-no-RFN",
- conditions: ["by_exception_only"],
+ conditions: ["notice"],
url: "https://spdx.org/licenses/OFL-1.1-no-RFN.html",
}
diff --git a/mk2rbc/mk2rbc.go b/mk2rbc/mk2rbc.go
index c0ae0c0..8225df6 100644
--- a/mk2rbc/mk2rbc.go
+++ b/mk2rbc/mk2rbc.go
@@ -870,7 +870,7 @@
}
// Safeguard against $(call inherit-product,$(PRODUCT_PATH))
- const maxMatchingFiles = 155 // temporarily increased to 155 for b/284854738
+ const maxMatchingFiles = 150
if len(matchingPaths) > maxMatchingFiles {
return []starlarkNode{ctx.newBadNode(v, "there are >%d files matching the pattern, please rewrite it", maxMatchingFiles)}
}
diff --git a/shared/env.go b/shared/env.go
index b7d3baf..75190cc 100644
--- a/shared/env.go
+++ b/shared/env.go
@@ -55,20 +55,23 @@
return data, nil
}
-// Reads and deserializes a Soong environment file located at the given file path to determine its
-// staleness. If any environment variable values have changed, it prints them out and returns true.
+// Reads and deserializes a Soong environment file located at the given file
+// path to determine its staleness. If any environment variable values have
+// changed, it prints and returns changed environment variable values and
+// returns true.
// Failing to read or parse the file also causes it to return true.
-func StaleEnvFile(filepath string, getenv func(string) string) (bool, error) {
+func StaleEnvFile(filepath string, getenv func(string) string) (isStale bool,
+ changedEnvironmentVariable []string, err error) {
data, err := ioutil.ReadFile(filepath)
if err != nil {
- return true, err
+ return true, nil, err
}
var contents envFileData
err = json.Unmarshal(data, &contents)
if err != nil {
- return true, err
+ return true, nil, err
}
var changed []string
@@ -78,6 +81,7 @@
cur := getenv(key)
if old != cur {
changed = append(changed, fmt.Sprintf("%s (%q -> %q)", key, old, cur))
+ changedEnvironmentVariable = append(changedEnvironmentVariable, key)
}
}
@@ -86,10 +90,10 @@
for _, s := range changed {
fmt.Printf(" %s\n", s)
}
- return true, nil
+ return true, changedEnvironmentVariable, nil
}
- return false, nil
+ return false, nil, nil
}
// Deserializes and environment serialized by EnvFileContents() and returns it
diff --git a/tests/apex_comparison_tests.sh b/tests/apex_comparison_tests.sh
index e350323..8893060 100755
--- a/tests/apex_comparison_tests.sh
+++ b/tests/apex_comparison_tests.sh
@@ -29,7 +29,7 @@
# Test Setup
############
-OUTPUT_DIR="$(mktemp -d tmp.XXXXXX)"
+OUTPUT_DIR="$(mktemp -d $(pwd)/tmp.XXXXXX)"
SOONG_OUTPUT_DIR="$OUTPUT_DIR/soong"
BAZEL_OUTPUT_DIR="$OUTPUT_DIR/bazel"
@@ -45,6 +45,12 @@
call_bazel clean
rm -rf "${OUTPUT_DIR}"
}
+
+function deapexer() {
+ DEBUGFS_PATH="$(realpath $(call_bazel cquery --config=bp2build --config=linux_x86_64 --config=ci --output=files //external/e2fsprogs/debugfs))"
+ call_bazel run --config=bp2build //system/apex/tools:deapexer -- --debugfs_path=$DEBUGFS_PATH $@
+}
+
trap cleanup EXIT
###########
@@ -72,10 +78,7 @@
BAZEL_MINIMAL="$(realpath $(call_bazel cquery --config=bp2build --config=android --config=ci --output=files //build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal))"
# # Build debugfs separately, as it's not a dep of apexer, but needs to be an explicit arg.
-call_bazel build --config=bp2build --config=linux_x86_64 //external/e2fsprogs/debugfs //system/apex/tools:deapexer
-DEBUGFS_PATH="$(realpath $(call_bazel cquery --config=bp2build --config=linux_x86_64 --config=ci --output=files //external/e2fsprogs/debugfs))"
-DEAPEXER="bazel-bin/system/apex/tools/deapexer"
-DEAPEXER="$DEAPEXER --debugfs_path=$DEBUGFS_PATH"
+call_bazel build --config=bp2build --config=linux_x86_64 //external/e2fsprogs/debugfs
#######
# Tests
@@ -91,8 +94,8 @@
local SOONG_LIST="$OUTPUT_DIR/soong.list"
local BAZEL_LIST="$OUTPUT_DIR/bazel.list"
- $DEAPEXER list "$SOONG_APEX" > "$SOONG_LIST"
- $DEAPEXER list "$BAZEL_APEX" > "$BAZEL_LIST"
+ deapexer list "$SOONG_APEX" > "$SOONG_LIST"
+ deapexer list "$BAZEL_APEX" > "$BAZEL_LIST"
if cmp -s "$SOONG_LIST" "$BAZEL_LIST"
then
diff --git a/tests/bp2build_bazel_test.sh b/tests/bp2build_bazel_test.sh
index 71e6af0..090114b 100755
--- a/tests/bp2build_bazel_test.sh
+++ b/tests/bp2build_bazel_test.sh
@@ -232,6 +232,63 @@
eval "${_save_trap}"
}
+function test_build_files_take_precedence {
+ _save_trap=$(trap -p EXIT)
+ trap '[[ $? -ne 0 ]] && echo Are you running this locally? Try changing --sandbox_tmpfs_path to something other than /tmp/ in build/bazel/linux.bazelrc.' EXIT
+ _build_files_take_precedence
+ eval "${_save_trap}"
+}
+
+function _build_files_take_precedence {
+ setup
+
+ # This specific directory is hardcoded in bp2build as being one
+ # where the BUILD file should be intentionally kept.
+ mkdir -p testpkg/keep_build_file
+ cat > testpkg/keep_build_file/Android.bp <<'EOF'
+genrule {
+ name: "print_origin",
+ cmd: "echo 'from_soong' > $(out)",
+ out: [
+ "origin.txt",
+ ],
+ bazel_module: {
+ bp2build_available: true,
+ },
+ }
+EOF
+
+ run_soong bp2build
+ run_bazel build --config=android --config=bp2build --config=ci //testpkg/keep_build_file:print_origin
+
+ local -r output_file="$(find -L bazel-out -name origin.txt)"
+ if [[ ! -f "${output_file}" ]]; then
+ fail "Expected origin.txt to be generated, but was missing"
+ fi
+ if ! grep from_soong "${output_file}"; then
+ fail "Expected to find 'from_soong' in '${output_file}'"
+ fi
+
+ cat > testpkg/keep_build_file/BUILD.bazel <<'EOF'
+genrule(
+ name = "print_origin",
+ outs = ["origin.txt"],
+ cmd = "echo 'from_bazel' > $@",
+)
+EOF
+
+ # Clean the workspace. There is a test infrastructure bug where run_bazel
+ # will symlink Android.bp files in the source directory again and thus
+ # pollute the workspace.
+ # TODO: b/286059878 - Remove this clean after the underlying bug is fixed.
+ run_soong clean
+ run_soong bp2build
+ run_bazel build --config=android --config=bp2build --config=ci //testpkg/keep_build_file:print_origin
+ if ! grep from_bazel "${output_file}"; then
+ fail "Expected to find 'from_bazel' in '${output_file}'"
+ fi
+}
+
function test_bp2build_symlinks_files {
setup
mkdir -p foo
@@ -382,4 +439,39 @@
run_bazel build --config=android --config=api_bp2build //foo:libfoo.contribution
}
+function test_bazel_standalone_output_paths_contain_product_name {
+ setup
+ mkdir -p a
+ cat > a/Android.bp <<EOF
+cc_object {
+ name: "qq",
+ srcs: ["qq.cc"],
+ bazel_module: {
+ bp2build_available: true,
+ },
+ stl: "none",
+ system_shared_libs: [],
+}
+EOF
+
+ cat > a/qq.cc <<EOF
+#include "qq.h"
+int qq() {
+ return QQ;
+}
+EOF
+
+ cat > a/qq.h <<EOF
+#define QQ 1
+EOF
+
+ export TARGET_PRODUCT=aosp_arm; run_soong bp2build
+ local -r output=$(run_bazel cquery //a:qq --output=files --config=android --config=bp2build --config=ci)
+ if [[ ! $(echo ${output} | grep "bazel-out/aosp_arm") ]]; then
+ fail "Did not find the product name '${TARGET_PRODUCT}' in the output path. This can cause " \
+ "unnecessary rebuilds when toggling between products as bazel outputs for different products will " \
+ "clobber each other. Output paths are: \n${output}"
+ fi
+}
+
scan_and_run_tests
diff --git a/tests/dcla_apex_comparison_test.sh b/tests/dcla_apex_comparison_test.sh
index 667dde0..e3c189f 100755
--- a/tests/dcla_apex_comparison_test.sh
+++ b/tests/dcla_apex_comparison_test.sh
@@ -55,6 +55,8 @@
libc++.so
libcrypto.so
libcutils.so
+ libstagefright_flacdec.so
+ libutils.so
)
if [[ -z ${OUT_DIR+x} ]]; then
diff --git a/tests/genrule_sandbox_test.py b/tests/genrule_sandbox_test.py
new file mode 100755
index 0000000..697fc26
--- /dev/null
+++ b/tests/genrule_sandbox_test.py
@@ -0,0 +1,186 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2023 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import argparse
+import collections
+import json
+import os.path
+import subprocess
+import tempfile
+
+SRC_ROOT_DIR = os.path.abspath(__file__ + "/../../../..")
+
+
+def _module_graph_path(out_dir):
+ return os.path.join(SRC_ROOT_DIR, out_dir, "soong", "module-actions.json")
+
+
+def _build_with_soong(targets, target_product, out_dir, extra_env={}):
+ env = {
+ "TARGET_PRODUCT": target_product,
+ "TARGET_BUILD_VARIANT": "userdebug",
+ }
+ env.update(os.environ)
+ env.update(extra_env)
+ args = [
+ "build/soong/soong_ui.bash",
+ "--make-mode",
+ "--skip-soong-tests",
+ ]
+ args.extend(targets)
+ try:
+ out = subprocess.check_output(
+ args,
+ cwd=SRC_ROOT_DIR,
+ env=env,
+ )
+ except subprocess.CalledProcessError as e:
+ print(e)
+ print(e.stdout)
+ print(e.stderr)
+ exit(1)
+
+
+def _find_outputs_for_modules(modules, out_dir, target_product):
+ module_path = os.path.join(
+ SRC_ROOT_DIR, out_dir, "soong", "module-actions.json"
+ )
+
+ if not os.path.exists(module_path):
+ _build_with_soong(["json-module-graph"], target_product, out_dir)
+
+ action_graph = json.load(open(_module_graph_path(out_dir)))
+
+ module_to_outs = collections.defaultdict(set)
+ for mod in action_graph:
+ name = mod["Name"]
+ if name in modules:
+ for act in mod["Module"]["Actions"]:
+ if "}generate " in act["Desc"]:
+ module_to_outs[name].update(act["Outputs"])
+ return module_to_outs
+
+
+def _store_outputs_to_tmp(output_files):
+ try:
+ tempdir = tempfile.TemporaryDirectory()
+ for f in output_files:
+ out = subprocess.check_output(
+ ["cp", "--parents", f, tempdir.name],
+ cwd=SRC_ROOT_DIR,
+ )
+ return tempdir
+ except subprocess.CalledProcessError as e:
+ print(e)
+ print(e.stdout)
+ print(e.stderr)
+
+
+def _diff_outs(file1, file2, show_diff):
+ base_args = ["diff"]
+ if not show_diff:
+ base_args.append("--brief")
+ try:
+ args = base_args + [file1, file2]
+ output = subprocess.check_output(
+ args,
+ cwd=SRC_ROOT_DIR,
+ )
+ except subprocess.CalledProcessError as e:
+ if e.returncode == 1:
+ if show_diff:
+ return output
+ return True
+ return None
+
+
+def _compare_outputs(module_to_outs, tempdir, show_diff):
+ different_modules = collections.defaultdict(list)
+ for module, outs in module_to_outs.items():
+ for out in outs:
+ output = None
+ diff = _diff_outs(os.path.join(tempdir.name, out), out, show_diff)
+ if diff:
+ different_modules[module].append(diff)
+
+ tempdir.cleanup()
+ return different_modules
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "--target_product",
+ "-t",
+ default="aosp_cf_arm64_phone",
+ help="optional, target product, always runs as eng",
+ )
+ parser.add_argument(
+ "modules",
+ nargs="+",
+ help="modules to compare builds with genrule sandboxing enabled/not",
+ )
+ parser.add_argument(
+ "--show-diff",
+ "-d",
+ action="store_true",
+ required=False,
+ help="whether to display differing files",
+ )
+ parser.add_argument(
+ "--output-paths-only",
+ "-o",
+ action="store_true",
+ required=False,
+ help="Whether to only return the output paths per module",
+ )
+ args = parser.parse_args()
+
+ out_dir = os.environ.get("OUT_DIR", "out")
+ target_product = args.target_product
+ modules = set(args.modules)
+
+ module_to_outs = _find_outputs_for_modules(modules, out_dir, target_product)
+ if args.output_paths_only:
+ for m, o in module_to_outs.items():
+ print(f"{m} outputs: {o}")
+ exit(0)
+
+ all_outs = set()
+ for outs in module_to_outs.values():
+ all_outs.update(outs)
+ print("build without sandboxing")
+ _build_with_soong(list(all_outs), target_product, out_dir)
+ tempdir = _store_outputs_to_tmp(all_outs)
+ print("build with sandboxing")
+ _build_with_soong(
+ list(all_outs),
+ target_product,
+ out_dir,
+ extra_env={"GENRULE_SANDBOXING": "true"},
+ )
+ diffs = _compare_outputs(module_to_outs, tempdir, args.show_diff)
+ if len(diffs) == 0:
+ print("All modules are correct")
+ elif args.show_diff:
+ for m, d in diffs.items():
+ print(f"Module {m} has diffs {d}")
+ else:
+ print(f"Modules {list(diffs.keys())} have diffs")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tests/genrule_sandbox_test.sh b/tests/genrule_sandbox_test.sh
deleted file mode 100755
index 21b476b..0000000
--- a/tests/genrule_sandbox_test.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2023 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -e
-
-# Build the given genrule modules with GENRULE_SANDBOXING enabled and disabled,
-# then compare the output of the modules and report result.
-
-function die() { format=$1; shift; printf >&2 "$format\n" $@; exit 1; }
-
-function usage() {
- die "usage: ${0##*/} <-t lunch_target> [module]..."
-}
-
-if [ ! -e "build/make/core/Makefile" ]; then
- die "$0 must be run from the top of the Android source tree."
-fi
-
-declare TARGET=
-while getopts "t:" opt; do
- case $opt in
- t)
- TARGET=$OPTARG ;;
- *) usage ;;
- esac
-done
-
-shift $((OPTIND-1))
-MODULES="$@"
-
-source build/envsetup.sh
-
-if [[ -n $TARGET ]]; then
- lunch $TARGET
-fi
-
-if [[ -z ${OUT_DIR+x} ]]; then
- OUT_DIR="out"
-fi
-
-OUTPUT_DIR="$(mktemp -d tmp.XXXXXX)"
-PASS=true
-
-function cleanup {
- if [ $PASS = true ]; then
- rm -rf "${OUTPUT_DIR}"
- fi
-}
-trap cleanup EXIT
-
-declare -A GEN_PATH_MAP
-
-function find_gen_paths() {
- for module in $MODULES; do
- module_path=$(pathmod "$module")
- package_path=${module_path#$ANDROID_BUILD_TOP}
- gen_path=$OUT_DIR/soong/.intermediates$package_path/$module
- GEN_PATH_MAP[$module]=$gen_path
- done
-}
-
-function store_outputs() {
- local dir=$1; shift
-
- for module in $MODULES; do
- dest_dir=$dir/${module}
- mkdir -p $dest_dir
- gen_path=${GEN_PATH_MAP[$module]}
- cp -r $gen_path $dest_dir
- done
-}
-
-function cmp_outputs() {
- local dir1=$1; shift
- local dir2=$1; shift
-
- for module in $MODULES; do
- if ! diff -rq --exclude=genrule.sbox.textproto $dir1/$module $dir2/$module; then
- PASS=false
- echo "$module differ"
- fi
- done
- if [ $PASS = true ]; then
- echo "Test passed"
- fi
-}
-
-if [ ! -f "$ANDROID_PRODUCT_OUT/module-info.json" ]; then
- refreshmod
-fi
-
-find_gen_paths
-m --skip-soong-tests GENRULE_SANDBOXING=true "${MODULES[@]}"
-store_outputs "$OUTPUT_DIR/sandbox"
-m --skip-soong-tests GENRULE_SANDBOXING=false "${MODULES[@]}"
-store_outputs "$OUTPUT_DIR/non_sandbox"
-
-cmp_outputs "$OUTPUT_DIR/non_sandbox" "$OUTPUT_DIR/sandbox"
diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh
index db14bd4..c77b903 100755
--- a/tests/run_integration_tests.sh
+++ b/tests/run_integration_tests.sh
@@ -22,3 +22,6 @@
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh" "aosp_cf_arm64_phone" "armv8-a" "cortex-a53"
"$TOP/build/soong/tests/sbom_test.sh"
+
+"$TOP/build/bazel/ci/b_test.sh"
+
diff --git a/tradefed/autogen.go b/tradefed/autogen.go
index 49b09af..3c55c51 100644
--- a/tradefed/autogen.go
+++ b/tradefed/autogen.go
@@ -40,9 +40,9 @@
}
var autogenTestConfig = pctx.StaticRule("autogenTestConfig", blueprint.RuleParams{
- Command: "sed 's&{MODULE}&${name}&g;s&{EXTRA_CONFIGS}&'${extraConfigs}'&g;s&{OUTPUT_FILENAME}&'${outputFileName}'&g;s&{TEST_INSTALL_BASE}&'${testInstallBase}'&g' $template > $out",
+ Command: "sed 's&{MODULE}&${name}&g;s&{EXTRA_CONFIGS}&'${extraConfigs}'&g;s&{EXTRA_TEST_RUNNER_CONFIGS}&'${extraTestRunnerConfigs}'&g;s&{OUTPUT_FILENAME}&'${outputFileName}'&g;s&{TEST_INSTALL_BASE}&'${testInstallBase}'&g' $template > $out",
CommandDeps: []string{"$template"},
-}, "name", "template", "extraConfigs", "outputFileName", "testInstallBase")
+}, "name", "template", "extraConfigs", "outputFileName", "testInstallBase", "extraTestRunnerConfigs")
func testConfigPath(ctx android.ModuleContext, prop *string, testSuites []string, autoGenConfig *bool, testConfigTemplateProp *string) (path android.Path, autogenPath android.WritablePath) {
p := getTestConfig(ctx, prop)
@@ -107,7 +107,7 @@
}
-func autogenTemplate(ctx android.ModuleContext, name string, output android.WritablePath, template string, configs []Config, outputFileName string, testInstallBase string) {
+func autogenTemplate(ctx android.ModuleContext, name string, output android.WritablePath, template string, configs []Config, testRunnerConfigs []Option, outputFileName string, testInstallBase string) {
if template == "" {
ctx.ModuleErrorf("Empty template")
}
@@ -118,16 +118,27 @@
extraConfigs := strings.Join(configStrings, fmt.Sprintf("\\n%s", test_xml_indent))
extraConfigs = proptools.NinjaAndShellEscape(extraConfigs)
+ var testRunnerConfigStrings []string
+ for _, config := range testRunnerConfigs {
+ testRunnerConfigStrings = append(testRunnerConfigStrings, config.Config())
+ }
+ extraTestRunnerConfigs := strings.Join(testRunnerConfigStrings, fmt.Sprintf("\\n%s%s", test_xml_indent, test_xml_indent))
+ if len(extraTestRunnerConfigs) > 0 {
+ extraTestRunnerConfigs += fmt.Sprintf("\\n%s%s", test_xml_indent, test_xml_indent)
+ }
+ extraTestRunnerConfigs = proptools.NinjaAndShellEscape(extraTestRunnerConfigs)
+
ctx.Build(pctx, android.BuildParams{
Rule: autogenTestConfig,
Description: "test config",
Output: output,
Args: map[string]string{
- "name": name,
- "template": template,
- "extraConfigs": extraConfigs,
- "outputFileName": outputFileName,
- "testInstallBase": testInstallBase,
+ "name": name,
+ "template": template,
+ "extraConfigs": extraConfigs,
+ "outputFileName": outputFileName,
+ "testInstallBase": testInstallBase,
+ "extraTestRunnerConfigs": extraTestRunnerConfigs,
},
})
}
@@ -142,6 +153,7 @@
TestSuites []string
Config []Config
OptionsForAutogenerated []Option
+ TestRunnerOptions []Option
AutoGenConfig *bool
UnitTest *bool
TestInstallBase string
@@ -155,6 +167,7 @@
for _, c := range options.OptionsForAutogenerated {
configs = append(configs, c)
}
+ testRunnerConfigs := append([]Option{}, options.TestRunnerOptions...)
name := options.Name
if name == "" {
name = ctx.ModuleName()
@@ -163,15 +176,15 @@
if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, options.TestConfigTemplateProp)
if templatePath.Valid() {
- autogenTemplate(ctx, name, autogenPath, templatePath.String(), configs, options.OutputFileName, options.TestInstallBase)
+ autogenTemplate(ctx, name, autogenPath, templatePath.String(), configs, testRunnerConfigs, options.OutputFileName, options.TestInstallBase)
} else {
if ctx.Device() {
- autogenTemplate(ctx, name, autogenPath, options.DeviceTemplate, configs, options.OutputFileName, options.TestInstallBase)
+ autogenTemplate(ctx, name, autogenPath, options.DeviceTemplate, configs, testRunnerConfigs, options.OutputFileName, options.TestInstallBase)
} else {
if Bool(options.UnitTest) {
- autogenTemplate(ctx, name, autogenPath, options.HostUnitTestTemplate, configs, options.OutputFileName, options.TestInstallBase)
+ autogenTemplate(ctx, name, autogenPath, options.HostUnitTestTemplate, configs, testRunnerConfigs, options.OutputFileName, options.TestInstallBase)
} else {
- autogenTemplate(ctx, name, autogenPath, options.HostTemplate, configs, options.OutputFileName, options.TestInstallBase)
+ autogenTemplate(ctx, name, autogenPath, options.HostTemplate, configs, testRunnerConfigs, options.OutputFileName, options.TestInstallBase)
}
}
}
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index ee53327..41cb5ab 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -135,6 +135,7 @@
productOut("obj/NOTICE_FILES"),
productOut("obj/PACKAGING"),
productOut("ramdisk"),
+ productOut("ramdisk_16k"),
productOut("debug_ramdisk"),
productOut("vendor_ramdisk"),
productOut("vendor_debug_ramdisk"),
diff --git a/ui/build/config.go b/ui/build/config.go
index 0df1374..c991777 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -15,7 +15,9 @@
package build
import (
+ "context"
"encoding/json"
+ "errors"
"fmt"
"io/ioutil"
"math/rand"
@@ -38,6 +40,9 @@
const (
envConfigDir = "vendor/google/tools/soong_config"
jsonSuffix = "json"
+
+ configFetcher = "vendor/google/tools/soong/expconfigfetcher"
+ envConfigFetchTimeout = 10 * time.Second
)
var (
@@ -136,6 +141,9 @@
EXTERNAL_FILE
// ninja uses a prioritized module list from Soong
HINT_FROM_SOONG
+ // If ninja log exists, use NINJA_LOG, if not, use HINT_FROM_SOONG instead.
+ // We can assume it is an incremental build if ninja log exists.
+ DEFAULT
)
const srcDirFileCheck = "build/soong/root.bp"
@@ -166,6 +174,87 @@
}
}
+// fetchEnvConfig optionally fetches a configuration file that can then subsequently be
+// loaded into Soong environment to control certain aspects of build behavior (e.g., enabling RBE).
+// If a configuration file already exists on disk, the fetch is run in the background
+// so as to NOT block the rest of the build execution.
+func fetchEnvConfig(ctx Context, config *configImpl, envConfigName string) error {
+ configName := envConfigName + "." + jsonSuffix
+ expConfigFetcher := &smpb.ExpConfigFetcher{Filename: &configName}
+ defer func() {
+ ctx.Metrics.ExpConfigFetcher(expConfigFetcher)
+ }()
+ if !config.GoogleProdCredsExist() {
+ status := smpb.ExpConfigFetcher_MISSING_GCERT
+ expConfigFetcher.Status = &status
+ return nil
+ }
+
+ s, err := os.Stat(configFetcher)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return err
+ }
+ if s.Mode()&0111 == 0 {
+ status := smpb.ExpConfigFetcher_ERROR
+ expConfigFetcher.Status = &status
+ return fmt.Errorf("configuration fetcher binary %v is not executable: %v", configFetcher, s.Mode())
+ }
+
+ configExists := false
+ outConfigFilePath := filepath.Join(config.OutDir(), configName)
+ if _, err := os.Stat(outConfigFilePath); err == nil {
+ configExists = true
+ }
+
+ tCtx, cancel := context.WithTimeout(ctx, envConfigFetchTimeout)
+ fetchStart := time.Now()
+ cmd := exec.CommandContext(tCtx, configFetcher, "-output_config_dir", config.OutDir(),
+ "-output_config_name", configName)
+ if err := cmd.Start(); err != nil {
+ status := smpb.ExpConfigFetcher_ERROR
+ expConfigFetcher.Status = &status
+ return err
+ }
+
+ fetchCfg := func() error {
+ if err := cmd.Wait(); err != nil {
+ status := smpb.ExpConfigFetcher_ERROR
+ expConfigFetcher.Status = &status
+ return err
+ }
+ fetchEnd := time.Now()
+ expConfigFetcher.Micros = proto.Uint64(uint64(fetchEnd.Sub(fetchStart).Microseconds()))
+ expConfigFetcher.Filename = proto.String(outConfigFilePath)
+
+ if _, err := os.Stat(outConfigFilePath); err != nil {
+ status := smpb.ExpConfigFetcher_NO_CONFIG
+ expConfigFetcher.Status = &status
+ return err
+ }
+ status := smpb.ExpConfigFetcher_CONFIG
+ expConfigFetcher.Status = &status
+ return nil
+ }
+
+ // If a config file does not exist, wait for the config file to be fetched. Otherwise
+ // fetch the config file in the background and return immediately.
+ if !configExists {
+ defer cancel()
+ return fetchCfg()
+ }
+
+ go func() {
+ defer cancel()
+ if err := fetchCfg(); err != nil {
+ ctx.Verbosef("Failed to fetch config file %v: %v\n", configName, err)
+ }
+ }()
+ return nil
+}
+
func loadEnvConfig(ctx Context, config *configImpl, bc string) error {
if bc == "" {
return nil
@@ -233,7 +322,7 @@
ret := &configImpl{
environ: OsEnvironment(),
sandboxConfig: &SandboxConfig{},
- ninjaWeightListSource: NINJA_LOG,
+ ninjaWeightListSource: DEFAULT,
}
// Default matching ninja
@@ -244,8 +333,21 @@
ret.parseArgs(ctx, args)
if ret.ninjaWeightListSource == HINT_FROM_SOONG {
- ret.environ.Set("SOONG_GENERATES_NINJA_HINT", "true")
+ ret.environ.Set("SOONG_GENERATES_NINJA_HINT", "always")
+ } else if ret.ninjaWeightListSource == DEFAULT {
+ defaultNinjaWeightListSource := NINJA_LOG
+ if _, err := os.Stat(filepath.Join(ret.OutDir(), ninjaLogFileName)); errors.Is(err, os.ErrNotExist) {
+ ctx.Verboseln("$OUT/.ninja_log doesn't exist, use HINT_FROM_SOONG instead")
+ defaultNinjaWeightListSource = HINT_FROM_SOONG
+ } else {
+ ctx.Verboseln("$OUT/.ninja_log exist, use NINJA_LOG")
+ }
+ ret.ninjaWeightListSource = defaultNinjaWeightListSource
+ // soong_build generates ninja hint depending on ninja log existence.
+ // Set it "depend" to avoid soong re-run due to env variable change.
+ ret.environ.Set("SOONG_GENERATES_NINJA_HINT", "depend")
}
+
// Make sure OUT_DIR is set appropriately
if outDir, ok := ret.environ.Get("OUT_DIR"); ok {
ret.environ.Set("OUT_DIR", filepath.Clean(outDir))
@@ -266,6 +368,9 @@
bc := os.Getenv("ANDROID_BUILD_ENVIRONMENT_CONFIG")
if bc != "" {
+ if err := fetchEnvConfig(ctx, ret, bc); err != nil {
+ ctx.Verbosef("Failed to fetch config file: %v\n", err)
+ }
if err := loadEnvConfig(ctx, ret, bc); err != nil {
ctx.Fatalln("Failed to parse env config files: %v", err)
}
@@ -1019,6 +1124,9 @@
}
func (c *configImpl) UsedEnvFile(tag string) string {
+ if v, ok := c.environ.Get("TARGET_PRODUCT"); ok {
+ return shared.JoinPath(c.SoongOutDir(), usedEnvFile+"."+v+"."+tag)
+ }
return shared.JoinPath(c.SoongOutDir(), usedEnvFile+"."+tag)
}
@@ -1642,6 +1750,16 @@
return c.Environment().IsEnvTrue("USE_PERSISTENT_BAZEL")
}
+// GetBazeliskBazelVersion returns the Bazel version to use for this build,
+// or the empty string if the current canonical prod Bazel should be used.
+// This environment variable should only be set to debug the build system.
+// The Bazel version, if set, will be passed to Bazelisk, and Bazelisk will
+// handle downloading and invoking the correct Bazel binary.
+func (c *configImpl) GetBazeliskBazelVersion() string {
+ value, _ := c.Environment().Get("USE_BAZEL_VERSION")
+ return value
+}
+
func (c *configImpl) BazelModulesForceEnabledByFlag() string {
return c.bazelForceEnabledModules
}
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index b3092ea..b3e871f 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -86,27 +86,29 @@
// This list specifies whether a particular binary from $PATH is allowed to be
// run during the build. For more documentation, see path_interposer.go .
var Configuration = map[string]PathConfig{
- "bash": Allowed,
- "dd": Allowed,
- "diff": Allowed,
- "dlv": Allowed,
- "expr": Allowed,
- "fuser": Allowed,
- "getopt": Allowed,
- "git": Allowed,
- "hexdump": Allowed,
- "jar": Allowed,
- "java": Allowed,
- "javap": Allowed,
- "lsof": Allowed,
- "openssl": Allowed,
- "pstree": Allowed,
- "rsync": Allowed,
- "sh": Allowed,
- "stubby": Allowed,
- "tr": Allowed,
- "unzip": Allowed,
- "zip": Allowed,
+ "bash": Allowed,
+ "dd": Allowed,
+ "diff": Allowed,
+ "dlv": Allowed,
+ "expr": Allowed,
+ "fuser": Allowed,
+ "gcert": Allowed,
+ "getopt": Allowed,
+ "git": Allowed,
+ "hexdump": Allowed,
+ "jar": Allowed,
+ "java": Allowed,
+ "javap": Allowed,
+ "lsof": Allowed,
+ "openssl": Allowed,
+ "prodcertstatus": Allowed,
+ "pstree": Allowed,
+ "rsync": Allowed,
+ "sh": Allowed,
+ "stubby": Allowed,
+ "tr": Allowed,
+ "unzip": Allowed,
+ "zip": Allowed,
// Host toolchain is removed. In-tree toolchain should be used instead.
// GCC also can't find cc1 with this implementation.
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 6de8d6f..b14208e 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -451,13 +451,17 @@
_ = bootstrap.RunBlueprint(blueprintArgs, bootstrap.DoEverything, blueprintCtx, blueprintConfig)
}
-func checkEnvironmentFile(currentEnv *Environment, envFile string) {
+func checkEnvironmentFile(ctx Context, currentEnv *Environment, envFile string) {
getenv := func(k string) string {
v, _ := currentEnv.Get(k)
return v
}
- if stale, _ := shared.StaleEnvFile(envFile, getenv); stale {
+ // Log the changed environment variables to ChangedEnvironmentVariable field
+ if stale, changedEnvironmentVariableList, _ := shared.StaleEnvFile(envFile, getenv); stale {
+ for _, changedEnvironmentVariable := range changedEnvironmentVariableList {
+ ctx.Metrics.AddChangedEnvironmentVariable(changedEnvironmentVariable)
+ }
os.Remove(envFile)
}
}
@@ -502,26 +506,26 @@
ctx.BeginTrace(metrics.RunSoong, "environment check")
defer ctx.EndTrace()
- checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(soongBuildTag))
+ checkEnvironmentFile(ctx, soongBuildEnv, config.UsedEnvFile(soongBuildTag))
if config.BazelBuildEnabled() || config.Bp2Build() {
- checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(bp2buildFilesTag))
+ checkEnvironmentFile(ctx, soongBuildEnv, config.UsedEnvFile(bp2buildFilesTag))
}
if config.JsonModuleGraph() {
- checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(jsonModuleGraphTag))
+ checkEnvironmentFile(ctx, soongBuildEnv, config.UsedEnvFile(jsonModuleGraphTag))
}
if config.Queryview() {
- checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(queryviewTag))
+ checkEnvironmentFile(ctx, soongBuildEnv, config.UsedEnvFile(queryviewTag))
}
if config.ApiBp2build() {
- checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(apiBp2buildTag))
+ checkEnvironmentFile(ctx, soongBuildEnv, config.UsedEnvFile(apiBp2buildTag))
}
if config.SoongDocs() {
- checkEnvironmentFile(soongBuildEnv, config.UsedEnvFile(soongDocsTag))
+ checkEnvironmentFile(ctx, soongBuildEnv, config.UsedEnvFile(soongDocsTag))
}
}()
@@ -533,7 +537,7 @@
defer ctx.EndTrace()
if config.IsPersistentBazelEnabled() {
- bazelProxy := bazel.NewProxyServer(ctx.Logger, config.OutDir(), filepath.Join(config.SoongOutDir(), "workspace"))
+ bazelProxy := bazel.NewProxyServer(ctx.Logger, config.OutDir(), filepath.Join(config.SoongOutDir(), "workspace"), config.GetBazeliskBazelVersion())
bazelProxy.Start()
defer bazelProxy.Close()
}
diff --git a/ui/metrics/BUILD.bazel b/ui/metrics/BUILD.bazel
index 2dc1ab6..ca39c59 100644
--- a/ui/metrics/BUILD.bazel
+++ b/ui/metrics/BUILD.bazel
@@ -23,6 +23,7 @@
proto_library(
name = "metrics-proto",
srcs = [
+ "bazel_metrics_proto/bazel_metrics.proto",
"bp2build_metrics_proto/bp2build_metrics.proto",
"metrics_proto/metrics.proto",
],
diff --git a/ui/metrics/metrics.go b/ui/metrics/metrics.go
index a282e20..6d60316 100644
--- a/ui/metrics/metrics.go
+++ b/ui/metrics/metrics.go
@@ -248,6 +248,13 @@
m.metrics.BuildCommand = proto.String(strings.Join(cmd, " "))
}
+// AddChangedEnvironmentVariable adds the changed environment variable to
+// ChangedEnvironmentVariable field.
+func (m *Metrics) AddChangedEnvironmentVariable(ChangedEnvironmentVariable string) {
+ m.metrics.ChangedEnvironmentVariable = append(m.metrics.ChangedEnvironmentVariable,
+ ChangedEnvironmentVariable)
+}
+
// Dump exports the collected metrics from the executed build to the file at
// out path.
func (m *Metrics) Dump(out string) error {
diff --git a/ui/metrics/metrics_proto/metrics.pb.go b/ui/metrics/metrics_proto/metrics.pb.go
index 32d4dc0..f3e677a 100644
--- a/ui/metrics/metrics_proto/metrics.pb.go
+++ b/ui/metrics/metrics_proto/metrics.pb.go
@@ -15,7 +15,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.30.0
-// protoc v3.21.7
+// protoc v3.21.12
// source: metrics.proto
package metrics_proto
@@ -420,6 +420,11 @@
Branch *string `protobuf:"bytes,32,opt,name=branch" json:"branch,omitempty"`
// The metric of critical path in build
CriticalPathInfo *CriticalPathInfo `protobuf:"bytes,33,opt,name=critical_path_info,json=criticalPathInfo" json:"critical_path_info,omitempty"`
+ // Environment variables that have changed value since the previous build,
+ // which were responsible for retriggering build analysis.
+ // Note that not all changed environment variables result in analysis retriggering.
+ // If there was no previous build, this list will be empty.
+ ChangedEnvironmentVariable []string `protobuf:"bytes,34,rep,name=changed_environment_variable,json=changedEnvironmentVariable" json:"changed_environment_variable,omitempty"`
}
// Default values for MetricsBase fields.
@@ -694,6 +699,13 @@
return nil
}
+func (x *MetricsBase) GetChangedEnvironmentVariable() []string {
+ if x != nil {
+ return x.ChangedEnvironmentVariable
+ }
+ return nil
+}
+
type BuildConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -1659,7 +1671,7 @@
var file_metrics_proto_rawDesc = []byte{
0x0a, 0x0d, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x13, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74,
- 0x72, 0x69, 0x63, 0x73, 0x22, 0x8a, 0x0f, 0x0a, 0x0b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
+ 0x72, 0x69, 0x63, 0x73, 0x22, 0xcc, 0x0f, 0x0a, 0x0b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
0x42, 0x61, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x64, 0x61,
0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01,
0x28, 0x03, 0x52, 0x12, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,
@@ -1773,199 +1785,203 @@
0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x43,
0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x10, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x66,
- 0x6f, 0x22, 0x30, 0x0a, 0x0c, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x56, 0x61, 0x72, 0x69, 0x61, 0x6e,
- 0x74, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x55,
- 0x53, 0x45, 0x52, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x45, 0x4e,
- 0x47, 0x10, 0x02, 0x22, 0x3c, 0x0a, 0x04, 0x41, 0x72, 0x63, 0x68, 0x12, 0x0b, 0x0a, 0x07, 0x55,
- 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x52, 0x4d, 0x10,
- 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x52, 0x4d, 0x36, 0x34, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03,
- 0x58, 0x38, 0x36, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x58, 0x38, 0x36, 0x5f, 0x36, 0x34, 0x10,
- 0x04, 0x22, 0x8a, 0x04, 0x0a, 0x0b, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69,
- 0x67, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x5f, 0x67, 0x6f, 0x6d, 0x61, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x08, 0x52, 0x07, 0x75, 0x73, 0x65, 0x47, 0x6f, 0x6d, 0x61, 0x12, 0x17, 0x0a, 0x07,
- 0x75, 0x73, 0x65, 0x5f, 0x72, 0x62, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75,
- 0x73, 0x65, 0x52, 0x62, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x75,
- 0x73, 0x65, 0x5f, 0x67, 0x6f, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66,
- 0x6f, 0x72, 0x63, 0x65, 0x55, 0x73, 0x65, 0x47, 0x6f, 0x6d, 0x61, 0x12, 0x24, 0x0a, 0x0e, 0x62,
- 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x61, 0x73, 0x5f, 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x18, 0x04, 0x20,
- 0x01, 0x28, 0x08, 0x52, 0x0c, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x41, 0x73, 0x4e, 0x69, 0x6e, 0x6a,
- 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x6d, 0x69, 0x78, 0x65, 0x64,
- 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x62, 0x61,
- 0x7a, 0x65, 0x6c, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x18, 0x0a,
- 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07,
- 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x44, 0x0a, 0x1f, 0x66, 0x6f, 0x72, 0x63, 0x65,
- 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x6d,
- 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08,
- 0x52, 0x1b, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x61,
- 0x7a, 0x65, 0x6c, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x79, 0x0a,
- 0x18, 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x6c, 0x69,
- 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32,
- 0x36, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65,
- 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69,
- 0x67, 0x2e, 0x4e, 0x69, 0x6e, 0x6a, 0x61, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x69, 0x73,
- 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x08, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x53, 0x45,
- 0x44, 0x52, 0x15, 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x69,
- 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x74, 0x0a, 0x15, 0x4e, 0x69, 0x6e, 0x6a,
- 0x61, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63,
- 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x53, 0x45, 0x44, 0x10, 0x00, 0x12,
- 0x0d, 0x0a, 0x09, 0x4e, 0x49, 0x4e, 0x4a, 0x41, 0x5f, 0x4c, 0x4f, 0x47, 0x10, 0x01, 0x12, 0x16,
- 0x0a, 0x12, 0x45, 0x56, 0x45, 0x4e, 0x4c, 0x59, 0x5f, 0x44, 0x49, 0x53, 0x54, 0x52, 0x49, 0x42,
- 0x55, 0x54, 0x45, 0x44, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e,
- 0x41, 0x4c, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x48, 0x49, 0x4e,
- 0x54, 0x5f, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x53, 0x4f, 0x4f, 0x4e, 0x47, 0x10, 0x04, 0x22, 0x6f,
- 0x0a, 0x12, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
- 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x32, 0x0a, 0x15, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x68,
- 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x04, 0x52, 0x13, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63,
- 0x61, 0x6c, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x76, 0x61, 0x69,
- 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x70, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
- 0x52, 0x0d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x70, 0x75, 0x73, 0x22,
- 0xca, 0x02, 0x0a, 0x08, 0x50, 0x65, 0x72, 0x66, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b,
- 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12,
- 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65,
- 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d,
- 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x6c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x72, 0x65, 0x61, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x21,
- 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x75, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01,
- 0x28, 0x04, 0x42, 0x02, 0x18, 0x01, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x55, 0x73,
- 0x65, 0x12, 0x60, 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x5f, 0x72,
- 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x06, 0x20, 0x03,
- 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64,
- 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
- 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x15, 0x70, 0x72,
- 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49,
- 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x6f, 0x6e, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x5f,
- 0x65, 0x78, 0x69, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x6f, 0x6e, 0x5a,
- 0x65, 0x72, 0x6f, 0x45, 0x78, 0x69, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72,
- 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
- 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xb9, 0x03, 0x0a,
- 0x13, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
- 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72,
- 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01,
- 0x28, 0x04, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x63, 0x72,
- 0x6f, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x74, 0x69, 0x6d,
- 0x65, 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10,
- 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73,
- 0x12, 0x1c, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x73, 0x73, 0x5f, 0x6b, 0x62, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x52, 0x73, 0x73, 0x4b, 0x62, 0x12, 0x2a,
- 0x0a, 0x11, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x66, 0x61, 0x75,
- 0x6c, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 0x6f, 0x72,
- 0x50, 0x61, 0x67, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6d, 0x61,
- 0x6a, 0x6f, 0x72, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18,
- 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x50, 0x61, 0x67, 0x65,
- 0x46, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x69, 0x6f, 0x5f, 0x69, 0x6e, 0x70,
- 0x75, 0x74, 0x5f, 0x6b, 0x62, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x69, 0x6f, 0x49,
- 0x6e, 0x70, 0x75, 0x74, 0x4b, 0x62, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x6f, 0x5f, 0x6f, 0x75, 0x74,
- 0x70, 0x75, 0x74, 0x5f, 0x6b, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x69, 0x6f,
- 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4b, 0x62, 0x12, 0x3c, 0x0a, 0x1a, 0x76, 0x6f, 0x6c, 0x75,
- 0x6e, 0x74, 0x61, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x77,
- 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x18, 0x76, 0x6f,
- 0x6c, 0x75, 0x6e, 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x53, 0x77,
- 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x1c, 0x69, 0x6e, 0x76, 0x6f, 0x6c, 0x75,
- 0x6e, 0x74, 0x61, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x77,
- 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x1a, 0x69, 0x6e,
+ 0x6f, 0x12, 0x40, 0x0a, 0x1c, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x76,
+ 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c,
+ 0x65, 0x18, 0x22, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1a, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64,
+ 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x72, 0x69, 0x61,
+ 0x62, 0x6c, 0x65, 0x22, 0x30, 0x0a, 0x0c, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x56, 0x61, 0x72, 0x69,
+ 0x61, 0x6e, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a,
+ 0x09, 0x55, 0x53, 0x45, 0x52, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03,
+ 0x45, 0x4e, 0x47, 0x10, 0x02, 0x22, 0x3c, 0x0a, 0x04, 0x41, 0x72, 0x63, 0x68, 0x12, 0x0b, 0x0a,
+ 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x52,
+ 0x4d, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x52, 0x4d, 0x36, 0x34, 0x10, 0x02, 0x12, 0x07,
+ 0x0a, 0x03, 0x58, 0x38, 0x36, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x58, 0x38, 0x36, 0x5f, 0x36,
+ 0x34, 0x10, 0x04, 0x22, 0x8a, 0x04, 0x0a, 0x0b, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x43, 0x6f, 0x6e,
+ 0x66, 0x69, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x5f, 0x67, 0x6f, 0x6d, 0x61, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x75, 0x73, 0x65, 0x47, 0x6f, 0x6d, 0x61, 0x12, 0x17,
+ 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x72, 0x62, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x06, 0x75, 0x73, 0x65, 0x52, 0x62, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x66, 0x6f, 0x72, 0x63, 0x65,
+ 0x5f, 0x75, 0x73, 0x65, 0x5f, 0x67, 0x6f, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x0c, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x55, 0x73, 0x65, 0x47, 0x6f, 0x6d, 0x61, 0x12, 0x24, 0x0a,
+ 0x0e, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x61, 0x73, 0x5f, 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x41, 0x73, 0x4e, 0x69,
+ 0x6e, 0x6a, 0x61, 0x12, 0x2a, 0x0a, 0x11, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x6d, 0x69, 0x78,
+ 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f,
+ 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12,
+ 0x18, 0x0a, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x44, 0x0a, 0x1f, 0x66, 0x6f, 0x72,
+ 0x63, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x7a, 0x65, 0x6c,
+ 0x5f, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x18, 0x07, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x1b, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65,
+ 0x42, 0x61, 0x7a, 0x65, 0x6c, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12,
+ 0x79, 0x0a, 0x18, 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f,
+ 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28,
+ 0x0e, 0x32, 0x36, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f,
+ 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x43, 0x6f, 0x6e,
+ 0x66, 0x69, 0x67, 0x2e, 0x4e, 0x69, 0x6e, 0x6a, 0x61, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4c,
+ 0x69, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x08, 0x4e, 0x4f, 0x54, 0x5f, 0x55,
+ 0x53, 0x45, 0x44, 0x52, 0x15, 0x6e, 0x69, 0x6e, 0x6a, 0x61, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74,
+ 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x74, 0x0a, 0x15, 0x4e, 0x69,
+ 0x6e, 0x6a, 0x61, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x53, 0x45, 0x44, 0x10,
+ 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x49, 0x4e, 0x4a, 0x41, 0x5f, 0x4c, 0x4f, 0x47, 0x10, 0x01,
+ 0x12, 0x16, 0x0a, 0x12, 0x45, 0x56, 0x45, 0x4e, 0x4c, 0x59, 0x5f, 0x44, 0x49, 0x53, 0x54, 0x52,
+ 0x49, 0x42, 0x55, 0x54, 0x45, 0x44, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x58, 0x54, 0x45,
+ 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x48,
+ 0x49, 0x4e, 0x54, 0x5f, 0x46, 0x52, 0x4f, 0x4d, 0x5f, 0x53, 0x4f, 0x4f, 0x4e, 0x47, 0x10, 0x04,
+ 0x22, 0x6f, 0x0a, 0x12, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x32, 0x0a, 0x15, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f,
+ 0x70, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x68, 0x79, 0x73,
+ 0x69, 0x63, 0x61, 0x6c, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x76,
+ 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x70, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x05, 0x52, 0x0d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x70, 0x75,
+ 0x73, 0x22, 0xca, 0x02, 0x0a, 0x08, 0x50, 0x65, 0x72, 0x66, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20,
+ 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69,
+ 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54,
+ 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x6c, 0x5f, 0x74, 0x69, 0x6d, 0x65,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x72, 0x65, 0x61, 0x6c, 0x54, 0x69, 0x6d, 0x65,
+ 0x12, 0x21, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x75, 0x73, 0x65, 0x18, 0x05,
+ 0x20, 0x01, 0x28, 0x04, 0x42, 0x02, 0x18, 0x01, 0x52, 0x09, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79,
+ 0x55, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73,
+ 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x06,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69,
+ 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65,
+ 0x73, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x15,
+ 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
+ 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0d, 0x6e, 0x6f, 0x6e, 0x5f, 0x7a, 0x65, 0x72,
+ 0x6f, 0x5f, 0x65, 0x78, 0x69, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x6f,
+ 0x6e, 0x5a, 0x65, 0x72, 0x6f, 0x45, 0x78, 0x69, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72,
+ 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xb9,
+ 0x03, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73,
+ 0x65, 0x72, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69,
+ 0x63, 0x72, 0x6f, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x74,
+ 0x69, 0x6d, 0x65, 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04,
+ 0x52, 0x10, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x63, 0x72,
+ 0x6f, 0x73, 0x12, 0x1c, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x73, 0x73, 0x5f, 0x6b, 0x62,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x52, 0x73, 0x73, 0x4b, 0x62,
+ 0x12, 0x2a, 0x0a, 0x11, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x66,
+ 0x61, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6d, 0x69, 0x6e,
+ 0x6f, 0x72, 0x50, 0x61, 0x67, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x11,
+ 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x66, 0x61, 0x75, 0x6c, 0x74,
+ 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x50, 0x61,
+ 0x67, 0x65, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x69, 0x6f, 0x5f, 0x69,
+ 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x6b, 0x62, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x69,
+ 0x6f, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4b, 0x62, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x6f, 0x5f, 0x6f,
+ 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6b, 0x62, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a,
+ 0x69, 0x6f, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4b, 0x62, 0x12, 0x3c, 0x0a, 0x1a, 0x76, 0x6f,
+ 0x6c, 0x75, 0x6e, 0x74, 0x61, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f,
+ 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x18,
0x76, 0x6f, 0x6c, 0x75, 0x6e, 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
- 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x22, 0xe5, 0x01, 0x0a, 0x0e, 0x4d, 0x6f, 0x64,
- 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x5b, 0x0a, 0x0c, 0x62,
- 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x0e, 0x32, 0x2f, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f,
- 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79,
- 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x79, 0x73, 0x74,
- 0x65, 0x6d, 0x3a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x0b, 0x62, 0x75, 0x69,
- 0x6c, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x75,
- 0x6c, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d,
- 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6e, 0x75, 0x6d,
- 0x5f, 0x6f, 0x66, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
- 0x0d, 0x52, 0x0c, 0x6e, 0x75, 0x6d, 0x4f, 0x66, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x22,
- 0x2f, 0x0a, 0x0b, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x0b,
- 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53,
- 0x4f, 0x4f, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x41, 0x4b, 0x45, 0x10, 0x02,
- 0x22, 0x6c, 0x0a, 0x1a, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x55, 0x73, 0x65, 0x72,
- 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x12,
- 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20,
- 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c,
- 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
- 0x73, 0x42, 0x61, 0x73, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x62,
- 0x0a, 0x1b, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x4a, 0x6f,
- 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x43, 0x0a,
- 0x04, 0x63, 0x75, 0x6a, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x73, 0x6f,
- 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63,
- 0x73, 0x2e, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x4a, 0x6f,
- 0x75, 0x72, 0x6e, 0x65, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x04, 0x63, 0x75,
- 0x6a, 0x73, 0x22, 0xcc, 0x02, 0x0a, 0x11, 0x53, 0x6f, 0x6f, 0x6e, 0x67, 0x42, 0x75, 0x69, 0x6c,
- 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x75,
- 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
- 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x2a,
- 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x5f, 0x63, 0x6f,
- 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x74, 0x6f, 0x74, 0x61, 0x6c,
- 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x6f,
- 0x74, 0x61, 0x6c, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, 0x6c, 0x6c, 0x6f, 0x63,
- 0x53, 0x69, 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x68, 0x65, 0x61, 0x70,
- 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x78,
- 0x48, 0x65, 0x61, 0x70, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e,
- 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67,
- 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x50,
- 0x65, 0x72, 0x66, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12,
- 0x50, 0x0a, 0x11, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x5f,
- 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x6f, 0x6f,
+ 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x1c, 0x69, 0x6e, 0x76, 0x6f,
+ 0x6c, 0x75, 0x6e, 0x74, 0x61, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f,
+ 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x1a,
+ 0x69, 0x6e, 0x76, 0x6f, 0x6c, 0x75, 0x6e, 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65,
+ 0x78, 0x74, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x22, 0xe5, 0x01, 0x0a, 0x0e, 0x4d,
+ 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x5b, 0x0a,
+ 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c,
+ 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
+ 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x79,
+ 0x73, 0x74, 0x65, 0x6d, 0x3a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x0b, 0x62,
+ 0x75, 0x69, 0x6c, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f,
+ 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0a, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6e,
+ 0x75, 0x6d, 0x5f, 0x6f, 0x66, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6e, 0x75, 0x6d, 0x4f, 0x66, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
+ 0x73, 0x22, 0x2f, 0x0a, 0x0b, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
+ 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a,
+ 0x05, 0x53, 0x4f, 0x4f, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x41, 0x4b, 0x45,
+ 0x10, 0x02, 0x22, 0x6c, 0x0a, 0x1a, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x55, 0x73,
+ 0x65, 0x72, 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
+ 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75,
+ 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x72,
+ 0x69, 0x63, 0x73, 0x42, 0x61, 0x73, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
+ 0x22, 0x62, 0x0a, 0x1b, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x55, 0x73, 0x65, 0x72,
+ 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12,
+ 0x43, 0x0a, 0x04, 0x63, 0x75, 0x6a, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e,
+ 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72,
+ 0x69, 0x63, 0x73, 0x2e, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x55, 0x73, 0x65, 0x72,
+ 0x4a, 0x6f, 0x75, 0x72, 0x6e, 0x65, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x04,
+ 0x63, 0x75, 0x6a, 0x73, 0x22, 0xcc, 0x02, 0x0a, 0x11, 0x53, 0x6f, 0x6f, 0x6e, 0x67, 0x42, 0x75,
+ 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f,
+ 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, 0x6f, 0x64,
+ 0x75, 0x6c, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73,
+ 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x5f,
+ 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x74, 0x6f, 0x74,
+ 0x61, 0x6c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10,
+ 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x5f, 0x73, 0x69, 0x7a, 0x65,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, 0x6c, 0x6c,
+ 0x6f, 0x63, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x68, 0x65,
+ 0x61, 0x70, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d,
+ 0x61, 0x78, 0x48, 0x65, 0x61, 0x70, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x65, 0x76,
+ 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6f, 0x6f,
0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
- 0x2e, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x49, 0x6e, 0x66, 0x6f,
- 0x52, 0x0f, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x49, 0x6e, 0x66,
- 0x6f, 0x22, 0xdb, 0x01, 0x0a, 0x10, 0x45, 0x78, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x46,
- 0x65, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62,
- 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x45, 0x78, 0x70,
- 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x46, 0x65, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x43, 0x6f,
- 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
- 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16,
- 0x0a, 0x06, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06,
- 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x22, 0x47, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
- 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, 0x4e,
- 0x46, 0x49, 0x47, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10,
- 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d,
- 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x47, 0x43, 0x45, 0x52, 0x54, 0x10, 0x03, 0x22,
- 0x91, 0x01, 0x0a, 0x0f, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x49,
- 0x6e, 0x66, 0x6f, 0x12, 0x3d, 0x0a, 0x1b, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69,
- 0x6c, 0x64, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
- 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x18, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x42,
- 0x75, 0x69, 0x6c, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
- 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x1c, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c,
- 0x64, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
- 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x42,
- 0x75, 0x69, 0x6c, 0x64, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4d, 0x6f, 0x64, 0x75,
- 0x6c, 0x65, 0x73, 0x22, 0x8a, 0x02, 0x0a, 0x10, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c,
- 0x50, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x13, 0x65, 0x6c, 0x61, 0x70,
- 0x73, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x54, 0x69,
- 0x6d, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x12, 0x39, 0x0a, 0x19, 0x63, 0x72, 0x69, 0x74,
- 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6d,
- 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, 0x63, 0x72, 0x69,
- 0x74, 0x69, 0x63, 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x63,
- 0x72, 0x6f, 0x73, 0x12, 0x41, 0x0a, 0x0d, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x5f,
- 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x6f, 0x6f,
- 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
- 0x2e, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63,
- 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x12, 0x48, 0x0a, 0x11, 0x6c, 0x6f, 0x6e, 0x67, 0x5f, 0x72,
- 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x6a, 0x6f, 0x62, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28,
- 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f,
- 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x52,
- 0x0f, 0x6c, 0x6f, 0x6e, 0x67, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x4a, 0x6f, 0x62, 0x73,
- 0x22, 0x62, 0x0a, 0x07, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x13, 0x65,
- 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6d, 0x69, 0x63, 0x72,
- 0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65,
- 0x64, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x6a,
- 0x6f, 0x62, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6a, 0x6f, 0x62, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
- 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x28, 0x5a, 0x26, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f,
- 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x75, 0x69, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
- 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x2e, 0x50, 0x65, 0x72, 0x66, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74,
+ 0x73, 0x12, 0x50, 0x0a, 0x11, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64,
+ 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73,
+ 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69,
+ 0x63, 0x73, 0x2e, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x49, 0x6e,
+ 0x66, 0x6f, 0x52, 0x0f, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x49,
+ 0x6e, 0x66, 0x6f, 0x22, 0xdb, 0x01, 0x0a, 0x10, 0x45, 0x78, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69,
+ 0x67, 0x46, 0x65, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
+ 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67,
+ 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x45,
+ 0x78, 0x70, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x46, 0x65, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e,
+ 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74,
+ 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65,
+ 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04,
+ 0x52, 0x06, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x22, 0x47, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66,
+ 0x69, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x5f, 0x43,
+ 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4e, 0x46, 0x49,
+ 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x12, 0x11,
+ 0x0a, 0x0d, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x47, 0x43, 0x45, 0x52, 0x54, 0x10,
+ 0x03, 0x22, 0x91, 0x01, 0x0a, 0x0f, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64,
+ 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3d, 0x0a, 0x1b, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62,
+ 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x5f, 0x6d, 0x6f, 0x64,
+ 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x18, 0x6d, 0x69, 0x78, 0x65,
+ 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4d, 0x6f, 0x64,
+ 0x75, 0x6c, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x1c, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x62, 0x75,
+ 0x69, 0x6c, 0x64, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x5f, 0x6d, 0x6f, 0x64,
+ 0x75, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6d, 0x69, 0x78, 0x65,
+ 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4d, 0x6f,
+ 0x64, 0x75, 0x6c, 0x65, 0x73, 0x22, 0x8a, 0x02, 0x0a, 0x10, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63,
+ 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x13, 0x65, 0x6c,
+ 0x61, 0x70, 0x73, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f,
+ 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64,
+ 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x12, 0x39, 0x0a, 0x19, 0x63, 0x72,
+ 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x74, 0x69, 0x6d, 0x65,
+ 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, 0x63,
+ 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x4d,
+ 0x69, 0x63, 0x72, 0x6f, 0x73, 0x12, 0x41, 0x0a, 0x0d, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61,
+ 0x6c, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73,
+ 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69,
+ 0x63, 0x73, 0x2e, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x63, 0x72, 0x69, 0x74,
+ 0x69, 0x63, 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x12, 0x48, 0x0a, 0x11, 0x6c, 0x6f, 0x6e, 0x67,
+ 0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x6a, 0x6f, 0x62, 0x73, 0x18, 0x05, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c,
+ 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66,
+ 0x6f, 0x52, 0x0f, 0x6c, 0x6f, 0x6e, 0x67, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x4a, 0x6f,
+ 0x62, 0x73, 0x22, 0x62, 0x0a, 0x07, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x0a,
+ 0x13, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6d, 0x69,
+ 0x63, 0x72, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x65, 0x6c, 0x61, 0x70,
+ 0x73, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x12, 0x27, 0x0a,
+ 0x0f, 0x6a, 0x6f, 0x62, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6a, 0x6f, 0x62, 0x44, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x28, 0x5a, 0x26, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69,
+ 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x75, 0x69, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69,
+ 0x63, 0x73, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
}
var (
diff --git a/ui/metrics/metrics_proto/metrics.proto b/ui/metrics/metrics_proto/metrics.proto
index 6db83e9..b437da7 100644
--- a/ui/metrics/metrics_proto/metrics.proto
+++ b/ui/metrics/metrics_proto/metrics.proto
@@ -131,6 +131,12 @@
// The metric of critical path in build
optional CriticalPathInfo critical_path_info = 33;
+
+ // Environment variables that have changed value since the previous build,
+ // which were responsible for retriggering build analysis.
+ // Note that not all changed environment variables result in analysis retriggering.
+ // If there was no previous build, this list will be empty.
+ repeated string changed_environment_variable = 34;
}
message BuildConfig {