bp2build: Handle target.linux

Also refactor target.bionic to be handled not as its own configuration
axis, but instead to be grouped into os selects handling.

This allows us to remove libbase and its dependencies from the bp2build
denylist.

Test: mixed_droid.sh CI
Change-Id: I92f30074d286306207653fe37589835ae3db16c4
diff --git a/android/arch.go b/android/arch.go
index 273c02b..54242e5 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -2005,16 +2005,37 @@
 
 	osToProp := ArchVariantProperties{}
 	archOsToProp := ArchVariantProperties{}
+
+	var linuxStructs, bionicStructs []reflect.Value
+	var ok bool
+
+	linuxStructs, ok = getTargetStructs(ctx, archProperties, "Linux")
+	if !ok {
+		linuxStructs = make([]reflect.Value, 0)
+	}
+	bionicStructs, ok = getTargetStructs(ctx, archProperties, "Bionic")
+	if !ok {
+		bionicStructs = make([]reflect.Value, 0)
+	}
+
 	// For android, linux, ...
 	for _, os := range osTypeList {
 		if os == CommonOS {
 			// It looks like this OS value is not used in Blueprint files
 			continue
 		}
-		osStructs, ok := getTargetStructs(ctx, archProperties, os.Field)
+		osStructs := make([]reflect.Value, 0)
+		osSpecificStructs, ok := getTargetStructs(ctx, archProperties, os.Field)
 		if ok {
-			osToProp[os.Name] = mergeStructs(ctx, osStructs, propertySet)
+			osStructs = append(osStructs, osSpecificStructs...)
 		}
+		if os.Linux() {
+			osStructs = append(osStructs, linuxStructs...)
+		}
+		if os.Bionic() {
+			osStructs = append(osStructs, bionicStructs...)
+		}
+		osToProp[os.Name] = mergeStructs(ctx, osStructs, propertySet)
 
 		// For arm, x86, ...
 		for _, arch := range osArchTypeMap[os] {
@@ -2048,15 +2069,9 @@
 			archOsToProp[targetName] = mergeStructs(ctx, osArchStructs, propertySet)
 		}
 	}
+
 	axisToProps[bazel.OsConfigurationAxis] = osToProp
 	axisToProps[bazel.OsArchConfigurationAxis] = archOsToProp
-
-	bionicStructs, ok := getTargetStructs(ctx, archProperties, "Bionic")
-	if ok {
-		axisToProps[bazel.BionicConfigurationAxis] = map[string]interface{}{
-			"bionic": mergeStructs(ctx, bionicStructs, propertySet)}
-	}
-
 	return axisToProps
 }
 
diff --git a/android/bazel.go b/android/bazel.go
index 53e6060..1c943fa 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -223,9 +223,6 @@
 		"libc_malloc_debug",           // http://b/186824339, cc_library_static, depends on //system/libbase:libbase (http://b/186823646)
 		"libc_malloc_debug_backtrace", // http://b/186824112, cc_library_static, depends on //external/libcxxabi:libc++demangle (http://b/186823773)
 
-		//"libcutils",         // http://b/186827426, cc_library, depends on //system/core/libprocessgroup:libprocessgroup_headers (http://b/186826841)
-		//"libcutils_sockets", // http://b/186826853, cc_library, depends on //system/libbase:libbase (http://b/186826479)
-
 		"liblinker_debuggerd_stub", // http://b/186824327, cc_library_static, depends on //external/zlib:libz (http://b/186823782)
 		//                                                               also depends on //system/libziparchive:libziparchive (http://b/186823656)
 		//                                                               also depends on //system/logging/liblog:liblog (http://b/186822772)
@@ -285,24 +282,6 @@
 		"libadb_protos_static",         // b/200601772: Requires cc_library proto support
 		"libadb_protos",                // b/200601772: Requires cc_library proto support
 		"libapp_processes_protos_lite", // b/200601772: Requires cc_library proto support
-
-		"libbase", // TODO(cparsons): Breaks libandroidfw. Investigate.
-
-		// The below items depend on libbase.
-		"libadb_pairing_auth",
-		"libadb_pairing_auth_static",
-		"libadb_sysdeps",
-		"libadb_tls_connection",
-		"libadb_tls_connection_static",
-		"libadbconnection_client",
-		"libadbconnection_server",
-		"libadbd_auth",
-		"libadbd_fs",
-		"libcutils",
-		"libcutils_sockets",
-		"libdiagnose_usb",
-		// ---
-
 	}
 
 	// Per-module denylist of cc_library modules to only generate the static