{"action":"created","comment":{"url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/comments/185283868","pull_request_review_id":116640853,"id":185283868,"diff_hunk":"@@ -0,0 +1,148 @@\n+// Copyright 2018 The Bazel Authors. All rights reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package build.bazel.tests.integration;\n+\n+import java.io.IOException;\n+import java.nio.file.Path;\n+import java.nio.file.Paths;\n+import java.util.Collections;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.stream.Collectors;\n+import java.util.stream.Stream;\n+\n+/** This class holds the result of a Bazel invocation. */\n+public class BazelCommand {\n+\n+  private final Command delegate;\n+  private final List<String> args;\n+  private final int exitCode;\n+\n+  private BazelCommand(Command delegate, List<String> args, int exitCode) {\n+    this.delegate = delegate;\n+    this.args = args;\n+    this.exitCode = exitCode;\n+  }\n+\n+  /** Returns the exit code. */\n+  public int exitCode() {\n+    return exitCode;\n+  }\n+\n+  /** Returns the list of lines of the standard error stream. */\n+  public List<String> errorLines() {\n+    return delegate.getErrorLines();\n+  }\n+\n+  /** Returns the list of lines of the standard output stream. */\n+  public List<String> outputLines() {\n+    return delegate.getOutputLines();\n+  }\n+\n+  /**\n+   * Returns a description/summary of the command arguments, standard error and output stream. This\n+   * method can be used for troubleshooting and error reporting.\n+   */\n+  public String toString() {\n+    String description =\n+        \"BAZEL COMMAND: \"\n+            + args\n+            + \"\\n\"\n+            + \"EXIT CODE: \"\n+            + exitCode\n+            + \"\\n\"\n+            + \"STDOUT:\\n    \"\n+            + String.join(\"\\n    \", outputLines())\n+            + \"\\n\"\n+            + \"STDERR:\\n    \"\n+            + String.join(\"\\n    \", errorLines())\n+            + \"\\n\";\n+\n+    return description;\n+  }\n+\n+  static class Builder {\n+    private final WorkspaceDriver driver;\n+    private final Path outputUserRoot;\n+    private final List<String> args;\n+    private Path bazelrcFile = null;\n+    private Map<String, String> environment = new HashMap<>();\n+    private Path workingDirectory = Paths.get(\"\");\n+\n+    Builder(WorkspaceDriver driver, Path outputUserRoot, List<String> args) {\n+      this.driver = driver;\n+      this.outputUserRoot = outputUserRoot;\n+      this.args = Collections.unmodifiableList(args);\n+    }\n+\n+    /** sets the working directory relative to workspace path */\n+    public Builder inWorkingDirectory(Path dirRelativeToWorkspaceRoot) {\n+      this.workingDirectory = dirRelativeToWorkspaceRoot;\n+      return this;\n+    }\n+\n+    /** sets the bazelrc file path */\n+    public Builder withBazelrcFile(Path bazelrcFile) {\n+      this.bazelrcFile = bazelrcFile;\n+      return this;\n+    }\n+\n+    /** adds environment variable to execution runtime */\n+    public Builder withEnvironmentVariable(String key, String value) {\n+      this.environment.put(key, value);\n+      return this;\n+    }\n+\n+    private Command build() throws IOException {\n+      String bazelRcPath =\n+          bazelrcFile == null","path":"java/build/bazel/tests/integration/BazelCommand.java","position":124,"original_position":111,"commit_id":"d43dd74e64c3cd88daa2401ed510d15c16b6c8ef","original_commit_id":"5442d048d9d1f392b01168181dba3f9f42f898be","user":{"login":"ittaiz","id":1378327,"avatar_url":"https://avatars2.githubusercontent.com/u/1378327?v=4","gravatar_id":"","url":"https://api.github.com/users/ittaiz","html_url":"https://github.com/ittaiz","followers_url":"https://api.github.com/users/ittaiz/followers","following_url":"https://api.github.com/users/ittaiz/following{/other_user}","gists_url":"https://api.github.com/users/ittaiz/gists{/gist_id}","starred_url":"https://api.github.com/users/ittaiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ittaiz/subscriptions","organizations_url":"https://api.github.com/users/ittaiz/orgs","repos_url":"https://api.github.com/users/ittaiz/repos","events_url":"https://api.github.com/users/ittaiz/events{/privacy}","received_events_url":"https://api.github.com/users/ittaiz/received_events","type":"User","site_admin":false},"body":"Ok. I’ll live with it though I’m glad I don’t code in java in the d2d...","created_at":"2018-05-01T17:43:49Z","updated_at":"2018-05-01T17:43:49Z","html_url":"https://github.com/bazelbuild/bazel-integration-testing/pull/68#discussion_r185283868","pull_request_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/comments/185283868"},"html":{"href":"https://github.com/bazelbuild/bazel-integration-testing/pull/68#discussion_r185283868"},"pull_request":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68"}},"in_reply_to_id":185170048},"pull_request":{"url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68","id":183804778,"html_url":"https://github.com/bazelbuild/bazel-integration-testing/pull/68","diff_url":"https://github.com/bazelbuild/bazel-integration-testing/pull/68.diff","patch_url":"https://github.com/bazelbuild/bazel-integration-testing/pull/68.patch","issue_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/issues/68","number":68,"state":"open","locked":false,"title":"Simplify the BazelCommand API","user":{"login":"hchauvin","id":13814443,"avatar_url":"https://avatars2.githubusercontent.com/u/13814443?v=4","gravatar_id":"","url":"https://api.github.com/users/hchauvin","html_url":"https://github.com/hchauvin","followers_url":"https://api.github.com/users/hchauvin/followers","following_url":"https://api.github.com/users/hchauvin/following{/other_user}","gists_url":"https://api.github.com/users/hchauvin/gists{/gist_id}","starred_url":"https://api.github.com/users/hchauvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hchauvin/subscriptions","organizations_url":"https://api.github.com/users/hchauvin/orgs","repos_url":"https://api.github.com/users/hchauvin/repos","events_url":"https://api.github.com/users/hchauvin/events{/privacy}","received_events_url":"https://api.github.com/users/hchauvin/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-24T17:08:47Z","updated_at":"2018-05-01T17:43:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c503ace5342c87ed93308d32ad66f9218545a48","assignee":null,"assignees":[],"requested_reviewers":[{"login":"natansil","id":11754053,"avatar_url":"https://avatars0.githubusercontent.com/u/11754053?v=4","gravatar_id":"","url":"https://api.github.com/users/natansil","html_url":"https://github.com/natansil","followers_url":"https://api.github.com/users/natansil/followers","following_url":"https://api.github.com/users/natansil/following{/other_user}","gists_url":"https://api.github.com/users/natansil/gists{/gist_id}","starred_url":"https://api.github.com/users/natansil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natansil/subscriptions","organizations_url":"https://api.github.com/users/natansil/orgs","repos_url":"https://api.github.com/users/natansil/repos","events_url":"https://api.github.com/users/natansil/events{/privacy}","received_events_url":"https://api.github.com/users/natansil/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":706345551,"url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68/commits","review_comments_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68/comments","review_comment_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/issues/68/comments","statuses_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/statuses/d43dd74e64c3cd88daa2401ed510d15c16b6c8ef","head":{"label":"hchauvin:build-event-protocol","ref":"build-event-protocol","sha":"d43dd74e64c3cd88daa2401ed510d15c16b6c8ef","user":{"login":"hchauvin","id":13814443,"avatar_url":"https://avatars2.githubusercontent.com/u/13814443?v=4","gravatar_id":"","url":"https://api.github.com/users/hchauvin","html_url":"https://github.com/hchauvin","followers_url":"https://api.github.com/users/hchauvin/followers","following_url":"https://api.github.com/users/hchauvin/following{/other_user}","gists_url":"https://api.github.com/users/hchauvin/gists{/gist_id}","starred_url":"https://api.github.com/users/hchauvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hchauvin/subscriptions","organizations_url":"https://api.github.com/users/hchauvin/orgs","repos_url":"https://api.github.com/users/hchauvin/repos","events_url":"https://api.github.com/users/hchauvin/events{/privacy}","received_events_url":"https://api.github.com/users/hchauvin/received_events","type":"User","site_admin":false},"repo":{"id":130535114,"name":"bazel-integration-testing","full_name":"hchauvin/bazel-integration-testing","owner":{"login":"hchauvin","id":13814443,"avatar_url":"https://avatars2.githubusercontent.com/u/13814443?v=4","gravatar_id":"","url":"https://api.github.com/users/hchauvin","html_url":"https://github.com/hchauvin","followers_url":"https://api.github.com/users/hchauvin/followers","following_url":"https://api.github.com/users/hchauvin/following{/other_user}","gists_url":"https://api.github.com/users/hchauvin/gists{/gist_id}","starred_url":"https://api.github.com/users/hchauvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hchauvin/subscriptions","organizations_url":"https://api.github.com/users/hchauvin/orgs","repos_url":"https://api.github.com/users/hchauvin/repos","events_url":"https://api.github.com/users/hchauvin/events{/privacy}","received_events_url":"https://api.github.com/users/hchauvin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hchauvin/bazel-integration-testing","description":"Framework for integration tests that call Bazel","fork":true,"url":"https://api.github.com/repos/hchauvin/bazel-integration-testing","forks_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/forks","keys_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/teams","hooks_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/hooks","issue_events_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/issues/events{/number}","events_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/events","assignees_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/assignees{/user}","branches_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/branches{/branch}","tags_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/tags","blobs_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/git/refs{/sha}","trees_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/statuses/{sha}","languages_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/languages","stargazers_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/stargazers","contributors_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/contributors","subscribers_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/subscribers","subscription_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/subscription","commits_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/commits{/sha}","git_commits_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/git/commits{/sha}","comments_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/comments{/number}","issue_comment_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/issues/comments{/number}","contents_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/contents/{+path}","compare_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/merges","archive_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/downloads","issues_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/issues{/number}","pulls_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/pulls{/number}","milestones_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/milestones{/number}","notifications_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/labels{/name}","releases_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/releases{/id}","deployments_url":"https://api.github.com/repos/hchauvin/bazel-integration-testing/deployments","created_at":"2018-04-22T04:27:56Z","updated_at":"2018-04-22T04:27:58Z","pushed_at":"2018-05-01T14:37:34Z","git_url":"git://github.com/hchauvin/bazel-integration-testing.git","ssh_url":"git@github.com:hchauvin/bazel-integration-testing.git","clone_url":"https://github.com/hchauvin/bazel-integration-testing.git","svn_url":"https://github.com/hchauvin/bazel-integration-testing","homepage":"","size":190,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bazelbuild:master","ref":"master","sha":"38e586d6662c9cfc3c0b8800a02c33c7986e1901","user":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"repo":{"id":105262089,"name":"bazel-integration-testing","full_name":"bazelbuild/bazel-integration-testing","owner":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bazelbuild/bazel-integration-testing","description":"Framework for integration tests that call Bazel","fork":false,"url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing","forks_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/forks","keys_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/teams","hooks_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/hooks","issue_events_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/issues/events{/number}","events_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/events","assignees_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/assignees{/user}","branches_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/branches{/branch}","tags_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/tags","blobs_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/statuses/{sha}","languages_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/languages","stargazers_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/stargazers","contributors_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/contributors","subscribers_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/subscribers","subscription_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/subscription","commits_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/contents/{+path}","compare_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/merges","archive_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/downloads","issues_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/issues{/number}","pulls_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls{/number}","milestones_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/milestones{/number}","notifications_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/labels{/name}","releases_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/releases{/id}","deployments_url":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/deployments","created_at":"2017-09-29T10:50:01Z","updated_at":"2018-05-01T05:29:37Z","pushed_at":"2018-05-01T09:27:02Z","git_url":"git://github.com/bazelbuild/bazel-integration-testing.git","ssh_url":"git@github.com:bazelbuild/bazel-integration-testing.git","clone_url":"https://github.com/bazelbuild/bazel-integration-testing.git","svn_url":"https://github.com/bazelbuild/bazel-integration-testing","homepage":"","size":130,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":16,"open_issues":13,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68"},"html":{"href":"https://github.com/bazelbuild/bazel-integration-testing/pull/68"},"issue":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/issues/68"},"comments":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/bazelbuild/bazel-integration-testing/statuses/d43dd74e64c3cd88daa2401ed510d15c16b6c8ef"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ittaiz"}}