bp2build: add support for soong_config_module_type.
Test: CI, go unit test Bug: 198556411 Change-Id: Idf862904d51d822f92af0c072341c31b7a02fc64
This commit is contained in:
@@ -158,9 +158,9 @@ func (ct configurationType) validateConfig(config string) {
|
||||
}
|
||||
|
||||
// SelectKey returns the Bazel select key for a given configurationType and config string.
|
||||
func (ct configurationType) SelectKey(config string) string {
|
||||
ct.validateConfig(config)
|
||||
switch ct {
|
||||
func (ca ConfigurationAxis) SelectKey(config string) string {
|
||||
ca.validateConfig(config)
|
||||
switch ca.configurationType {
|
||||
case noConfig:
|
||||
panic(fmt.Errorf("SelectKey is unnecessary for noConfig ConfigurationType "))
|
||||
case arch:
|
||||
@@ -170,12 +170,13 @@ func (ct configurationType) SelectKey(config string) string {
|
||||
case osArch:
|
||||
return platformOsArchMap[config]
|
||||
case productVariables:
|
||||
if config == ConditionsDefaultConfigKey {
|
||||
if strings.HasSuffix(config, ConditionsDefaultConfigKey) {
|
||||
// e.g. "acme__feature1__conditions_default" or "android__board__conditions_default"
|
||||
return ConditionsDefaultSelectKey
|
||||
}
|
||||
return fmt.Sprintf("%s:%s", productVariableBazelPackage, strings.ToLower(config))
|
||||
return fmt.Sprintf("%s:%s", productVariableBazelPackage, config)
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ct))
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ca.configurationType))
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,23 @@ import (
|
||||
"github.com/google/blueprint"
|
||||
)
|
||||
|
||||
type BazelModuleProperties struct {
|
||||
// The label of the Bazel target replacing this Soong module. When run in conversion mode, this
|
||||
// will import the handcrafted build target into the autogenerated file. Note: this may result in
|
||||
// a conflict due to duplicate targets if bp2build_available is also set.
|
||||
Label *string
|
||||
|
||||
// If true, bp2build will generate the converted Bazel target for this module. Note: this may
|
||||
// cause a conflict due to the duplicate targets if label is also set.
|
||||
//
|
||||
// This is a bool pointer to support tristates: true, false, not set.
|
||||
//
|
||||
// To opt-in a module, set bazel_module: { bp2build_available: true }
|
||||
// To opt-out a module, set bazel_module: { bp2build_available: false }
|
||||
// To defer the default setting for the directory, do not set the value.
|
||||
Bp2build_available *bool
|
||||
}
|
||||
|
||||
// BazelTargetModuleProperties contain properties and metadata used for
|
||||
// Blueprint to BUILD file conversion.
|
||||
type BazelTargetModuleProperties struct {
|
||||
|
Reference in New Issue
Block a user