[WIP] Attempt at building grpc and p4runtime protocols with Bazel

STILL NOT WORKING AT RUNTIME

Change-Id: I1f9e60b12a12e09edad2a714ec2921a4f71c6d35
diff --git a/tools/build/bazel/p4lang_workspace.bzl b/tools/build/bazel/p4lang_workspace.bzl
index d1bd40e..24da166 100644
--- a/tools/build/bazel/p4lang_workspace.bzl
+++ b/tools/build/bazel/p4lang_workspace.bzl
@@ -1,36 +1,19 @@
-GITHUB_BASE_URL = "https://github.com"
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
-PI_COMMIT_SHORT = "59c9409"
-PI_COMMIT = "59c940916b4f5b182f33b4788d8c410972eaecce"
-PI_REPO = "p4lang/PI"
-
-GOOGLE_RPC_COMMIT_SHORT = "916e66d"
-GOOGLE_RPC_COMMIT = "916e66d03a4f4716937b3bfa6539b9de8a598b7c"
-GOOGLE_RPC_REPO = "googleapis/googleapis"
-
-def _format_github_url(repo, commit):
-    return GITHUB_BASE_URL + "/{0}/tarball/{1}".format(repo, commit)
+P4RUNTIME_COMMIT = "028552d98b774301c51be0fe5bc97c9e95716759"
+PI_COMMIT = "36ca74fae69c8d0a142f8bfd2487bee72505cf48"
 
 def generate_p4lang():
-    native.http_archive(
-        name = "com_google_protobuf",
-        sha256 = "cef7f1b5a7c5fba672bec2a319246e8feba471f04dcebfe362d55930ee7c1c30",
-        strip_prefix = "protobuf-3.5.0",
-        urls = ["https://github.com/google/protobuf/archive/v3.5.0.zip"],
+    http_archive(
+        name = "com_github_p4lang_p4runtime",
+        urls = ["https://github.com/p4lang/p4runtime/archive/%s.zip" % P4RUNTIME_COMMIT],
+        strip_prefix = "p4runtime-%s/proto" % P4RUNTIME_COMMIT,
+        build_file = "//tools/build/bazel:p4runtime_BUILD"
     )
-
-    native.new_http_archive(
-        name = "p4lang_pi",
-        urls = [_format_github_url(PI_REPO, PI_COMMIT)],
-        build_file = "//tools/build/bazel:p4lang_BUILD",
-        strip_prefix = "p4lang-PI-" + PI_COMMIT_SHORT + "/proto",
-        type = "tar.gz",
-    )
-
-    native.new_http_archive(
-        name = "google_rpc",
-        urls = [_format_github_url(GOOGLE_RPC_REPO, GOOGLE_RPC_COMMIT)],
-        build_file = "//tools/build/bazel:google_RPC_BUILD",
-        strip_prefix = "googleapis-googleapis-" + GOOGLE_RPC_COMMIT_SHORT,
-        type = "tar.gz",
+    # Needed for PI/proto/p4/tmp/p4config.proto
+    http_archive(
+        name = "com_github_p4lang_pi",
+        urls = ["https://github.com/p4lang/PI/archive/%s.zip" % PI_COMMIT],
+        strip_prefix = "PI-%s/proto" % PI_COMMIT,
+        build_file = "//tools/build/bazel:pi_BUILD"
     )