{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/msbuild/pulls/comments/194901669","pull_request_review_id":128164450,"id":194901669,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDkwMTY2OQ==","diff_hunk":"@@ -0,0 +1,126 @@\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System;\n+using System.Collections.Generic;\n+using System.IO;\n+using System.Security.Cryptography;\n+using Microsoft.Build.Framework;\n+using Microsoft.Build.Shared;\n+\n+namespace Microsoft.Build.Tasks\n+{\n+    /// <summary>\n+    /// Computes the checksum for a single file.\n+    /// </summary>\n+    public sealed class GetFileHash : TaskExtension\n+    {\n+        internal const string DefaultFileHashAlgorithm = \"SHA256\";\n+\n+        /// <summary>\n+        /// The files to be hashed.\n+        /// </summary>\n+        [Required]\n+        public ITaskItem[] Files { get; set; }\n+\n+        /// <summary>\n+        /// The algorithm. Allowed values: SHA256, SHA384, SHA512. Default = SHA256.\n+        /// </summary>\n+        public string Algorithm { get; set; } = DefaultFileHashAlgorithm;\n+\n+        /// <summary>\n+        /// The metadata name where the hash is store in each item. File hash is in hex. Defaults to \"FileHash\".\n+        /// </summary>\n+        public string MetadataName { get; set; } = \"FileHash\";\n+\n+        /// <summary>\n+        /// The metadata name where the base64 encoded hash is store in each item. File hash is in hex. Defaults to \"FileHashBase64\".\n+        /// </summary>\n+        public string MetadataNameBase64 { get; set; } = \"FileHashBase64\";\n+\n+        /// <summary>\n+        /// The hash of the file in hex. This is only set if there was one item group passed in.\n+        /// </summary>\n+        [Output]\n+        public string Hash { get; set; }\n+\n+        /// <summary>\n+        /// The hash of the file base64 encoded. This is only set if there was one item group passed in.\n+        /// </summary>\n+        [Output]\n+        public string HashBase64 { get; set; }\n+\n+        /// <summary>\n+        /// The input files with additional metadata set to include the file hash.\n+        /// </summary>\n+        [Output]\n+        public ITaskItem[] Items { get; set; }\n+\n+        public override bool Execute()\n+        {\n+            if (!SupportsAlgorithm(Algorithm))\n+            {\n+                Log.LogErrorFromResources(\"FileHash.UnrecognizedHashAlgorithm\", Algorithm);\n+                return false;\n+            }\n+\n+            foreach (var file in Files)\n+            {\n+                if (!File.Exists(file.ItemSpec))\n+                {\n+                    Log.LogErrorFromResources(\"FileHash.FileNotFound\", file.ItemSpec);\n+                    continue;","path":"src/Tasks/FileIO/GetFileHash.cs","position":72,"original_position":72,"commit_id":"159e979fdd2a27bfb604f18a45906c4b16a6e3f8","original_commit_id":"159e979fdd2a27bfb604f18a45906c4b16a6e3f8","user":{"login":"cdmihai","id":2255729,"node_id":"MDQ6VXNlcjIyNTU3Mjk=","avatar_url":"https://avatars0.githubusercontent.com/u/2255729?v=4","gravatar_id":"","url":"https://api.github.com/users/cdmihai","html_url":"https://github.com/cdmihai","followers_url":"https://api.github.com/users/cdmihai/followers","following_url":"https://api.github.com/users/cdmihai/following{/other_user}","gists_url":"https://api.github.com/users/cdmihai/gists{/gist_id}","starred_url":"https://api.github.com/users/cdmihai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdmihai/subscriptions","organizations_url":"https://api.github.com/users/cdmihai/orgs","repos_url":"https://api.github.com/users/cdmihai/repos","events_url":"https://api.github.com/users/cdmihai/events{/privacy}","received_events_url":"https://api.github.com/users/cdmihai/received_events","type":"User","site_admin":false},"body":"👍 \r\nTwo loops might regress spinning disks a bit, but hopefully it's an ever decreasing problem. :)","created_at":"2018-06-12T21:57:58Z","updated_at":"2018-06-12T21:57:58Z","html_url":"https://github.com/Microsoft/msbuild/pull/3398#discussion_r194901669","pull_request_url":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/msbuild/pulls/comments/194901669"},"html":{"href":"https://github.com/Microsoft/msbuild/pull/3398#discussion_r194901669"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398"}},"in_reply_to_id":194798221},"pull_request":{"url":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398","id":194023566,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0MDIzNTY2","html_url":"https://github.com/Microsoft/msbuild/pull/3398","diff_url":"https://github.com/Microsoft/msbuild/pull/3398.diff","patch_url":"https://github.com/Microsoft/msbuild/pull/3398.patch","issue_url":"https://api.github.com/repos/Microsoft/msbuild/issues/3398","number":3398,"state":"open","locked":false,"title":"Add GetFileHash and VerifyFileHash tasks","user":{"login":"natemcmaster","id":2696087,"node_id":"MDQ6VXNlcjI2OTYwODc=","avatar_url":"https://avatars0.githubusercontent.com/u/2696087?v=4","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"body":"Add tasks for computing the file hash and verifying an expected file hash using SHA256, SHA384, or SHA512. These tasks were originally part of aspnet/buildtools, then moved to dotnet/arcade. I've polished them up and added better tests/logging. I'm not set on the API names so let me know if there is a better MSBuild convention for the task and property names.\r\n\r\nResolves https://github.com/Microsoft/msbuild/issues/3369\r\n\r\ncc @jeffkl ","created_at":"2018-06-11T15:44:28Z","updated_at":"2018-06-12T21:57:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd81ca10c00da255232aba1ef2103d0dcf5124b0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398/commits","review_comments_url":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398/comments","review_comment_url":"https://api.github.com/repos/Microsoft/msbuild/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/msbuild/issues/3398/comments","statuses_url":"https://api.github.com/repos/Microsoft/msbuild/statuses/159e979fdd2a27bfb604f18a45906c4b16a6e3f8","head":{"label":"natemcmaster:filehash-tasks","ref":"filehash-tasks","sha":"159e979fdd2a27bfb604f18a45906c4b16a6e3f8","user":{"login":"natemcmaster","id":2696087,"node_id":"MDQ6VXNlcjI2OTYwODc=","avatar_url":"https://avatars0.githubusercontent.com/u/2696087?v=4","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"repo":{"id":97360293,"node_id":"MDEwOlJlcG9zaXRvcnk5NzM2MDI5Mw==","name":"msbuild","full_name":"natemcmaster/msbuild","owner":{"login":"natemcmaster","id":2696087,"node_id":"MDQ6VXNlcjI2OTYwODc=","avatar_url":"https://avatars0.githubusercontent.com/u/2696087?v=4","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/natemcmaster/msbuild","description":"The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.","fork":true,"url":"https://api.github.com/repos/natemcmaster/msbuild","forks_url":"https://api.github.com/repos/natemcmaster/msbuild/forks","keys_url":"https://api.github.com/repos/natemcmaster/msbuild/keys{/key_id}","collaborators_url":"https://api.github.com/repos/natemcmaster/msbuild/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/natemcmaster/msbuild/teams","hooks_url":"https://api.github.com/repos/natemcmaster/msbuild/hooks","issue_events_url":"https://api.github.com/repos/natemcmaster/msbuild/issues/events{/number}","events_url":"https://api.github.com/repos/natemcmaster/msbuild/events","assignees_url":"https://api.github.com/repos/natemcmaster/msbuild/assignees{/user}","branches_url":"https://api.github.com/repos/natemcmaster/msbuild/branches{/branch}","tags_url":"https://api.github.com/repos/natemcmaster/msbuild/tags","blobs_url":"https://api.github.com/repos/natemcmaster/msbuild/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/natemcmaster/msbuild/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/natemcmaster/msbuild/git/refs{/sha}","trees_url":"https://api.github.com/repos/natemcmaster/msbuild/git/trees{/sha}","statuses_url":"https://api.github.com/repos/natemcmaster/msbuild/statuses/{sha}","languages_url":"https://api.github.com/repos/natemcmaster/msbuild/languages","stargazers_url":"https://api.github.com/repos/natemcmaster/msbuild/stargazers","contributors_url":"https://api.github.com/repos/natemcmaster/msbuild/contributors","subscribers_url":"https://api.github.com/repos/natemcmaster/msbuild/subscribers","subscription_url":"https://api.github.com/repos/natemcmaster/msbuild/subscription","commits_url":"https://api.github.com/repos/natemcmaster/msbuild/commits{/sha}","git_commits_url":"https://api.github.com/repos/natemcmaster/msbuild/git/commits{/sha}","comments_url":"https://api.github.com/repos/natemcmaster/msbuild/comments{/number}","issue_comment_url":"https://api.github.com/repos/natemcmaster/msbuild/issues/comments{/number}","contents_url":"https://api.github.com/repos/natemcmaster/msbuild/contents/{+path}","compare_url":"https://api.github.com/repos/natemcmaster/msbuild/compare/{base}...{head}","merges_url":"https://api.github.com/repos/natemcmaster/msbuild/merges","archive_url":"https://api.github.com/repos/natemcmaster/msbuild/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/natemcmaster/msbuild/downloads","issues_url":"https://api.github.com/repos/natemcmaster/msbuild/issues{/number}","pulls_url":"https://api.github.com/repos/natemcmaster/msbuild/pulls{/number}","milestones_url":"https://api.github.com/repos/natemcmaster/msbuild/milestones{/number}","notifications_url":"https://api.github.com/repos/natemcmaster/msbuild/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/natemcmaster/msbuild/labels{/name}","releases_url":"https://api.github.com/repos/natemcmaster/msbuild/releases{/id}","deployments_url":"https://api.github.com/repos/natemcmaster/msbuild/deployments","created_at":"2017-07-16T04:40:17Z","updated_at":"2017-07-16T04:40:25Z","pushed_at":"2018-06-11T20:52:31Z","git_url":"git://github.com/natemcmaster/msbuild.git","ssh_url":"git@github.com:natemcmaster/msbuild.git","clone_url":"https://github.com/natemcmaster/msbuild.git","svn_url":"https://github.com/natemcmaster/msbuild","homepage":null,"size":27103,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"ce809a29dfdd4a87db77ac6301fd045af4d95bbf","user":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":32051890,"node_id":"MDEwOlJlcG9zaXRvcnkzMjA1MTg5MA==","name":"msbuild","full_name":"Microsoft/msbuild","owner":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/msbuild","description":"The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.","fork":false,"url":"https://api.github.com/repos/Microsoft/msbuild","forks_url":"https://api.github.com/repos/Microsoft/msbuild/forks","keys_url":"https://api.github.com/repos/Microsoft/msbuild/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/msbuild/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/msbuild/teams","hooks_url":"https://api.github.com/repos/Microsoft/msbuild/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/msbuild/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/msbuild/events","assignees_url":"https://api.github.com/repos/Microsoft/msbuild/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/msbuild/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/msbuild/tags","blobs_url":"https://api.github.com/repos/Microsoft/msbuild/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/msbuild/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/msbuild/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/msbuild/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/msbuild/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/msbuild/languages","stargazers_url":"https://api.github.com/repos/Microsoft/msbuild/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/msbuild/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/msbuild/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/msbuild/subscription","commits_url":"https://api.github.com/repos/Microsoft/msbuild/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/msbuild/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/msbuild/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/msbuild/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/msbuild/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/msbuild/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/msbuild/merges","archive_url":"https://api.github.com/repos/Microsoft/msbuild/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/msbuild/downloads","issues_url":"https://api.github.com/repos/Microsoft/msbuild/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/msbuild/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/msbuild/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/msbuild/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/msbuild/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/msbuild/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/msbuild/deployments","created_at":"2015-03-12T02:04:46Z","updated_at":"2018-06-12T21:28:16Z","pushed_at":"2018-06-12T20:41:33Z","git_url":"git://github.com/Microsoft/msbuild.git","ssh_url":"git@github.com:Microsoft/msbuild.git","clone_url":"https://github.com/Microsoft/msbuild.git","svn_url":"https://github.com/Microsoft/msbuild","homepage":null,"size":27393,"stargazers_count":3498,"watchers_count":3498,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":777,"mirror_url":null,"archived":false,"open_issues_count":851,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":777,"open_issues":851,"watchers":3498,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398"},"html":{"href":"https://github.com/Microsoft/msbuild/pull/3398"},"issue":{"href":"https://api.github.com/repos/Microsoft/msbuild/issues/3398"},"comments":{"href":"https://api.github.com/repos/Microsoft/msbuild/issues/3398/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/msbuild/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/msbuild/pulls/3398/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/msbuild/statuses/159e979fdd2a27bfb604f18a45906c4b16a6e3f8"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"cdmihai"}}