Merge "Update the Rust prebuilt version number"
diff --git a/android/bazel.go b/android/bazel.go
index f72fd40..75b13c9 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -219,6 +219,9 @@
"libjemalloc5_integrationtest",
"libjemalloc5_stresstestlib",
"libjemalloc5_unittest",
+
+ // APEX support
+ "com.android.runtime", // http://b/194746715, apex, depends on 'libc_malloc_debug' and 'libc_malloc_hooks'
}
// Per-module denylist of cc_library modules to only generate the static
diff --git a/android/module.go b/android/module.go
index 84e78d1..5e2e06a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1529,7 +1529,7 @@
var installDeps []*installPathsDepSet
var packagingSpecs []*packagingSpecsDepSet
ctx.VisitDirectDeps(func(dep Module) {
- if IsInstallDepNeeded(ctx.OtherModuleDependencyTag(dep)) && !dep.IsHideFromMake() {
+ if IsInstallDepNeeded(ctx.OtherModuleDependencyTag(dep)) && !dep.IsHideFromMake() && !dep.IsSkipInstall() {
installDeps = append(installDeps, dep.base().installFilesDepSet)
packagingSpecs = append(packagingSpecs, dep.base().packagingSpecsDepSet)
}
diff --git a/android/packaging_test.go b/android/packaging_test.go
index f91dc5d..ff7446c 100644
--- a/android/packaging_test.go
+++ b/android/packaging_test.go
@@ -18,13 +18,15 @@
"testing"
"github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
)
// Module to be packaged
type componentTestModule struct {
ModuleBase
props struct {
- Deps []string
+ Deps []string
+ Skip_install *bool
}
}
@@ -49,6 +51,9 @@
builtFile := PathForModuleOut(ctx, m.Name())
dir := ctx.Target().Arch.ArchType.Multilib
installDir := PathForModuleInstall(ctx, dir)
+ if proptools.Bool(m.props.Skip_install) {
+ m.SkipInstall()
+ }
ctx.InstallFile(installDir, m.Name(), builtFile)
}
@@ -365,3 +370,31 @@
}
`, []string{"lib64/foo"})
}
+
+func TestPackagingWithSkipInstallDeps(t *testing.T) {
+ // package -[dep]-> foo -[dep]-> bar -[dep]-> baz
+ // OK SKIPPED
+ multiTarget := false
+ runPackagingTest(t, multiTarget,
+ `
+ component {
+ name: "foo",
+ deps: ["bar"],
+ }
+
+ component {
+ name: "bar",
+ deps: ["baz"],
+ skip_install: true,
+ }
+
+ component {
+ name: "baz",
+ }
+
+ package_module {
+ name: "package",
+ deps: ["foo"],
+ }
+ `, []string{"lib64/foo"})
+}
diff --git a/apex/apex.go b/apex/apex.go
index 6f8f9c0..149f782 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -3189,7 +3189,7 @@
type bazelApexBundleAttributes struct {
Manifest bazel.LabelAttribute
Android_manifest bazel.LabelAttribute
- File_contexts string
+ File_contexts bazel.LabelAttribute
Key bazel.LabelAttribute
Certificate bazel.LabelAttribute
Min_sdk_version string
@@ -3197,6 +3197,7 @@
Installable bazel.BoolAttribute
Native_shared_libs bazel.LabelListAttribute
Binaries bazel.StringListAttribute
+ Prebuilts bazel.LabelListAttribute
}
type bazelApexBundle struct {
@@ -3238,9 +3239,9 @@
androidManifestLabelAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, *module.properties.AndroidManifest))
}
- var fileContexts string
+ var fileContextsLabelAttribute bazel.LabelAttribute
if module.properties.File_contexts != nil {
- fileContexts = *module.properties.File_contexts
+ fileContextsLabelAttribute.SetValue(android.BazelLabelForModuleDepSingle(ctx, *module.properties.File_contexts))
}
var minSdkVersion string
@@ -3262,6 +3263,10 @@
nativeSharedLibsLabelList := android.BazelLabelForModuleDeps(ctx, nativeSharedLibs)
nativeSharedLibsLabelListAttribute := bazel.MakeLabelListAttribute(nativeSharedLibsLabelList)
+ prebuilts := module.properties.Prebuilts
+ prebuiltsLabelList := android.BazelLabelForModuleDeps(ctx, prebuilts)
+ prebuiltsLabelListAttribute := bazel.MakeLabelListAttribute(prebuiltsLabelList)
+
binaries := module.properties.ApexNativeDependencies.Binaries
binariesStringListAttribute := bazel.MakeStringListAttribute(binaries)
@@ -3278,7 +3283,7 @@
attrs := &bazelApexBundleAttributes{
Manifest: manifestLabelAttribute,
Android_manifest: androidManifestLabelAttribute,
- File_contexts: fileContexts,
+ File_contexts: fileContextsLabelAttribute,
Min_sdk_version: minSdkVersion,
Key: keyLabelAttribute,
Certificate: certificateLabelAttribute,
@@ -3286,6 +3291,7 @@
Installable: installableAttribute,
Native_shared_libs: nativeSharedLibsLabelListAttribute,
Binaries: binariesStringListAttribute,
+ Prebuilts: prebuiltsLabelListAttribute,
}
props := bazel.BazelTargetModuleProperties{
diff --git a/apex/key.go b/apex/key.go
index 4bd0dc4..32a7ce1 100644
--- a/apex/key.go
+++ b/apex/key.go
@@ -20,6 +20,7 @@
"strings"
"android/soong/android"
+ "android/soong/bazel"
"github.com/google/blueprint/proptools"
)
@@ -33,6 +34,8 @@
func registerApexKeyBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("apex_key", ApexKeyFactory)
ctx.RegisterSingletonType("apex_keys_text", apexKeysTextFactory)
+
+ android.RegisterBp2BuildMutator("apex_key", ApexKeyBp2Build)
}
type apexKey struct {
@@ -192,3 +195,68 @@
func (s *apexKeysText) MakeVars(ctx android.MakeVarsContext) {
ctx.Strict("SOONG_APEX_KEYS_FILE", s.output.String())
}
+
+// For Bazel / bp2build
+
+type bazelApexKeyAttributes struct {
+ Public_key bazel.LabelAttribute
+ Private_key bazel.LabelAttribute
+}
+
+type bazelApexKey struct {
+ android.BazelTargetModuleBase
+ bazelApexKeyAttributes
+}
+
+func BazelApexKeyFactory() android.Module {
+ module := &bazelApexKey{}
+ module.AddProperties(&module.bazelApexKeyAttributes)
+ android.InitBazelTargetModule(module)
+ return module
+}
+
+func ApexKeyBp2Build(ctx android.TopDownMutatorContext) {
+ module, ok := ctx.Module().(*apexKey)
+ if !ok {
+ // Not an APEX key
+ return
+ }
+ if !module.ConvertWithBp2build(ctx) {
+ return
+ }
+ if ctx.ModuleType() != "apex_key" {
+ return
+ }
+
+ apexKeyBp2BuildInternal(ctx, module)
+}
+
+func apexKeyBp2BuildInternal(ctx android.TopDownMutatorContext, module *apexKey) {
+ var privateKeyLabelAttribute bazel.LabelAttribute
+ if module.properties.Private_key != nil {
+ privateKeyLabelAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, *module.properties.Private_key))
+ }
+
+ var publicKeyLabelAttribute bazel.LabelAttribute
+ if module.properties.Public_key != nil {
+ publicKeyLabelAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, *module.properties.Public_key))
+ }
+
+ attrs := &bazelApexKeyAttributes{
+ Private_key: privateKeyLabelAttribute,
+ Public_key: publicKeyLabelAttribute,
+ }
+
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "apex_key",
+ Bzl_load_location: "//build/bazel/rules:apex_key.bzl",
+ }
+
+ ctx.CreateBazelTargetModule(BazelApexKeyFactory, module.Name(), props, attrs)
+}
+
+func (m *bazelApexKey) Name() string {
+ return m.BaseModuleName()
+}
+
+func (m *bazelApexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
diff --git a/bp2build/Android.bp b/bp2build/Android.bp
index dded14b..9ec637a 100644
--- a/bp2build/Android.bp
+++ b/bp2build/Android.bp
@@ -23,12 +23,15 @@
"soong-bazel",
"soong-cc",
"soong-cc-config",
+ "soong-etc",
"soong-genrule",
"soong-python",
"soong-sh",
],
testSrcs: [
+ "android_app_certificate_conversion_test.go",
"apex_conversion_test.go",
+ "apex_key_conversion_test.go",
"build_conversion_test.go",
"bzl_conversion_test.go",
"cc_library_conversion_test.go",
@@ -36,6 +39,7 @@
"cc_library_static_conversion_test.go",
"cc_object_conversion_test.go",
"conversion_test.go",
+ "prebuilt_etc_conversion_test.go",
"python_binary_conversion_test.go",
"sh_conversion_test.go",
"testing.go",
diff --git a/bp2build/android_app_certificate_conversion_test.go b/bp2build/android_app_certificate_conversion_test.go
new file mode 100644
index 0000000..022c687
--- /dev/null
+++ b/bp2build/android_app_certificate_conversion_test.go
@@ -0,0 +1,49 @@
+// Copyright 2021 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 (
+ "android/soong/android"
+ "android/soong/java"
+
+ "testing"
+)
+
+func runAndroidAppCertificateTestCase(t *testing.T, tc bp2buildTestCase) {
+ t.Helper()
+ runBp2BuildTestCase(t, registerAndroidAppCertificateModuleTypes, tc)
+}
+
+func registerAndroidAppCertificateModuleTypes(ctx android.RegistrationContext) {
+}
+
+func TestAndroidAppCertificateSimple(t *testing.T) {
+ runAndroidAppCertificateTestCase(t, bp2buildTestCase{
+ description: "Android app certificate - simple example",
+ moduleTypeUnderTest: "android_app_certificate",
+ moduleTypeUnderTestFactory: java.AndroidAppCertificateFactory,
+ moduleTypeUnderTestBp2BuildMutator: java.AndroidAppCertificateBp2Build,
+ filesystem: map[string]string{},
+ blueprint: `
+android_app_certificate {
+ name: "com.android.apogee.cert",
+ certificate: "chamber_of_secrets_dir",
+}
+`,
+ expectedBazelTargets: []string{`android_app_certificate(
+ name = "com.android.apogee.cert",
+ certificate = "chamber_of_secrets_dir",
+)`}})
+}
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go
index d38300e..456f18a 100644
--- a/bp2build/apex_conversion_test.go
+++ b/bp2build/apex_conversion_test.go
@@ -29,13 +29,13 @@
}
func registerApexModuleTypes(ctx android.RegistrationContext) {
- // CC module types needed as they can be APEX dependencies viathe native_shared_libs property
+ // CC module types needed as they can be APEX dependencies
cc.RegisterCCBuildComponents(ctx)
+
ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
-
ctx.RegisterModuleType("apex_key", apex.ApexKeyFactory)
-
ctx.RegisterModuleType("android_app_certificate", java.AndroidAppCertificateFactory)
+ ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
}
func TestApexBundleSimple(t *testing.T) {
@@ -69,6 +69,26 @@
bazel_module: { bp2build_available: false },
}
+// TODO(b/194878861): Add bp2build support for prebuilt_etc
+cc_library {
+ name: "pretend_prebuilt_1",
+ bazel_module: { bp2build_available: false },
+}
+
+// TODO(b/194878861): Add bp2build support for prebuilt_etc
+cc_library {
+ name: "pretend_prebuilt_2",
+ bazel_module: { bp2build_available: false },
+}
+
+filegroup {
+ name: "com.android.apogee-file_contexts",
+ srcs: [
+ "com.android.apogee-file_contexts",
+ ],
+ bazel_module: { bp2build_available: false },
+}
+
apex {
name: "com.android.apogee",
manifest: "apogee_manifest.json",
@@ -87,6 +107,10 @@
"binary_1",
"binary_2",
],
+ prebuilts: [
+ "pretend_prebuilt_1",
+ "pretend_prebuilt_2",
+ ],
}
`,
expectedBazelTargets: []string{`apex(
@@ -97,7 +121,7 @@
"binary_2",
],
certificate = ":com.android.apogee.certificate",
- file_contexts = "com.android.apogee-file_contexts",
+ file_contexts = ":com.android.apogee-file_contexts",
installable = False,
key = ":com.android.apogee.key",
manifest = "apogee_manifest.json",
@@ -106,10 +130,33 @@
":native_shared_lib_1",
":native_shared_lib_2",
],
+ prebuilts = [
+ ":pretend_prebuilt_1",
+ ":pretend_prebuilt_2",
+ ],
updatable = False,
)`}})
}
+func TestApexBundleDefaultPropertyValues(t *testing.T) {
+ runApexTestCase(t, bp2buildTestCase{
+ description: "apex - default property values",
+ moduleTypeUnderTest: "apex",
+ moduleTypeUnderTestFactory: apex.BundleFactory,
+ moduleTypeUnderTestBp2BuildMutator: apex.ApexBundleBp2Build,
+ filesystem: map[string]string{},
+ blueprint: `
+apex {
+ name: "com.android.apogee",
+ manifest: "apogee_manifest.json",
+}
+`,
+ expectedBazelTargets: []string{`apex(
+ name = "com.android.apogee",
+ manifest = "apogee_manifest.json",
+)`}})
+}
+
func TestApexBundleHasBazelModuleProps(t *testing.T) {
runApexTestCase(t, bp2buildTestCase{
description: "apex - has bazel module props",
diff --git a/bp2build/apex_key_conversion_test.go b/bp2build/apex_key_conversion_test.go
new file mode 100644
index 0000000..8e1aa09
--- /dev/null
+++ b/bp2build/apex_key_conversion_test.go
@@ -0,0 +1,51 @@
+// Copyright 2021 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 (
+ "android/soong/android"
+ "android/soong/apex"
+
+ "testing"
+)
+
+func runApexKeyTestCase(t *testing.T, tc bp2buildTestCase) {
+ t.Helper()
+ runBp2BuildTestCase(t, registerApexKeyModuleTypes, tc)
+}
+
+func registerApexKeyModuleTypes(ctx android.RegistrationContext) {
+}
+
+func TestApexKeySimple(t *testing.T) {
+ runApexKeyTestCase(t, bp2buildTestCase{
+ description: "apex key - simple example",
+ moduleTypeUnderTest: "apex_key",
+ moduleTypeUnderTestFactory: apex.ApexKeyFactory,
+ moduleTypeUnderTestBp2BuildMutator: apex.ApexKeyBp2Build,
+ filesystem: map[string]string{},
+ blueprint: `
+apex_key {
+ name: "com.android.apogee.key",
+ public_key: "com.android.apogee.avbpubkey",
+ private_key: "com.android.apogee.pem",
+}
+`,
+ expectedBazelTargets: []string{`apex_key(
+ name = "com.android.apogee.key",
+ private_key = "com.android.apogee.pem",
+ public_key = "com.android.apogee.avbpubkey",
+)`}})
+}
diff --git a/bp2build/prebuilt_etc_conversion_test.go b/bp2build/prebuilt_etc_conversion_test.go
new file mode 100644
index 0000000..4e25d1b
--- /dev/null
+++ b/bp2build/prebuilt_etc_conversion_test.go
@@ -0,0 +1,55 @@
+// Copyright 2021 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 (
+ "android/soong/android"
+ "android/soong/etc"
+
+ "testing"
+)
+
+func runPrebuiltEtcTestCase(t *testing.T, tc bp2buildTestCase) {
+ t.Helper()
+ runBp2BuildTestCase(t, registerPrebuiltEtcModuleTypes, tc)
+}
+
+func registerPrebuiltEtcModuleTypes(ctx android.RegistrationContext) {
+}
+
+func TestPrebuiltEtcSimple(t *testing.T) {
+ runPrebuiltEtcTestCase(t, bp2buildTestCase{
+ description: "prebuilt_etc - simple example",
+ moduleTypeUnderTest: "prebuilt_etc",
+ moduleTypeUnderTestFactory: etc.PrebuiltEtcFactory,
+ moduleTypeUnderTestBp2BuildMutator: etc.PrebuiltEtcBp2Build,
+ filesystem: map[string]string{},
+ blueprint: `
+prebuilt_etc {
+ name: "apex_tz_version",
+ src: "version/tz_version",
+ filename: "tz_version",
+ sub_dir: "tz",
+ installable: false,
+}
+`,
+ expectedBazelTargets: []string{`prebuilt_etc(
+ name = "apex_tz_version",
+ filename = "tz_version",
+ installable = False,
+ src = "version/tz_version",
+ sub_dir = "tz",
+)`}})
+}
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
index a7a2316..24e8fa4 100644
--- a/cc/config/vndk.go
+++ b/cc/config/vndk.go
@@ -25,9 +25,11 @@
"android.hardware.authsecret-unstable-ndk_platform",
"android.hardware.automotive.occupant_awareness-V1-ndk",
"android.hardware.automotive.occupant_awareness-V1-ndk_platform",
+ "android.hardware.health.storage-V1-ndk",
"android.hardware.health.storage-V1-ndk_platform",
"android.hardware.health.storage-ndk_platform",
"android.hardware.health.storage-unstable-ndk_platform",
+ "android.hardware.identity-V2-ndk",
"android.hardware.identity-V2-ndk_platform",
"android.hardware.identity-ndk_platform",
"android.hardware.light-V1-ndk",
@@ -42,6 +44,7 @@
"android.hardware.oemlock-V1-ndk_platform",
"android.hardware.oemlock-ndk_platform",
"android.hardware.oemlock-unstable-ndk_platform",
+ "android.hardware.power-V1-ndk",
"android.hardware.power-V1-ndk_platform",
"android.hardware.power-ndk_platform",
"android.hardware.rebootescrow-V1-ndk",
@@ -63,6 +66,7 @@
"android.hardware.security.sharedsecret-V1-ndk_platform",
"android.hardware.security.sharedsecret-ndk_platform",
"android.hardware.security.sharedsecret-unstable-ndk_platform",
+ "android.hardware.vibrator-V1-ndk",
"android.hardware.vibrator-V1-ndk_platform",
"android.hardware.vibrator-ndk_platform",
"android.hardware.weaver-V1-ndk",
diff --git a/cc/config/x86_darwin_host.go b/cc/config/x86_darwin_host.go
index d8e70e1..23fe1ab 100644
--- a/cc/config/x86_darwin_host.go
+++ b/cc/config/x86_darwin_host.go
@@ -49,6 +49,7 @@
"-Wl,-syslibroot,${macSdkRoot}",
"-mmacosx-version-min=${macMinVersion}",
"-m64",
+ "-mlinker-version=305",
}
darwinSupportedSdkVersions = []string{
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index 4107916..8aeb0dd 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -36,6 +36,7 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/bazel"
"android/soong/snapshot"
)
@@ -61,6 +62,8 @@
ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory)
ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)
+
+ android.RegisterBp2BuildMutator("prebuilt_etc", PrebuiltEtcBp2Build)
}
var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents)
@@ -131,6 +134,7 @@
type PrebuiltEtc struct {
android.ModuleBase
android.DefaultableModuleBase
+ android.BazelModuleBase
snapshot.VendorSnapshotModuleInterface
snapshot.RecoverySnapshotModuleInterface
@@ -406,6 +410,7 @@
// This module is device-only
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
+ android.InitBazelModule(module)
return module
}
@@ -647,3 +652,82 @@
return snapshotOutputs
}
+
+// For Bazel / bp2build
+
+type bazelPrebuiltEtcAttributes struct {
+ Src bazel.LabelAttribute
+ Filename string
+ Sub_dir string
+ Installable bazel.BoolAttribute
+}
+
+type bazelPrebuiltEtc struct {
+ android.BazelTargetModuleBase
+ bazelPrebuiltEtcAttributes
+}
+
+func BazelPrebuiltEtcFactory() android.Module {
+ module := &bazelPrebuiltEtc{}
+ module.AddProperties(&module.bazelPrebuiltEtcAttributes)
+ android.InitBazelTargetModule(module)
+ return module
+}
+
+func PrebuiltEtcBp2Build(ctx android.TopDownMutatorContext) {
+ module, ok := ctx.Module().(*PrebuiltEtc)
+ if !ok {
+ // Not an prebuilt_etc
+ return
+ }
+ if !module.ConvertWithBp2build(ctx) {
+ return
+ }
+ if ctx.ModuleType() != "prebuilt_etc" {
+ return
+ }
+
+ prebuiltEtcBp2BuildInternal(ctx, module)
+}
+
+func prebuiltEtcBp2BuildInternal(ctx android.TopDownMutatorContext, module *PrebuiltEtc) {
+ var srcLabelAttribute bazel.LabelAttribute
+ if module.properties.Src != nil {
+ srcLabelAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, *module.properties.Src))
+ }
+
+ var filename string
+ if module.properties.Filename != nil {
+ filename = *module.properties.Filename
+ }
+
+ var subDir string
+ if module.subdirProperties.Sub_dir != nil {
+ subDir = *module.subdirProperties.Sub_dir
+ }
+
+ var installableBoolAttribute bazel.BoolAttribute
+ if module.properties.Installable != nil {
+ installableBoolAttribute.Value = module.properties.Installable
+ }
+
+ attrs := &bazelPrebuiltEtcAttributes{
+ Src: srcLabelAttribute,
+ Filename: filename,
+ Sub_dir: subDir,
+ Installable: installableBoolAttribute,
+ }
+
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "prebuilt_etc",
+ Bzl_load_location: "//build/bazel/rules:prebuilt_etc.bzl",
+ }
+
+ ctx.CreateBazelTargetModule(BazelPrebuiltEtcFactory, module.Name(), props, attrs)
+}
+
+func (m *bazelPrebuiltEtc) Name() string {
+ return m.BaseModuleName()
+}
+
+func (m *bazelPrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
diff --git a/java/Android.bp b/java/Android.bp
index e5b8f96..9ffa123 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -10,6 +10,7 @@
"blueprint-pathtools",
"soong",
"soong-android",
+ "soong-bazel",
"soong-cc",
"soong-dexpreopt",
"soong-genrule",
diff --git a/java/app.go b/java/app.go
index c69210f..35ed27f 100755
--- a/java/app.go
+++ b/java/app.go
@@ -26,6 +26,7 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/bazel"
"android/soong/cc"
"android/soong/dexpreopt"
"android/soong/tradefed"
@@ -42,6 +43,8 @@
ctx.RegisterModuleType("android_app_certificate", AndroidAppCertificateFactory)
ctx.RegisterModuleType("override_android_app", OverrideAndroidAppModuleFactory)
ctx.RegisterModuleType("override_android_test", OverrideAndroidTestModuleFactory)
+
+ android.RegisterBp2BuildMutator("android_app_certificate", AndroidAppCertificateBp2Build)
}
// AndroidManifest.xml merging
@@ -1371,3 +1374,61 @@
outputFile := android.PathForModuleOut(ctx, "verify_uses_libraries", apk.Base())
return outputFile
}
+
+// For Bazel / bp2build
+
+type bazelAndroidAppCertificateAttributes struct {
+ Certificate string
+}
+
+type bazelAndroidAppCertificate struct {
+ android.BazelTargetModuleBase
+ bazelAndroidAppCertificateAttributes
+}
+
+func BazelAndroidAppCertificateFactory() android.Module {
+ module := &bazelAndroidAppCertificate{}
+ module.AddProperties(&module.bazelAndroidAppCertificateAttributes)
+ android.InitBazelTargetModule(module)
+ return module
+}
+
+func AndroidAppCertificateBp2Build(ctx android.TopDownMutatorContext) {
+ module, ok := ctx.Module().(*AndroidAppCertificate)
+ if !ok {
+ // Not an Android app certificate
+ return
+ }
+ if !module.ConvertWithBp2build(ctx) {
+ return
+ }
+ if ctx.ModuleType() != "android_app_certificate" {
+ return
+ }
+
+ androidAppCertificateBp2BuildInternal(ctx, module)
+}
+
+func androidAppCertificateBp2BuildInternal(ctx android.TopDownMutatorContext, module *AndroidAppCertificate) {
+ var certificate string
+ if module.properties.Certificate != nil {
+ certificate = *module.properties.Certificate
+ }
+
+ attrs := &bazelAndroidAppCertificateAttributes{
+ Certificate: certificate,
+ }
+
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "android_app_certificate",
+ Bzl_load_location: "//build/bazel/rules:android_app_certificate.bzl",
+ }
+
+ ctx.CreateBazelTargetModule(BazelAndroidAppCertificateFactory, module.Name(), props, attrs)
+}
+
+func (m *bazelAndroidAppCertificate) Name() string {
+ return m.BaseModuleName()
+}
+
+func (m *bazelAndroidAppCertificate) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
diff --git a/rust/config/allowed_list.go b/rust/config/allowed_list.go
index f568f27..ca110a2 100644
--- a/rust/config/allowed_list.go
+++ b/rust/config/allowed_list.go
@@ -28,6 +28,7 @@
"system/security",
"system/tools/aidl",
"tools/security/fuzzing/example_rust_fuzzer",
+ "vendor/",
}
DownstreamRustAllowedPaths = []string{
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index f3c442e..3d16073 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -261,6 +261,12 @@
"BUILD_BROKEN_USES_BUILD_STATIC_LIBRARY",
}, exportEnvVars...), BannerVars...)
+ // We need Roboleaf converter and runner in the mixed mode
+ runMicrofactory(ctx, config, ".bootstrap/bin/mk2rbc", "android/soong/mk2rbc/cmd",
+ map[string]string{"android/soong": "build/soong"})
+ runMicrofactory(ctx, config, ".bootstrap/bin/rbcrun", "rbcrun/cmd",
+ map[string]string{"go.starlark.net": "external/starlark-go", "rbcrun": "build/make/tools/rbcrun"})
+
makeVars, err := dumpMakeVars(ctx, config, config.Arguments(), allVars, true, "")
if err != nil {
ctx.Fatalln("Error dumping make vars:", err)
diff --git a/ui/build/soong.go b/ui/build/soong.go
index a40457f..3fe7b0a 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -265,20 +265,8 @@
}
}()
- var cfg microfactory.Config
- cfg.Map("github.com/google/blueprint", "build/blueprint")
-
- cfg.TrimPath = absPath(ctx, ".")
-
- func() {
- ctx.BeginTrace(metrics.RunSoong, "bpglob")
- defer ctx.EndTrace()
-
- bpglob := filepath.Join(config.SoongOutDir(), ".minibootstrap/bpglob")
- if _, err := microfactory.Build(&cfg, bpglob, "github.com/google/blueprint/bootstrap/bpglob"); err != nil {
- ctx.Fatalln("Failed to build bpglob:", err)
- }
- }()
+ runMicrofactory(ctx, config, ".minibootstrap/bpglob", "github.com/google/blueprint/bootstrap/bpglob",
+ map[string]string{"github.com/google/blueprint": "build/blueprint"})
ninja := func(name, file string) {
ctx.BeginTrace(metrics.RunSoong, name)
@@ -332,6 +320,25 @@
}
}
+func runMicrofactory(ctx Context, config Config, relExePath string, pkg string, mapping map[string]string) {
+ name := filepath.Base(relExePath)
+ ctx.BeginTrace(metrics.RunSoong, name)
+ defer ctx.EndTrace()
+ cfg := microfactory.Config{TrimPath: absPath(ctx, ".")}
+ for pkgPrefix, pathPrefix := range mapping {
+ cfg.Map(pkgPrefix, pathPrefix)
+ }
+
+ exePath := filepath.Join(config.SoongOutDir(), relExePath)
+ dir := filepath.Dir(exePath)
+ if err := os.MkdirAll(dir, 0777); err != nil {
+ ctx.Fatalf("cannot create %s: %s", dir, err)
+ }
+ if _, err := microfactory.Build(&cfg, exePath, pkg); err != nil {
+ ctx.Fatalf("failed to build %s: %s", name, err)
+ }
+}
+
func shouldCollectBuildSoongMetrics(config Config) bool {
// Do not collect metrics protobuf if the soong_build binary ran as the
// bp2build converter or the JSON graph dump.