Autogenerate a vendor-build.prop for the current product

The autogenerated soong vendor.img will use the autogenerated soong
vendor-build.prop module. The autogenerated vendor-build.prop module is
missing support for `android-info.txt` which is an additional input as
--prop-files. Support for that will be added in a followup CL.

Test: verified that autogenerated vendor.img for aosp_cf_x86_64_phone
contains a build.prop file, and its contents are equivalent to kati
built vendor build.prop file

Bug: 375500423
Change-Id: I46b3c2e7cf44300820dcd2f7a9799ad11730691e
diff --git a/Android.bp b/Android.bp
index d0f97db..cbe1c7b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -164,6 +164,7 @@
     name: "product_config",
     visibility: [
         "//build/make/target/product/generic",
+        "//build/soong/fsgen",
     ],
 }
 
diff --git a/android/build_prop.go b/android/build_prop.go
index 120ad94..7c3c506 100644
--- a/android/build_prop.go
+++ b/android/build_prop.go
@@ -20,7 +20,7 @@
 
 func init() {
 	ctx := InitRegistrationContext
-	ctx.RegisterModuleType("build_prop", buildPropFactory)
+	ctx.RegisterModuleType("build_prop", BuildPropFactory)
 }
 
 type buildPropProperties struct {
@@ -191,7 +191,7 @@
 // build_prop module generates {partition}/build.prop file. At first common build properties are
 // printed based on Soong config variables. And then prop_files are printed as-is. Finally,
 // post_process_props tool is run to check if the result build.prop is valid or not.
-func buildPropFactory() Module {
+func BuildPropFactory() Module {
 	module := &buildPropModule{}
 	module.AddProperties(&module.properties)
 	InitAndroidArchModule(module, DeviceSupported, MultilibCommon)
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 39572d4..766176d 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -139,8 +139,9 @@
 					"update_engine_sideload":       defaultDepCandidateProps(ctx.Config()),
 				},
 				"vendor": &map[string]*depCandidateProps{
-					"fs_config_files_vendor": defaultDepCandidateProps(ctx.Config()),
-					"fs_config_dirs_vendor":  defaultDepCandidateProps(ctx.Config()),
+					"fs_config_files_vendor":                               defaultDepCandidateProps(ctx.Config()),
+					"fs_config_dirs_vendor":                                defaultDepCandidateProps(ctx.Config()),
+					generatedModuleName(ctx.Config(), "vendor-build.prop"): defaultDepCandidateProps(ctx.Config()),
 				},
 				"odm":     newMultilibDeps(),
 				"product": newMultilibDeps(),
@@ -481,6 +482,25 @@
 		module = ctx.CreateModule(filesystem.FilesystemFactory, baseProps, fsProps)
 	}
 	module.HideFromMake()
+	if partitionType == "vendor" {
+		// Create a build prop for vendor
+		vendorBuildProps := &struct {
+			Name           *string
+			Vendor         *bool
+			Stem           *string
+			Product_config *string
+		}{
+			Name:           proptools.StringPtr(generatedModuleName(ctx.Config(), "vendor-build.prop")),
+			Vendor:         proptools.BoolPtr(true),
+			Stem:           proptools.StringPtr("build.prop"),
+			Product_config: proptools.StringPtr(":product_config"),
+		}
+		vendorBuildProp := ctx.CreateModule(
+			android.BuildPropFactory,
+			vendorBuildProps,
+		)
+		vendorBuildProp.HideFromMake()
+	}
 	return true
 }