Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a72573a7 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Remove ConvertWithBp2build implementations" into main

parents b49f0382 8ff10586
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ bootstrap_go_package {
        "sbox_proto",
        "soong",
        "soong-android",
        "soong-bazel",
    ],
    srcs: [
        "aconfig_declarations.go",
+0 −26
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import (
	"strings"

	"android/soong/android"
	"android/soong/bazel"

	"github.com/google/blueprint"
)
@@ -27,7 +26,6 @@ import (
type DeclarationsModule struct {
	android.ModuleBase
	android.DefaultableModuleBase
	android.BazelModuleBase

	// Properties for "aconfig_declarations"
	properties struct {
@@ -53,7 +51,6 @@ func DeclarationsFactory() android.Module {
	android.InitAndroidModule(module)
	android.InitDefaultableModule(module)
	module.AddProperties(&module.properties)
	android.InitBazelModule(module)

	return module
}
@@ -232,26 +229,3 @@ func mergeAconfigFiles(ctx android.ModuleContext, inputs android.Paths) android.

	return android.Paths{output}
}

type bazelAconfigDeclarationsAttributes struct {
	Srcs    bazel.LabelListAttribute
	Package string
}

func (module *DeclarationsModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
	if ctx.ModuleType() != "aconfig_declarations" {
		return
	}
	srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, module.properties.Srcs))

	attrs := bazelAconfigDeclarationsAttributes{
		Srcs:    srcs,
		Package: module.properties.Package,
	}
	props := bazel.BazelTargetModuleProperties{
		Rule_class:        "aconfig_declarations",
		Bzl_load_location: "//build/bazel/rules/aconfig:aconfig_declarations.bzl",
	}

	ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, &attrs)
}
+0 −23
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ package aconfig

import (
	"android/soong/android"
	"android/soong/bazel"
	"github.com/google/blueprint"
)

@@ -24,7 +23,6 @@ import (
type ValueSetModule struct {
	android.ModuleBase
	android.DefaultableModuleBase
	android.BazelModuleBase

	properties struct {
		// aconfig_values modules
@@ -38,7 +36,6 @@ func ValueSetFactory() android.Module {
	android.InitAndroidModule(module)
	android.InitDefaultableModule(module)
	module.AddProperties(&module.properties)
	android.InitBazelModule(module)

	return module
}
@@ -91,23 +88,3 @@ func (module *ValueSetModule) GenerateAndroidBuildActions(ctx android.ModuleCont
		AvailablePackages: packages,
	})
}

type bazelAconfigValueSetAttributes struct {
	Values bazel.LabelListAttribute
}

func (module *ValueSetModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
	if ctx.ModuleType() != "aconfig_value_set" {
		return
	}

	attrs := bazelAconfigValueSetAttributes{
		Values: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, module.properties.Values)),
	}
	props := bazel.BazelTargetModuleProperties{
		Rule_class:        "aconfig_value_set",
		Bzl_load_location: "//build/bazel/rules/aconfig:aconfig_value_set.bzl",
	}

	ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, &attrs)
}
+0 −27
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ package aconfig

import (
	"android/soong/android"
	"android/soong/bazel"
	"github.com/google/blueprint"
)

@@ -24,7 +23,6 @@ import (
type ValuesModule struct {
	android.ModuleBase
	android.DefaultableModuleBase
	android.BazelModuleBase

	properties struct {
		// aconfig files, relative to this Android.bp file
@@ -41,7 +39,6 @@ func ValuesFactory() android.Module {
	android.InitAndroidModule(module)
	android.InitDefaultableModule(module)
	module.AddProperties(&module.properties)
	android.InitBazelModule(module)

	return module
}
@@ -69,27 +66,3 @@ func (module *ValuesModule) GenerateAndroidBuildActions(ctx android.ModuleContex
	}
	ctx.SetProvider(valuesProviderKey, providerData)
}

type bazelAconfigValuesAttributes struct {
	Srcs    bazel.LabelListAttribute
	Package string
}

func (module *ValuesModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
	if ctx.ModuleType() != "aconfig_values" {
		return
	}

	srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, module.properties.Srcs))

	attrs := bazelAconfigValuesAttributes{
		Srcs:    srcs,
		Package: module.properties.Package,
	}
	props := bazel.BazelTargetModuleProperties{
		Rule_class:        "aconfig_values",
		Bzl_load_location: "//build/bazel/rules/aconfig:aconfig_values.bzl",
	}

	ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, &attrs)
}
+0 −39
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package codegen
import (
	"android/soong/aconfig"
	"android/soong/android"
	"android/soong/bazel"
	"android/soong/cc"

	"github.com/google/blueprint"
@@ -144,41 +143,3 @@ func (this *CcAconfigLibraryCallbacks) GeneratorBuildActions(ctx cc.ModuleContex
		},
	})
}

type bazelCcAconfigLibraryAttributes struct {
	cc.SdkAttributes
	Aconfig_declarations bazel.LabelAttribute
	Dynamic_deps         bazel.LabelListAttribute
}

// Convert the cc_aconfig_library module to bazel.
//
// This method is called from cc.ConvertWithBp2build to actually convert the
// cc_aconfig_library module. This is necessary since the factory method of this
// module type returns a cc library and the bp2build conversion is called on the
// cc library type.

func (this *CcAconfigLibraryCallbacks) GeneratorBp2build(ctx android.Bp2buildMutatorContext, module *cc.Module) bool {
	if ctx.ModuleType() != "cc_aconfig_library" {
		return false
	}

	attrs := bazelCcAconfigLibraryAttributes{
		SdkAttributes:        cc.Bp2BuildParseSdkAttributes(module),
		Aconfig_declarations: *bazel.MakeLabelAttribute(android.BazelLabelForModuleDepSingle(ctx, this.properties.Aconfig_declarations).Label),
		Dynamic_deps:         bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, []string{baseLibDep})),
	}
	props := bazel.BazelTargetModuleProperties{
		Rule_class:        "cc_aconfig_library",
		Bzl_load_location: "//build/bazel/rules/cc:cc_aconfig_library.bzl",
	}

	ctx.CreateBazelTargetModule(
		props,
		android.CommonAttributes{
			Name: ctx.ModuleName(),
			Tags: android.ApexAvailableTagsWithoutTestApexes(ctx, module),
		},
		&attrs)
	return true
}
Loading