{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/comments/91163911","pull_request_review_id":11673813,"id":91163911,"diff_hunk":"@@ -274,19 +279,32 @@ public void runAppCfgCommand(List<String> args) throws ProcessRunnerException {\n   }\n \n   /**\n-   * Returns the version of the Cloud SDK installation. Unlike other methods in this class that call\n-   * gcloud, this method always uses a synchronous ProcessRunner and will block until the gcloud\n-   * process returns.\n+   * Returns the version of the Cloud SDK installation. Version is determined by reading the VERSION\n+   * file located in the Cloud SDK directory.\n    *\n-   * @throws ProcessRunnerException when process runner encounters an error\n+   * @throws CloudSdkOutOfDateException if the Cloud SDK is too out of date to determine its version\n+   * @throws IOException if the VERSION file could not be read. This might mean the Cloud SDK\n+   *                     installation is corrupted.\n    */\n-  public CloudSdkVersion getVersion() throws ProcessRunnerException {\n-    // gcloud info --format=\"value(basic.version)\"\n-    List<String> command = new ImmutableList.Builder<String>().add(\"info\")\n-        .addAll(GcloudArgs.get(\"format\", \"value(basic.version)\")).build();\n+  public CloudSdkVersion getVersion() throws IOException {\n+    Path versionFile = getSdkPath().resolve(VERSION_FILE);\n \n-    String output = runSynchronousGcloudCommand(command);\n-    return new CloudSdkVersion(output);\n+    if (!Files.isRegularFile(versionFile)) {\n+      throw new CloudSdkOutOfDateException(MINIMUM_VERSION);\n+    }\n+\n+    String contents = \"\";\n+    List<String> lines = Files.readAllLines(versionFile, StandardCharsets.UTF_8);\n+    if (lines.size() > 0) {\n+      // expect only a single line\n+      contents = lines.get(0);\n+    }\n+\n+    try {\n+      return new CloudSdkVersion(contents);\n+    } catch (IllegalArgumentException e) {\n+      throw new CloudSdkOutOfDateException(MINIMUM_VERSION, e);","path":"src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdk.java","position":69,"original_position":69,"commit_id":"7980eea70bb7cacfc8eecca3c5dd640922adbabb","original_commit_id":"7980eea70bb7cacfc8eecca3c5dd640922adbabb","user":{"login":"chanseokoh","id":10523105,"avatar_url":"https://avatars.githubusercontent.com/u/10523105?v=3","gravatar_id":"","url":"https://api.github.com/users/chanseokoh","html_url":"https://github.com/chanseokoh","followers_url":"https://api.github.com/users/chanseokoh/followers","following_url":"https://api.github.com/users/chanseokoh/following{/other_user}","gists_url":"https://api.github.com/users/chanseokoh/gists{/gist_id}","starred_url":"https://api.github.com/users/chanseokoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chanseokoh/subscriptions","organizations_url":"https://api.github.com/users/chanseokoh/orgs","repos_url":"https://api.github.com/users/chanseokoh/repos","events_url":"https://api.github.com/users/chanseokoh/events{/privacy}","received_events_url":"https://api.github.com/users/chanseokoh/received_events","type":"User","site_admin":false},"body":"Just don't forget `validateCloudSdkVersion()` is a private method. `validateCloudSdk()` is the public-facing method.","created_at":"2016-12-06T20:25:08Z","updated_at":"2016-12-06T20:25:08Z","html_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core/pull/276#discussion_r91163911","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/comments/91163911"},"html":{"href":"https://github.com/GoogleCloudPlatform/appengine-plugins-core/pull/276#discussion_r91163911"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276","id":96757561,"html_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core/pull/276","diff_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core/pull/276.diff","patch_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core/pull/276.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/276","number":276,"state":"open","locked":false,"title":"Improve CloudSdk.getVersion","user":{"login":"aslo","id":1039411,"avatar_url":"https://avatars.githubusercontent.com/u/1039411?v=3","gravatar_id":"","url":"https://api.github.com/users/aslo","html_url":"https://github.com/aslo","followers_url":"https://api.github.com/users/aslo/followers","following_url":"https://api.github.com/users/aslo/following{/other_user}","gists_url":"https://api.github.com/users/aslo/gists{/gist_id}","starred_url":"https://api.github.com/users/aslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aslo/subscriptions","organizations_url":"https://api.github.com/users/aslo/orgs","repos_url":"https://api.github.com/users/aslo/repos","events_url":"https://api.github.com/users/aslo/events{/privacy}","received_events_url":"https://api.github.com/users/aslo/received_events","type":"User","site_admin":false},"body":"This PR makes a few enhancements to CloudSdk.getVersion that are required in order for the intellij plugin to use the version-compatibility logic in this library and not need to perform an expensive operation twice. (see https://github.com/GoogleCloudPlatform/google-cloud-intellij/issues/1127 for more context).\r\n\r\nQuick summary of changes:\r\n- Cloud SDK version is now determined by reading the VERSION file at the root of the cloud sdk installation, rather than calling gcloud in a subprocess. This is more performant and the code is less complex. Note that this means we can't determine the version of any cloud sdk installation that is earlier than 133.0.0 (when VERSION files first started being used)\r\n- CloudSdkOutOfDateException no longer inherits from CloudSdkNotFoundException. This makes it a lot easier to validate based on these exceptions. \r\n- CloudSdkOutOfDateException now has the minimum required version as a member field. This allows clients of this library to construct their own validation messages using the data from the exception.\r\n\r\n","created_at":"2016-12-06T16:28:58Z","updated_at":"2016-12-06T20:25:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8351f27a102dee403cd0cdf3c7f2448404c184a4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/276/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/statuses/7980eea70bb7cacfc8eecca3c5dd640922adbabb","head":{"label":"GoogleCloudPlatform:get-version-from-file","ref":"get-version-from-file","sha":"7980eea70bb7cacfc8eecca3c5dd640922adbabb","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":54120965,"name":"appengine-plugins-core","full_name":"GoogleCloudPlatform/appengine-plugins-core","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core","description":"A client Java library to manage App Engine Java applications for any project that performs App Engine Java application management. For example, the Maven, Gradle and Eclipse App Engine plugins, custom user tools, etc.","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/deployments","created_at":"2016-03-17T13:42:30Z","updated_at":"2016-11-26T09:33:14Z","pushed_at":"2016-12-06T18:38:04Z","git_url":"git://github.com/GoogleCloudPlatform/appengine-plugins-core.git","ssh_url":"git@github.com:GoogleCloudPlatform/appengine-plugins-core.git","clone_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core.git","svn_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core","homepage":"","size":975,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":52,"forks":3,"open_issues":52,"watchers":8,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"823d06fdf78eda39b9f8f64dd3e511cd7a574539","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":54120965,"name":"appengine-plugins-core","full_name":"GoogleCloudPlatform/appengine-plugins-core","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core","description":"A client Java library to manage App Engine Java applications for any project that performs App Engine Java application management. For example, the Maven, Gradle and Eclipse App Engine plugins, custom user tools, etc.","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/deployments","created_at":"2016-03-17T13:42:30Z","updated_at":"2016-11-26T09:33:14Z","pushed_at":"2016-12-06T18:38:04Z","git_url":"git://github.com/GoogleCloudPlatform/appengine-plugins-core.git","ssh_url":"git@github.com:GoogleCloudPlatform/appengine-plugins-core.git","clone_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core.git","svn_url":"https://github.com/GoogleCloudPlatform/appengine-plugins-core","homepage":"","size":975,"stargazers_count":8,"watchers_count":8,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":52,"forks":3,"open_issues":52,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276"},"html":{"href":"https://github.com/GoogleCloudPlatform/appengine-plugins-core/pull/276"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/276"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/issues/276/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/pulls/276/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/appengine-plugins-core/statuses/7980eea70bb7cacfc8eecca3c5dd640922adbabb"}}}}
{"actor":{"display_login":"chanseokoh"}}