Merge "Handle target.bionic in bp2build."
diff --git a/android/arch.go b/android/arch.go
index 340f136..cc70eee 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -1987,6 +1987,10 @@
 	axisToProps[bazel.OsConfigurationAxis] = osToProp
 	axisToProps[bazel.OsArchConfigurationAxis] = archOsToProp
 
+	axisToProps[bazel.BionicConfigurationAxis] = map[string]interface{}{
+		"bionic": getTargetStruct(ctx, propertySet, archProperties, "Bionic"),
+	}
+
 	return axisToProps
 }
 
diff --git a/bazel/configurability.go b/bazel/configurability.go
index 282c606..35f194d 100644
--- a/bazel/configurability.go
+++ b/bazel/configurability.go
@@ -91,6 +91,11 @@
 		conditionsDefault: ConditionsDefaultSelectKey, // The default condition of an os select map.
 	}
 
+	platformBionicMap = map[string]string{
+		"bionic":          "//build/bazel/platforms/os:bionic",
+		conditionsDefault: ConditionsDefaultSelectKey, // The default condition of an os select map.
+	}
+
 	platformOsArchMap = map[string]string{
 		osArchAndroidArm:        "//build/bazel/platforms/os_arch:android_arm",
 		osArchAndroidArm64:      "//build/bazel/platforms/os_arch:android_arm64",
@@ -117,6 +122,7 @@
 	arch
 	os
 	osArch
+	bionic
 	productVariables
 )
 
@@ -126,6 +132,7 @@
 		arch:             "arch",
 		os:               "os",
 		osArch:           "arch_os",
+		bionic:           "bionic",
 		productVariables: "product_variables",
 	}[ct]
 }
@@ -148,6 +155,10 @@
 		if _, ok := platformOsArchMap[config]; !ok {
 			panic(fmt.Errorf("Unknown os+arch: %s", config))
 		}
+	case bionic:
+		if _, ok := platformBionicMap[config]; !ok {
+			panic(fmt.Errorf("Unknown for %s: %s", ct.String(), config))
+		}
 	case productVariables:
 		// do nothing
 	default:
@@ -167,6 +178,8 @@
 		return platformOsMap[config]
 	case osArch:
 		return platformOsArchMap[config]
+	case bionic:
+		return platformBionicMap[config]
 	case productVariables:
 		if config == conditionsDefault {
 			return ConditionsDefaultSelectKey
@@ -186,6 +199,8 @@
 	OsConfigurationAxis = ConfigurationAxis{configurationType: os}
 	// An axis for arch+os-specific configurations
 	OsArchConfigurationAxis = ConfigurationAxis{configurationType: osArch}
+	// An axis for bionic os-specific configurations
+	BionicConfigurationAxis = ConfigurationAxis{configurationType: bionic}
 )
 
 // ProductVariableConfigurationAxis returns an axis for the given product variable
diff --git a/bazel/properties.go b/bazel/properties.go
index 7ecc92b..2656bad 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -321,7 +321,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		la.Value = &value
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		if la.ConfigurableValues == nil {
 			la.ConfigurableValues = make(configurableLabels)
 		}
@@ -337,7 +337,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		return *la.Value
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		return *la.ConfigurableValues[axis][config]
 	default:
 		panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
@@ -394,7 +394,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		ba.Value = value
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		if ba.ConfigurableValues == nil {
 			ba.ConfigurableValues = make(configurableBools)
 		}
@@ -410,7 +410,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		return ba.Value
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		if v, ok := ba.ConfigurableValues[axis][config]; ok {
 			return &v
 		} else {
@@ -509,7 +509,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		lla.Value = list
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		if lla.ConfigurableValues == nil {
 			lla.ConfigurableValues = make(configurableLabelLists)
 		}
@@ -525,7 +525,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		return lla.Value
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		return lla.ConfigurableValues[axis][config]
 	default:
 		panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
@@ -682,7 +682,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		sla.Value = list
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		if sla.ConfigurableValues == nil {
 			sla.ConfigurableValues = make(configurableStringLists)
 		}
@@ -698,7 +698,7 @@
 	switch axis.configurationType {
 	case noConfig:
 		return sla.Value
-	case arch, os, osArch, productVariables:
+	case arch, os, osArch, bionic, productVariables:
 		return sla.ConfigurableValues[axis][config]
 	default:
 		panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 4f720f5..662d9d1 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -118,6 +118,7 @@
 		moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryBp2Build,
 		filesystem: map[string]string{
 			"android.cpp": "",
+			"bionic.cpp":  "",
 			"darwin.cpp":  "",
 			// Refer to cc.headerExts for the supported header extensions in Soong.
 			"header.h":         "",
@@ -164,6 +165,9 @@
         darwin: {
             srcs: ["darwin.cpp"],
         },
+        bionic: {
+          srcs: ["bionic.cpp"]
+        },
     },
 }
 `,
@@ -190,6 +194,9 @@
         "//build/bazel/platforms/os:darwin": ["darwin.cpp"],
         "//build/bazel/platforms/os:linux": ["linux.cpp"],
         "//conditions:default": [],
+    }) + select({
+        "//build/bazel/platforms/os:bionic": ["bionic.cpp"],
+        "//conditions:default": [],
     }),
 )`}})
 }