Merge "Soong: Add documentation to sh_binary[_host] module."
diff --git a/android/prebuilt_etc.go b/android/prebuilt_etc.go
index 6c8fb31..0c68b0c 100644
--- a/android/prebuilt_etc.go
+++ b/android/prebuilt_etc.go
@@ -174,7 +174,8 @@
 	p.AddProperties(&p.properties)
 }
 
-// prebuilt_etc is for prebuilts that will be installed to <partition>/etc/<subdir>
+// prebuilt_etc is for a prebuilt artifact that is installed in
+// <partition>/etc/<sub_dir> directory.
 func PrebuiltEtcFactory() Module {
 	module := &PrebuiltEtc{installDirBase: "etc"}
 	InitPrebuiltEtcModule(module)
@@ -183,6 +184,8 @@
 	return module
 }
 
+// prebuilt_etc_host is for a host prebuilt artifact that is installed in
+// $(HOST_OUT)/etc/<sub_dir> directory.
 func PrebuiltEtcHostFactory() Module {
 	module := &PrebuiltEtc{installDirBase: "etc"}
 	InitPrebuiltEtcModule(module)
@@ -191,7 +194,8 @@
 	return module
 }
 
-// prebuilt_usr_share is for prebuilts that will be installed to <partition>/usr/share/<subdir>
+// prebuilt_usr_share is for a prebuilt artifact that is installed in
+// <partition>/usr/share/<sub_dir> directory.
 func PrebuiltUserShareFactory() Module {
 	module := &PrebuiltEtc{installDirBase: "usr/share"}
 	InitPrebuiltEtcModule(module)
@@ -200,7 +204,8 @@
 	return module
 }
 
-// prebuild_usr_share_host is for host prebuilts that will be installed to <partition>/usr/share/<subdir>
+// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
+// $(HOST_OUT)/usr/share/<sub_dir> directory.
 func PrebuiltUserShareHostFactory() Module {
 	module := &PrebuiltEtc{installDirBase: "usr/share"}
 	InitPrebuiltEtcModule(module)
diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go
index 98d4506..2976a0c 100644
--- a/androidmk/cmd/androidmk/androidmk_test.go
+++ b/androidmk/cmd/androidmk/androidmk_test.go
@@ -1075,6 +1075,25 @@
 // Comment line 2
 `,
 	},
+	{
+		desc: "Merge with variable reference",
+		in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_STATIC_ANDROID_LIBRARIES := $(FOO)
+LOCAL_STATIC_JAVA_LIBRARIES := javalib
+LOCAL_JAVA_RESOURCE_DIRS := $(FOO)
+include $(BUILD_PACKAGE)
+`,
+		expected: `
+android_app {
+	name: "foo",
+	static_libs: FOO,
+	static_libs: ["javalib"],
+	java_resource_dirs: FOO,
+}
+`,
+	},
 }
 
 func TestEndToEnd(t *testing.T) {
diff --git a/bpfix/bpfix/bpfix.go b/bpfix/bpfix/bpfix.go
index ba6435e..706c0ec 100644
--- a/bpfix/bpfix/bpfix.go
+++ b/bpfix/bpfix/bpfix.go
@@ -786,6 +786,14 @@
 }
 
 func mergeProperties(a, b *parser.Property, buf []byte, patchlist *parser.PatchList) error {
+	// The value of one of the properties may be a variable reference with no type assigned
+	// Bail out in this case. Soong will notice duplicate entries and will tell to merge them.
+	if _, isVar := a.Value.(*parser.Variable); isVar {
+		return nil
+	}
+	if _, isVar := b.Value.(*parser.Variable); isVar {
+		return nil
+	}
 	if a.Value.Type() != b.Value.Type() {
 		return fmt.Errorf("type mismatch when merging properties %q: %s and %s", a.Name, a.Value.Type(), b.Value.Type())
 	}
diff --git a/cmd/soong_build/writedocs.go b/cmd/soong_build/writedocs.go
index 4b2dc14..5171b68 100644
--- a/cmd/soong_build/writedocs.go
+++ b/cmd/soong_build/writedocs.go
@@ -34,7 +34,7 @@
 
 type moduleTypeTemplateData struct {
 	Name       string
-	Synopsis   string
+	Synopsis   template.HTML
 	Properties []bpdoc.Property
 }