Support genrules with multiple tools

To allow genrules with more than one tool, rename the tool property to
tools and make it an array, replace $tool with $(location <label>),
and use $() for other variables for consistency.

Bug: 31948427
Test: compare build.ninja
Change-Id: I20a69ff2f30715acf718a08bc195d7a938442a2d
(cherry picked from commit 1b27f616afb31974017978ffc2aecc8e4c7582cc)
diff --git a/main.cpp b/main.cpp
index 1524080..6dc5dc9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -582,9 +582,9 @@
     out << "genrule {\n";
     out.indent();
     out << "name: \"" << genName << "\",\n"
-        << "tool: \"" << hidl_gen << "\",\n";
+        << "tools: [\"" << hidl_gen << "\"],\n";
 
-    out << "cmd: \"$tool -o $genDir"
+    out << "cmd: \"$(location " << hidl_gen << ") -o $(genDir)"
         << " -L" << language
         << " -r"
         << coordinator->getPackageRoot(packageFQName) << ":"
diff --git a/test/vendor/1.0/Android.bp b/test/vendor/1.0/Android.bp
index cabe733..e30af12 100644
--- a/test/vendor/1.0/Android.bp
+++ b/test/vendor/1.0/Android.bp
@@ -2,8 +2,8 @@
 
 genrule {
     name: "tests.vendor@1.0_genc++",
-    tool: "hidl-gen",
-    cmd: "$tool -o $genDir -Lc++ -rtests:system/tools/hidl/test/ tests.vendor@1.0",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -rtests:system/tools/hidl/test/ tests.vendor@1.0",
     srcs: [
         "IVendor.hal",
     ],
@@ -14,8 +14,8 @@
 
 genrule {
     name: "tests.vendor@1.0_genc++_headers",
-    tool: "hidl-gen",
-    cmd: "$tool -o $genDir -Lc++ -rtests:system/tools/hidl/test/ tests.vendor@1.0",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -rtests:system/tools/hidl/test/ tests.vendor@1.0",
     srcs: [
         "IVendor.hal",
     ],