Add script to auto-generate Bazel project file

Which is much faster to sync since it reduces the scope of the IDE
targets to java libraries. Although, it requires one to execute the
script each time a new app/library is added to the source tree.

Example usage:
onos-gen-bazel-project > .bazelproject

Change-Id: Ia2911a323b66554f4c5ea588573343013c3c739b
(cherry picked from commit 9d16ad8fe7f2d4bc60f041824caa6fd20db8e791)
diff --git a/tools/dev/bin/onos-gen-bazel-project b/tools/dev/bin/onos-gen-bazel-project
new file mode 100755
index 0000000..0c33da1
--- /dev/null
+++ b/tools/dev/bin/onos-gen-bazel-project
@@ -0,0 +1,54 @@
+#!/usr/bin/env python2.7
+import os
+
+import subprocess
+
+JAVA_LANGUAGE_LEVEL = 8
+
+EXCLUDE_DIRECTORIES = (
+    "target",
+)
+
+TEST_SOURCES = (
+    "*/src/test/*",
+)
+
+TEMPLATE = """# Autogenerated with {script_name}
+workspace_type: java
+java_language_level: {language_level}
+
+directories:
+  .
+{exclude_dirs}
+
+targets:
+{targets}
+
+test_sources:
+{test_sources}
+"""
+
+
+def get_library_targets():
+    this_dir = os.path.dirname(os.path.realpath(__file__))
+    out = subprocess.check_output([
+        "bazel", "query", "kind(\"java_library\", //...:all)"], cwd=this_dir)
+    return out.strip().split("\n")
+
+
+def gen_project():
+    all_targets = get_library_targets()
+    all_targets.sort()
+    data = {
+        "script_name": os.path.basename(__file__),
+        "language_level": JAVA_LANGUAGE_LEVEL,
+        "exclude_dirs": "\n".join(
+            map(lambda x: "  -" + x, EXCLUDE_DIRECTORIES)),
+        "targets": "\n".join(map(lambda x: "  " + x, all_targets)),
+        "test_sources": "\n".join(map(lambda x: "  " + x, TEST_SOURCES)),
+    }
+    return TEMPLATE.format(**data)
+
+
+if __name__ == "__main__":
+    print gen_project()