summaryrefslogtreecommitdiff
path: root/sysprop
diff options
context:
space:
mode:
Diffstat (limited to 'sysprop')
-rw-r--r--sysprop/Android.bp3
-rw-r--r--sysprop/bp2build/Android.bp16
-rw-r--r--sysprop/bp2build/bp2build.go106
-rw-r--r--sysprop/sysprop_library.go56
-rw-r--r--sysprop/sysprop_library_conversion_test.go195
5 files changed, 0 insertions, 376 deletions
diff --git a/sysprop/Android.bp b/sysprop/Android.bp
index 7f5100091..1d5eb3130 100644
--- a/sysprop/Android.bp
+++ b/sysprop/Android.bp
@@ -9,10 +9,8 @@ bootstrap_go_package {
"blueprint",
"soong",
"soong-android",
- "soong-bp2build",
"soong-cc",
"soong-java",
- "soong-sysprop-bp2build",
],
srcs: [
"sysprop_library.go",
@@ -20,7 +18,6 @@ bootstrap_go_package {
],
testSrcs: [
"sysprop_test.go",
- "sysprop_library_conversion_test.go",
],
pluginFor: ["soong_build"],
}
diff --git a/sysprop/bp2build/Android.bp b/sysprop/bp2build/Android.bp
deleted file mode 100644
index 1b9eda83e..000000000
--- a/sysprop/bp2build/Android.bp
+++ /dev/null
@@ -1,16 +0,0 @@
-package {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-bootstrap_go_package {
- name: "soong-sysprop-bp2build",
- pkgPath: "android/soong/sysprop/bp2build",
- deps: [
- "soong-android",
- "soong-bazel",
- ],
- srcs: [
- "bp2build.go",
- ],
- pluginFor: ["soong_build"],
-}
diff --git a/sysprop/bp2build/bp2build.go b/sysprop/bp2build/bp2build.go
deleted file mode 100644
index 18991de60..000000000
--- a/sysprop/bp2build/bp2build.go
+++ /dev/null
@@ -1,106 +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 bp2build
-
-import (
- "android/soong/android"
- "android/soong/bazel"
-)
-
-type SyspropLibraryLabels struct {
- SyspropLibraryLabel string
- CcSharedLibraryLabel string
- CcStaticLibraryLabel string
- JavaLibraryLabel string
-}
-
-// TODO(b/240463568): Additional properties will be added for API validation
-type bazelSyspropLibraryAttributes struct {
- Srcs bazel.LabelListAttribute
- Tags bazel.StringListAttribute
-}
-
-func Bp2buildBaseSyspropLibrary(ctx android.Bp2buildMutatorContext, name string, srcs bazel.LabelListAttribute) {
- apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx.(android.Bp2buildMutatorContext), ctx.Module())
-
- ctx.CreateBazelTargetModule(
- bazel.BazelTargetModuleProperties{
- Rule_class: "sysprop_library",
- Bzl_load_location: "//build/bazel/rules/sysprop:sysprop_library.bzl",
- },
- android.CommonAttributes{Name: name},
- &bazelSyspropLibraryAttributes{
- Srcs: srcs,
- Tags: apexAvailableTags,
- },
- )
-}
-
-type bazelCcSyspropLibraryAttributes struct {
- Dep bazel.LabelAttribute
- Min_sdk_version *string
- Tags bazel.StringListAttribute
-}
-
-func Bp2buildSyspropCc(ctx android.Bp2buildMutatorContext, labels SyspropLibraryLabels, minSdkVersion *string) {
- apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx.(android.Bp2buildMutatorContext), ctx.Module())
-
- attrs := &bazelCcSyspropLibraryAttributes{
- Dep: *bazel.MakeLabelAttribute(":" + labels.SyspropLibraryLabel),
- Min_sdk_version: minSdkVersion,
- Tags: apexAvailableTags,
- }
-
- if labels.CcSharedLibraryLabel != "" {
- ctx.CreateBazelTargetModule(
- bazel.BazelTargetModuleProperties{
- Rule_class: "cc_sysprop_library_shared",
- Bzl_load_location: "//build/bazel/rules/cc:cc_sysprop_library.bzl",
- },
- android.CommonAttributes{Name: labels.CcSharedLibraryLabel},
- attrs)
- }
- if labels.CcStaticLibraryLabel != "" {
- ctx.CreateBazelTargetModule(
- bazel.BazelTargetModuleProperties{
- Rule_class: "cc_sysprop_library_static",
- Bzl_load_location: "//build/bazel/rules/cc:cc_sysprop_library.bzl",
- },
- android.CommonAttributes{Name: labels.CcStaticLibraryLabel},
- attrs)
- }
-}
-
-type bazelJavaLibraryAttributes struct {
- Dep bazel.LabelAttribute
- Min_sdk_version *string
- Tags bazel.StringListAttribute
-}
-
-func Bp2buildSyspropJava(ctx android.Bp2buildMutatorContext, labels SyspropLibraryLabels, minSdkVersion *string) {
- apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx.(android.Bp2buildMutatorContext), ctx.Module())
-
- ctx.CreateBazelTargetModule(
- bazel.BazelTargetModuleProperties{
- Rule_class: "java_sysprop_library",
- Bzl_load_location: "//build/bazel/rules/java:java_sysprop_library.bzl",
- },
- android.CommonAttributes{Name: labels.JavaLibraryLabel},
- &bazelJavaLibraryAttributes{
- Dep: *bazel.MakeLabelAttribute(":" + labels.SyspropLibraryLabel),
- Min_sdk_version: minSdkVersion,
- Tags: apexAvailableTags,
- })
-}
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 013624fc4..c89c6b09f 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -23,10 +23,6 @@ import (
"path"
"sync"
- "android/soong/bazel"
- "android/soong/sysprop/bp2build"
- "android/soong/ui/metrics/bp2build_metrics_proto"
-
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -129,7 +125,6 @@ func syspropJavaGenFactory() android.Module {
type syspropLibrary struct {
android.ModuleBase
android.ApexModuleBase
- android.BazelModuleBase
properties syspropLibraryProperties
@@ -238,10 +233,6 @@ func (m *syspropLibrary) javaGenPublicStubName() string {
return m.BaseModuleName() + "_java_gen_public"
}
-func (m *syspropLibrary) bp2buildJavaImplementationModuleName() string {
- return m.BaseModuleName() + "_java_library"
-}
-
func (m *syspropLibrary) BaseModuleName() string {
return m.ModuleBase.Name()
}
@@ -390,7 +381,6 @@ func syspropLibraryFactory() android.Module {
)
android.InitAndroidModule(m)
android.InitApexModule(m)
- android.InitBazelModule(m)
android.AddLoadHook(m, func(ctx android.LoadHookContext) { syspropLibraryHook(ctx, m) })
return m
}
@@ -424,9 +414,6 @@ type ccLibraryProperties struct {
Min_sdk_version *string
Cflags []string
Ldflags []string
- Bazel_module struct {
- Label *string
- }
}
type javaLibraryProperties struct {
@@ -443,10 +430,6 @@ type javaLibraryProperties struct {
SyspropPublicStub string
Apex_available []string
Min_sdk_version *string
- Bazel_module struct {
- Bp2build_available *bool
- Label *string
- }
}
func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
@@ -492,14 +475,6 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
"Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner())
}
- var label *string
- if b, ok := ctx.Module().(android.Bazelable); ok && b.ShouldConvertWithBp2build(ctx) {
- // TODO: b/295566168 - this will need to change once build files are checked in to account for
- // checked in modules in mixed builds
- label = proptools.StringPtr(
- fmt.Sprintf("//%s:%s", ctx.ModuleDir(), m.CcImplementationModuleName()))
- }
-
// Generate a C++ implementation library.
// cc_library can receive *.sysprop files as their srcs, generating sources itself.
ccProps := ccLibraryProperties{}
@@ -521,7 +496,6 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
ccProps.Min_sdk_version = m.properties.Cpp.Min_sdk_version
ccProps.Cflags = m.properties.Cpp.Cflags
ccProps.Ldflags = m.properties.Cpp.Ldflags
- ccProps.Bazel_module.Label = label
ctx.CreateModule(cc.LibraryFactory, &ccProps)
scope := "internal"
@@ -566,13 +540,6 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
SyspropPublicStub: publicStub,
Apex_available: m.ApexProperties.Apex_available,
Min_sdk_version: m.properties.Java.Min_sdk_version,
- Bazel_module: struct {
- Bp2build_available *bool
- Label *string
- }{
- Label: proptools.StringPtr(
- fmt.Sprintf("//%s:%s", ctx.ModuleDir(), m.bp2buildJavaImplementationModuleName())),
- },
})
if publicStub != "" {
@@ -590,12 +557,6 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
Sdk_version: proptools.StringPtr("core_current"),
Libs: []string{javaSyspropStub},
Stem: proptools.StringPtr(m.BaseModuleName()),
- Bazel_module: struct {
- Bp2build_available *bool
- Label *string
- }{
- Bp2build_available: proptools.BoolPtr(false),
- },
})
}
@@ -609,20 +570,3 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
*libraries = append(*libraries, "//"+ctx.ModuleDir()+":"+ctx.ModuleName())
}
}
-
-// TODO(b/240463568): Additional properties will be added for API validation
-func (m *syspropLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
- if m.Owner() != "Platform" {
- ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_UNSUPPORTED, "Only sysprop libraries owned by platform are supported at this time")
- return
- }
- labels := bp2build.SyspropLibraryLabels{
- SyspropLibraryLabel: m.BaseModuleName(),
- CcSharedLibraryLabel: m.CcImplementationModuleName(),
- CcStaticLibraryLabel: cc.BazelLabelNameForStaticModule(m.CcImplementationModuleName()),
- JavaLibraryLabel: m.bp2buildJavaImplementationModuleName(),
- }
- bp2build.Bp2buildBaseSyspropLibrary(ctx, labels.SyspropLibraryLabel, bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.properties.Srcs)))
- bp2build.Bp2buildSyspropCc(ctx, labels, m.properties.Cpp.Min_sdk_version)
- bp2build.Bp2buildSyspropJava(ctx, labels, m.properties.Java.Min_sdk_version)
-}
diff --git a/sysprop/sysprop_library_conversion_test.go b/sysprop/sysprop_library_conversion_test.go
deleted file mode 100644
index dabcc927b..000000000
--- a/sysprop/sysprop_library_conversion_test.go
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright 2022 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 sysprop
-
-import (
- "testing"
-
- "android/soong/bp2build"
-)
-
-func TestSyspropLibrarySimple(t *testing.T) {
- bp2build.RunBp2BuildTestCaseSimple(t, bp2build.Bp2buildTestCase{
- Description: "sysprop_library simple",
- ModuleTypeUnderTest: "sysprop_library",
- ModuleTypeUnderTestFactory: syspropLibraryFactory,
- Filesystem: map[string]string{
- "foo.sysprop": "",
- "bar.sysprop": "",
- },
- Blueprint: `
-sysprop_library {
- name: "sysprop_foo",
- srcs: [
- "foo.sysprop",
- "bar.sysprop",
- ],
- property_owner: "Platform",
-}
-`,
- ExpectedBazelTargets: []string{
- bp2build.MakeBazelTargetNoRestrictions("sysprop_library",
- "sysprop_foo",
- bp2build.AttrNameToString{
- "srcs": `[
- "foo.sysprop",
- "bar.sysprop",
- ]`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("cc_sysprop_library_shared",
- "libsysprop_foo",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("cc_sysprop_library_static",
- "libsysprop_foo_bp2build_cc_library_static",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("java_sysprop_library",
- "sysprop_foo_java_library",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- }),
- },
- })
-}
-
-func TestSyspropLibraryCppMinSdkVersion(t *testing.T) {
- bp2build.RunBp2BuildTestCaseSimple(t, bp2build.Bp2buildTestCase{
- Description: "sysprop_library with cpp min_sdk_version",
- ModuleTypeUnderTest: "sysprop_library",
- ModuleTypeUnderTestFactory: syspropLibraryFactory,
- Filesystem: map[string]string{
- "foo.sysprop": "",
- "bar.sysprop": "",
- },
- Blueprint: `
-sysprop_library {
- name: "sysprop_foo",
- srcs: [
- "foo.sysprop",
- "bar.sysprop",
- ],
- cpp: {
- min_sdk_version: "5",
- },
- property_owner: "Platform",
-}
-`,
- ExpectedBazelTargets: []string{
- bp2build.MakeBazelTargetNoRestrictions("sysprop_library",
- "sysprop_foo",
- bp2build.AttrNameToString{
- "srcs": `[
- "foo.sysprop",
- "bar.sysprop",
- ]`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("cc_sysprop_library_shared",
- "libsysprop_foo",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- "min_sdk_version": `"5"`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("cc_sysprop_library_static",
- "libsysprop_foo_bp2build_cc_library_static",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- "min_sdk_version": `"5"`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("java_sysprop_library",
- "sysprop_foo_java_library",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- }),
- },
- })
-}
-
-func TestSyspropLibraryJavaMinSdkVersion(t *testing.T) {
- bp2build.RunBp2BuildTestCaseSimple(t, bp2build.Bp2buildTestCase{
- Description: "sysprop_library with java min_sdk_version",
- ModuleTypeUnderTest: "sysprop_library",
- ModuleTypeUnderTestFactory: syspropLibraryFactory,
- Filesystem: map[string]string{
- "foo.sysprop": "",
- "bar.sysprop": "",
- },
- Blueprint: `
-sysprop_library {
- name: "sysprop_foo",
- srcs: [
- "foo.sysprop",
- "bar.sysprop",
- ],
- java: {
- min_sdk_version: "5",
- },
- property_owner: "Platform",
-}
-`,
- ExpectedBazelTargets: []string{
- bp2build.MakeBazelTargetNoRestrictions("sysprop_library",
- "sysprop_foo",
- bp2build.AttrNameToString{
- "srcs": `[
- "foo.sysprop",
- "bar.sysprop",
- ]`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("cc_sysprop_library_shared",
- "libsysprop_foo",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("cc_sysprop_library_static",
- "libsysprop_foo_bp2build_cc_library_static",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- }),
- bp2build.MakeBazelTargetNoRestrictions("java_sysprop_library",
- "sysprop_foo_java_library",
- bp2build.AttrNameToString{
- "dep": `":sysprop_foo"`,
- "min_sdk_version": `"5"`,
- }),
- },
- })
-}
-
-func TestSyspropLibraryOwnerNotPlatformUnconvertible(t *testing.T) {
- bp2build.RunBp2BuildTestCaseSimple(t, bp2build.Bp2buildTestCase{
- Description: "sysprop_library simple",
- ModuleTypeUnderTest: "sysprop_library",
- ModuleTypeUnderTestFactory: syspropLibraryFactory,
- Filesystem: map[string]string{
- "foo.sysprop": "",
- "bar.sysprop": "",
- },
- Blueprint: `
-sysprop_library {
- name: "sysprop_foo",
- srcs: [
- "foo.sysprop",
- "bar.sysprop",
- ],
- property_owner: "Vendor",
- device_specific: true,
-}
-`,
- ExpectedBazelTargets: []string{},
- })
-}