vendor: soong> add lineage generator

Change-Id: I7f42dbb75e85825bc2a6f833ebad85c816cc7065
diff --git a/build/soong/generator/variables.go b/build/soong/generator/variables.go
new file mode 100644
index 0000000..e8ac496
--- /dev/null
+++ b/build/soong/generator/variables.go
@@ -0,0 +1,28 @@
+package generator
+
+import (
+	"fmt"
+
+	"android/soong/android"
+)
+
+func omniromExpandVariables(ctx android.ModuleContext, in string) string {
+	omniromVars := ctx.Config().VendorConfig("omniromVarsPlugin")
+
+	out, err := android.Expand(in, func(name string) (string, error) {
+		if omniromVars.IsSet(name) {
+			return omniromVars.String(name), nil
+		}
+		// This variable is not for us, restore what the original
+		// variable string will have looked like for an Expand
+		// that comes later.
+		return fmt.Sprintf("$(%s)", name), nil
+	})
+
+	if err != nil {
+		ctx.PropertyErrorf("%s: %s", in, err.Error())
+		return ""
+	}
+
+	return out
+}