Add bazel_module properties to cc_defaults

Test: go soong tests
Test: add bazel_module to Android.bp file and m nothing
Change-Id: I13c3e8d59536dbea88f3495309f4f64e849ede9f
diff --git a/cc/cc.go b/cc/cc.go
index f074597..33dd177 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3284,6 +3284,10 @@
 type Defaults struct {
 	android.ModuleBase
 	android.DefaultsModuleBase
+	// Included to support setting bazel_module.label for multiple Soong modules to the same Bazel
+	// target. This is primarily useful for modules that were architecture specific and instead are
+	// handled in Bazel as a select().
+	android.BazelModuleBase
 	android.ApexModuleBase
 }
 
@@ -3330,6 +3334,8 @@
 		&RustBindgenClangProperties{},
 	)
 
+	// Bazel module must be initialized _before_ Defaults to be included in cc_defaults module.
+	android.InitBazelModule(module)
 	android.InitDefaultsModule(module)
 
 	return module
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 76e75da..675c020 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -3368,6 +3368,9 @@
 			shared: {
 				srcs: ["baz.c"],
 			},
+			bazel_module: {
+				bp2build_available: true,
+			},
 		}
 
 		cc_library_static {