Merge "Mixed builds is supported for all apex module types, not just "apex"."
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 2917931..5203fa0 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -217,48 +217,51 @@
"frameworks/native/services/batteryservice": Bp2BuildDefaultTrue,
"frameworks/proto_logging/stats": Bp2BuildDefaultTrueRecursively,
- "hardware/interfaces": Bp2BuildDefaultTrue,
- "hardware/interfaces/audio/aidl": Bp2BuildDefaultTrue,
- "hardware/interfaces/audio/aidl/common": Bp2BuildDefaultTrue,
- "hardware/interfaces/bufferpool/aidl": Bp2BuildDefaultTrue,
- "hardware/interfaces/common/aidl": Bp2BuildDefaultTrue,
- "hardware/interfaces/common/fmq/aidl": Bp2BuildDefaultTrue,
- "hardware/interfaces/configstore/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/configstore/1.1": Bp2BuildDefaultTrue,
- "hardware/interfaces/configstore/utils": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/allocator/2.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/allocator/3.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/allocator/4.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/allocator/aidl": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/bufferqueue/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/bufferqueue/2.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/common/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/common/1.1": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/common/1.2": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/common/aidl": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/mapper/2.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/mapper/2.1": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/mapper/3.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/graphics/mapper/4.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/health/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/health/1.0/default": Bp2BuildDefaultTrue,
- "hardware/interfaces/health/2.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/health/2.0/default": Bp2BuildDefaultTrue,
- "hardware/interfaces/health/2.0/utils": Bp2BuildDefaultTrueRecursively,
- "hardware/interfaces/health/2.1": Bp2BuildDefaultTrue,
- "hardware/interfaces/health/aidl": Bp2BuildDefaultTrue,
- "hardware/interfaces/health/utils": Bp2BuildDefaultTrueRecursively,
- "hardware/interfaces/media/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/media/bufferpool/2.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/media/c2/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/media/c2/1.1": Bp2BuildDefaultTrue,
- "hardware/interfaces/media/c2/1.2": Bp2BuildDefaultTrue,
- "hardware/interfaces/media/omx/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/neuralnetworks/1.0": Bp2BuildDefaultTrue,
- "hardware/interfaces/neuralnetworks/1.1": Bp2BuildDefaultTrue,
- "hardware/interfaces/neuralnetworks/1.2": Bp2BuildDefaultTrue,
- "hardware/interfaces/neuralnetworks/1.3": Bp2BuildDefaultTrue,
- "hardware/interfaces/neuralnetworks/aidl": Bp2BuildDefaultTrue,
+ "hardware/interfaces": Bp2BuildDefaultTrue,
+ "hardware/interfaces/audio/aidl": Bp2BuildDefaultTrue,
+ "hardware/interfaces/audio/aidl/common": Bp2BuildDefaultTrue,
+ "hardware/interfaces/common/aidl": Bp2BuildDefaultTrue,
+ "hardware/interfaces/common/fmq/aidl": Bp2BuildDefaultTrue,
+ "hardware/interfaces/common/support": Bp2BuildDefaultTrue,
+ "hardware/interfaces/configstore/1.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/configstore/1.1": Bp2BuildDefaultTrue,
+ "hardware/interfaces/configstore/utils": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/allocator/2.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/allocator/3.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/allocator/4.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/allocator/aidl": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/bufferqueue/1.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/bufferqueue/2.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/common/1.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/common/1.1": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/common/1.2": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/common/aidl": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/mapper/2.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/mapper/2.1": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/mapper/3.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/graphics/mapper/4.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/health/1.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/health/1.0/default": Bp2BuildDefaultTrue,
+ "hardware/interfaces/health/2.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/health/2.0/default": Bp2BuildDefaultTrue,
+ "hardware/interfaces/health/2.0/utils": Bp2BuildDefaultTrueRecursively,
+ "hardware/interfaces/health/2.1": Bp2BuildDefaultTrue,
+ "hardware/interfaces/health/aidl": Bp2BuildDefaultTrue,
+ "hardware/interfaces/health/utils": Bp2BuildDefaultTrueRecursively,
+ "hardware/interfaces/media/1.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/media/bufferpool": Bp2BuildDefaultTrueRecursively,
+ "hardware/interfaces/media/bufferpool/aidl/default/tests": Bp2BuildDefaultFalseRecursively,
+ "hardware/interfaces/media/c2/1.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/media/c2/1.1": Bp2BuildDefaultTrue,
+ "hardware/interfaces/media/c2/1.2": Bp2BuildDefaultTrue,
+ "hardware/interfaces/media/omx/1.0": Bp2BuildDefaultTrue,
+ "hardware/interfaces/neuralnetworks": Bp2BuildDefaultTrueRecursively,
+ "hardware/interfaces/neuralnetworks/aidl/vts": Bp2BuildDefaultFalseRecursively,
+ "hardware/interfaces/neuralnetworks/1.0/vts": Bp2BuildDefaultFalseRecursively,
+ "hardware/interfaces/neuralnetworks/1.1/vts": Bp2BuildDefaultFalseRecursively,
+ "hardware/interfaces/neuralnetworks/1.2/vts": Bp2BuildDefaultFalseRecursively,
+ "hardware/interfaces/neuralnetworks/1.3/vts": Bp2BuildDefaultFalseRecursively,
+ "hardware/interfaces/neuralnetworks/1.4/vts": Bp2BuildDefaultFalseRecursively,
"libnativehelper": Bp2BuildDefaultTrueRecursively,
@@ -439,7 +442,6 @@
"gemmlowp_headers",
"gl_headers",
"ipconnectivity-proto-src",
- "libaidlcommonsupport",
"libandroid_runtime_lazy",
"libandroid_runtime_vm_headers",
"libaudioclient_aidl_conversion_util",
@@ -501,13 +503,6 @@
"mediaswcodec.policy",
"mediaswcodec.xml",
"neuralnetworks_types",
- "neuralnetworks_utils_hal_aidl",
- "neuralnetworks_utils_hal_common",
- "neuralnetworks_utils_hal_service",
- "neuralnetworks_utils_hal_1_0",
- "neuralnetworks_utils_hal_1_1",
- "neuralnetworks_utils_hal_1_2",
- "neuralnetworks_utils_hal_1_3",
"libneuralnetworks_common",
// packagemanager_aidl_interface is created implicitly in packagemanager_aidl module
"packagemanager_aidl_interface",
@@ -736,15 +731,6 @@
// the "prebuilt_" prefix to the name, so that it's differentiable from
// the source versions within Soong's module graph.
Bp2buildModuleDoNotConvertList = []string{
- // TODO(b/250876486): Created cc_aidl_library doesn't have static libs from parent cc module
- "libgui_window_info_static",
- "libgui", // Depends on unconverted libgui_window_info_static
- "libdisplay", // Depends on uncovnerted libgui
- // Depends on unconverted libdisplay
- "libdvr_static.google",
- "libdvr.google",
- "libvrsensor",
- "dvr_api-test",
// Depends on unconverted libandroid, libgui
"dvr_buffer_queue-test",
"dvr_display-test",
@@ -1425,18 +1411,20 @@
"unwind",
"unwind_info",
"unwind_symbols",
- "libc_malloc_debug",
- "libfdtrack",
- "mediaswcodec",
- "libcodec2_hidl@1.0",
"libEGL",
- "libstagefright_bufferqueue_helper_novndk",
"libGLESv2",
+ "libc_malloc_debug",
+ "libcodec2_hidl@1.0",
"libcodec2_hidl@1.1",
- "libmedia_codecserviceregistrant",
"libcodec2_hidl@1.2",
+ "libfdtrack",
+ "libgui",
+ "libgui_bufferqueue_static",
+ "libmedia_codecserviceregistrant",
+ "libstagefright_bufferqueue_helper_novndk",
"libutils_test",
"libutilscallstack",
+ "mediaswcodec",
}
// Bazel prod-mode allowlist. Modules in this list are built by Bazel
diff --git a/android/api_levels.go b/android/api_levels.go
index 9440ee9..e48a69e 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -55,6 +55,9 @@
}
func (this ApiLevel) FinalInt() int {
+ if this.IsInvalid() {
+ panic(fmt.Errorf("%v is not a recognized api_level\n", this))
+ }
if this.IsPreview() {
panic("Requested a final int from a non-final ApiLevel")
} else {
@@ -63,6 +66,9 @@
}
func (this ApiLevel) FinalOrFutureInt() int {
+ if this.IsInvalid() {
+ panic(fmt.Errorf("%v is not a recognized api_level\n", this))
+ }
if this.IsPreview() {
return FutureApiLevelInt
} else {
@@ -76,6 +82,9 @@
// - preview codenames -> preview base (9000) + index
// - otherwise -> cast to int
func (this ApiLevel) FinalOrPreviewInt() int {
+ if this.IsInvalid() {
+ panic(fmt.Errorf("%v is not a recognized api_level\n", this))
+ }
if this.IsCurrent() {
return this.number
}
@@ -97,6 +106,11 @@
return this.isPreview
}
+// Returns true if the raw api level string is invalid
+func (this ApiLevel) IsInvalid() bool {
+ return this.EqualTo(InvalidApiLevel)
+}
+
// Returns true if this is the unfinalized "current" API level. This means
// different things across Java and native. Java APIs do not use explicit
// codenames, so all non-final codenames are grouped into "current". For native
@@ -113,6 +127,64 @@
return this.number == -1
}
+// Returns true if an app is compiling against private apis.
+// e.g. if sdk_version = "" in Android.bp, then the ApiLevel of that "sdk" is at PrivateApiLevel.
+func (this ApiLevel) IsPrivate() bool {
+ return this.number == PrivateApiLevel.number
+}
+
+// EffectiveVersion converts an ApiLevel into the concrete ApiLevel that the module should use. For
+// modules targeting an unreleased SDK (meaning it does not yet have a number) it returns
+// FutureApiLevel(10000).
+func (l ApiLevel) EffectiveVersion(ctx EarlyModuleContext) (ApiLevel, error) {
+ if l.EqualTo(InvalidApiLevel) {
+ return l, fmt.Errorf("invalid version in sdk_version %q", l.value)
+ }
+ if !l.IsPreview() {
+ return l, nil
+ }
+ ret := ctx.Config().DefaultAppTargetSdk(ctx)
+ if ret.IsPreview() {
+ return FutureApiLevel, nil
+ }
+ return ret, nil
+}
+
+// EffectiveVersionString converts an SdkSpec into the concrete version string that the module
+// should use. For modules targeting an unreleased SDK (meaning it does not yet have a number)
+// it returns the codename (P, Q, R, etc.)
+func (l ApiLevel) EffectiveVersionString(ctx EarlyModuleContext) (string, error) {
+ if l.EqualTo(InvalidApiLevel) {
+ return l.value, fmt.Errorf("invalid version in sdk_version %q", l.value)
+ }
+ if !l.IsPreview() {
+ return l.String(), nil
+ }
+ // Determine the default sdk
+ ret := ctx.Config().DefaultAppTargetSdk(ctx)
+ if !ret.IsPreview() {
+ // If the default sdk has been finalized, return that
+ return ret.String(), nil
+ }
+ // There can be more than one active in-development sdks
+ // If an app is targeting an active sdk, but not the default one, return the requested active sdk.
+ // e.g.
+ // SETUP
+ // In-development: UpsideDownCake, VanillaIceCream
+ // Default: VanillaIceCream
+ // Android.bp
+ // min_sdk_version: `UpsideDownCake`
+ // RETURN
+ // UpsideDownCake and not VanillaIceCream
+ for _, preview := range ctx.Config().PreviewApiLevels() {
+ if l.String() == preview.String() {
+ return preview.String(), nil
+ }
+ }
+ // Otherwise return the default one
+ return ret.String(), nil
+}
+
// Returns -1 if the current API level is less than the argument, 0 if they
// are equal, and 1 if it is greater than the argument.
func (this ApiLevel) CompareTo(other ApiLevel) int {
@@ -166,6 +238,19 @@
isPreview: true,
}
+// Sentinel ApiLevel to validate that an apiLevel is either an int or a recognized codename.
+var InvalidApiLevel = NewInvalidApiLevel("invalid")
+
+// Returns an apiLevel object at the same level as InvalidApiLevel.
+// The object contains the raw string provied in bp file, and can be used for error handling.
+func NewInvalidApiLevel(raw string) ApiLevel {
+ return ApiLevel{
+ value: raw,
+ number: -2, // One less than NoneApiLevel
+ isPreview: true,
+ }
+}
+
// The first version that introduced 64-bit ABIs.
var FirstLp64Version = uncheckedFinalApiLevel(21)
diff --git a/android/bazel.go b/android/bazel.go
index 782632b..1646883 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -357,6 +357,8 @@
mixedBuildEnabled := ctx.Config().IsMixedBuildsEnabled() &&
ctx.Os() != Windows && // Windows toolchains are not currently supported.
ctx.Os() != LinuxBionic && // Linux Bionic toolchains are not currently supported.
+ ctx.Os() != LinuxMusl && // Linux musl toolchains are not currently supported (b/259266326).
+ ctx.Arch().ArchType != Riscv64 && // TODO(b/262192655) Riscv64 toolchains are not currently supported.
module.Enabled() &&
convertedToBazel(ctx, module) &&
ctx.Config().BazelContext.IsModuleNameAllowed(module.Name(), withinApex)
diff --git a/android/config.go b/android/config.go
index 292fcf2..593812c 100644
--- a/android/config.go
+++ b/android/config.go
@@ -52,6 +52,15 @@
// FutureApiLevelInt is a placeholder constant for unreleased API levels.
const FutureApiLevelInt = 10000
+// PrivateApiLevel represents the api level of SdkSpecPrivate (sdk_version: "")
+// This api_level exists to differentiate user-provided "" from "current" sdk_version
+// The differentiation is necessary to enable different validation rules for these two possible values.
+var PrivateApiLevel = ApiLevel{
+ value: "current", // The value is current since aidl expects `current` as the default (TestAidlFlagsWithMinSdkVersion)
+ number: FutureApiLevelInt + 1, // This is used to differentiate it from FutureApiLevel
+ isPreview: true,
+}
+
// FutureApiLevel represents unreleased API levels.
var FutureApiLevel = ApiLevel{
value: "current",
diff --git a/android/sdk_version.go b/android/sdk_version.go
index cace88a..ab6e4f7 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -221,14 +221,7 @@
if ctx.DeviceSpecific() || ctx.SocSpecific() {
s = s.ForVendorPartition(ctx)
}
- if !s.ApiLevel.IsPreview() {
- return s.ApiLevel, nil
- }
- ret := ctx.Config().DefaultAppTargetSdk(ctx)
- if ret.IsPreview() {
- return FutureApiLevel, nil
- }
- return ret, nil
+ return s.ApiLevel.EffectiveVersion(ctx)
}
// EffectiveVersionString converts an SdkSpec into the concrete version string that the module
@@ -242,37 +235,12 @@
if ctx.DeviceSpecific() || ctx.SocSpecific() {
s = s.ForVendorPartition(ctx)
}
- if !s.ApiLevel.IsPreview() {
- return s.ApiLevel.String(), nil
- }
- // Determine the default sdk
- ret := ctx.Config().DefaultAppTargetSdk(ctx)
- if !ret.IsPreview() {
- // If the default sdk has been finalized, return that
- return ret.String(), nil
- }
- // There can be more than one active in-development sdks
- // If an app is targeting an active sdk, but not the default one, return the requested active sdk.
- // e.g.
- // SETUP
- // In-development: UpsideDownCake, VanillaIceCream
- // Default: VanillaIceCream
- // Android.bp
- // min_sdk_version: `UpsideDownCake`
- // RETURN
- // UpsideDownCake and not VanillaIceCream
- for _, preview := range ctx.Config().PreviewApiLevels() {
- if s.ApiLevel.String() == preview.String() {
- return preview.String(), nil
- }
- }
- // Otherwise return the default one
- return ret.String(), nil
+ return s.ApiLevel.EffectiveVersionString(ctx)
}
var (
SdkSpecNone = SdkSpec{SdkNone, NoneApiLevel, "(no version)"}
- SdkSpecPrivate = SdkSpec{SdkPrivate, FutureApiLevel, ""}
+ SdkSpecPrivate = SdkSpec{SdkPrivate, PrivateApiLevel, ""}
SdkSpecCorePlatform = SdkSpec{SdkCorePlatform, FutureApiLevel, "core_platform"}
)
@@ -295,7 +263,7 @@
var kindString string
if sep == 0 {
- return SdkSpec{SdkInvalid, NoneApiLevel, str}
+ return SdkSpec{SdkInvalid, NewInvalidApiLevel(str), str}
} else if sep == -1 {
kindString = ""
} else {
@@ -323,7 +291,7 @@
apiLevel, err := ApiLevelFromUserWithConfig(config, versionString)
if err != nil {
- return SdkSpec{SdkInvalid, apiLevel, str}
+ return SdkSpec{SdkInvalid, NewInvalidApiLevel(versionString), str}
}
return SdkSpec{kind, apiLevel, str}
}
diff --git a/android/sdk_version_test.go b/android/sdk_version_test.go
index ec81782..ea99c4d 100644
--- a/android/sdk_version_test.go
+++ b/android/sdk_version_test.go
@@ -37,11 +37,11 @@
},
{
input: "_",
- expected: "invalid_(no version)",
+ expected: "invalid__",
},
{
input: "_31",
- expected: "invalid_(no version)",
+ expected: "invalid__31",
},
{
input: "system_R",
diff --git a/apex/apex.go b/apex/apex.go
index 6df9651..957c94b 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -993,6 +993,9 @@
if !useVndk {
mctx.PropertyErrorf("use_vndk_as_stable", "not supported for system/system_ext APEXes")
}
+ if a.minSdkVersionValue(mctx) != "" {
+ mctx.PropertyErrorf("use_vndk_as_stable", "not supported when min_sdk_version is set")
+ }
mctx.VisitDirectDepsWithTag(sharedLibTag, func(dep android.Module) {
if c, ok := dep.(*cc.Module); ok && c.IsVndk() {
mctx.PropertyErrorf("use_vndk_as_stable", "Trying to include a VNDK library(%s) while use_vndk_as_stable is true.", dep.Name())
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e1e508b..c9665a4 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -7880,7 +7880,6 @@
name: "myapex",
key: "myapex.key",
updatable: true,
- min_sdk_version: "current",
use_vndk_as_stable: true,
soc_specific: true,
}
@@ -7893,6 +7892,25 @@
`)
}
+func Test_use_vndk_as_stable_shouldnt_be_used_with_min_sdk_version(t *testing.T) {
+ testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported when min_sdk_version is set`, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: false,
+ min_sdk_version: "29",
+ use_vndk_as_stable: true,
+ vendor: true,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+}
+
func Test_use_vndk_as_stable_shouldnt_be_used_for_non_vendor_apexes(t *testing.T) {
testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported for system/system_ext APEXes`, `
apex {
diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go
index f74c519..bf3a6b5 100644
--- a/bazel/cquery/request_type.go
+++ b/bazel/cquery/request_type.go
@@ -335,7 +335,7 @@
unstripped_tag = "//build/bazel/rules/cc:stripped_cc_common.bzl%CcUnstrippedInfo"
if unstripped_tag in p:
unstripped_info = p[unstripped_tag]
- unstripped = unstripped_info.unstripped.files.to_list()[0].path
+ unstripped = unstripped_info.unstripped[0].files.to_list()[0].path
local_static_libs = []
local_whole_static_libs = []
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 7ea1c1c..48e93cd 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -3591,42 +3591,57 @@
})
}
-func TestCcLibraryWithAidlAndSharedLibs(t *testing.T) {
+func TestCcLibraryWithAidlAndLibs(t *testing.T) {
runCcLibraryTestCase(t, Bp2buildTestCase{
- Description: "cc_aidl_library depends on shared libs from parent cc_library_static",
+ Description: "cc_aidl_library depends on libs from parent cc_library_static",
ModuleTypeUnderTest: "cc_library",
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Blueprint: `
cc_library_static {
- name: "foo",
- srcs: [
- "Foo.aidl",
- ],
+ name: "foo",
+ srcs: [
+ "Foo.aidl",
+ ],
+ static_libs: [
+ "bar-static",
+ "baz-static",
+ ],
shared_libs: [
- "bar",
- "baz",
+ "bar-shared",
+ "baz-shared",
+ ],
+ export_static_lib_headers: [
+ "baz-static",
],
export_shared_lib_headers: [
- "baz",
+ "baz-shared",
],
}` +
- simpleModuleDoNotConvertBp2build("cc_library", "bar") +
- simpleModuleDoNotConvertBp2build("cc_library", "baz"),
+ simpleModuleDoNotConvertBp2build("cc_library_static", "bar-static") +
+ simpleModuleDoNotConvertBp2build("cc_library_static", "baz-static") +
+ simpleModuleDoNotConvertBp2build("cc_library", "bar-shared") +
+ simpleModuleDoNotConvertBp2build("cc_library", "baz-shared"),
ExpectedBazelTargets: []string{
MakeBazelTarget("aidl_library", "foo_aidl_library", AttrNameToString{
"srcs": `["Foo.aidl"]`,
}),
MakeBazelTarget("cc_aidl_library", "foo_cc_aidl_library", AttrNameToString{
"deps": `[":foo_aidl_library"]`,
+ "implementation_deps": `[
+ ":baz-static",
+ ":bar-static",
+ ]`,
"implementation_dynamic_deps": `[
- ":baz",
- ":bar",
+ ":baz-shared",
+ ":bar-shared",
]`,
}),
MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
- "dynamic_deps": `[":baz"]`,
- "implementation_dynamic_deps": `[":bar"]`,
+ "deps": `[":baz-static"]`,
+ "implementation_deps": `[":bar-static"]`,
+ "dynamic_deps": `[":baz-shared"]`,
+ "implementation_dynamic_deps": `[":bar-shared"]`,
"local_includes": `["."]`,
}),
},
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 67a697a..03d9de8 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -917,15 +917,12 @@
if !aidlLibs.IsEmpty() {
ccAidlLibrarylabel := m.Name() + "_cc_aidl_library"
- // Since cc_aidl_library only needs the dynamic deps (aka shared libs) from the parent cc library for compiling,
- // we err on the side of not re-exporting the headers of the dynamic deps from cc_aidl_lirary
- // because the parent cc library already has all the dynamic deps
- implementationDynamicDeps := bazel.MakeLabelListAttribute(
- bazel.AppendBazelLabelLists(
- linkerAttrs.dynamicDeps.Value,
- linkerAttrs.implementationDynamicDeps.Value,
- ),
- )
+ // Since parent cc_library already has these dependencies, we can add them as implementation
+ // deps so that they don't re-export
+ implementationDeps := linkerAttrs.deps.Clone()
+ implementationDeps.Append(linkerAttrs.implementationDeps)
+ implementationDynamicDeps := linkerAttrs.dynamicDeps.Clone()
+ implementationDynamicDeps.Append(linkerAttrs.implementationDynamicDeps)
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
@@ -935,7 +932,8 @@
android.CommonAttributes{Name: ccAidlLibrarylabel},
&ccAidlLibraryAttributes{
Deps: aidlLibs,
- Implementation_dynamic_deps: implementationDynamicDeps,
+ Implementation_deps: *implementationDeps,
+ Implementation_dynamic_deps: *implementationDynamicDeps,
},
)
label := &bazel.LabelAttribute{
diff --git a/cc/library.go b/cc/library.go
index 68de233..1b579cd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -268,6 +268,7 @@
type ccAidlLibraryAttributes struct {
Deps bazel.LabelListAttribute
+ Implementation_deps bazel.LabelListAttribute
Implementation_dynamic_deps bazel.LabelListAttribute
}
diff --git a/java/lint.go b/java/lint.go
index 58b43df..40ef484 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -496,7 +496,6 @@
FlagWithArg("--java-language-level ", l.javaLanguageLevel).
FlagWithArg("--kotlin-language-level ", l.kotlinLanguageLevel).
FlagWithArg("--url ", fmt.Sprintf(".=.,%s=out", android.PathForOutput(ctx).String())).
- Flag("--exitcode").
Flag("--apply-suggestions"). // applies suggested fixes to files in the sandbox
Flags(l.properties.Lint.Flags).
Implicit(annotationsZipPath).
@@ -505,6 +504,10 @@
rule.Temporary(lintPaths.projectXML)
rule.Temporary(lintPaths.configXML)
+ if exitCode := ctx.Config().Getenv("ANDROID_LINT_SUPPRESS_EXIT_CODE"); exitCode == "" {
+ cmd.Flag("--exitcode")
+ }
+
if checkOnly := ctx.Config().Getenv("ANDROID_LINT_CHECK"); checkOnly != "" {
cmd.FlagWithArg("--check ", checkOnly)
}
diff --git a/python/scripts/stub_template_host.txt b/python/scripts/stub_template_host.txt
index 5eedc18..2d1bd4a 100644
--- a/python/scripts/stub_template_host.txt
+++ b/python/scripts/stub_template_host.txt
@@ -3,6 +3,7 @@
import os
import tempfile
import shutil
+import signal
import sys
import subprocess
import zipfile
@@ -43,7 +44,18 @@
sys.stdout.flush()
# close_fds=False so that you can run binaries with files provided on the command line:
# my_python_app --file <(echo foo)
- sys.exit(subprocess.call(args, close_fds=False))
+ p = subprocess.Popen(args, close_fds=False)
+
+ def handler(sig, frame):
+ p.send_signal(sig)
+
+ # Redirect SIGINT and SIGTERM to subprocess
+ signal.signal(signal.SIGINT, handler)
+ signal.signal(signal.SIGTERM, handler)
+
+ p.wait()
+
+ sys.exit(p.returncode)
finally:
shutil.rmtree(runfiles_path, ignore_errors=True)