{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/arcade/pulls/comments/181891833","pull_request_review_id":112596244,"id":181891833,"diff_hunk":"@@ -56,113 +55,168 @@ if ($help -or (($properties -ne $null) -and ($properties.Contains(\"/help\") -or $\n   exit 0\n }\n \n-function CreateDirectory([string[]] $path) {\n+function Create-Directory([string[]] $path) {\n   if (!(Test-Path $path)) {\n     New-Item -path $path -force -itemType \"Directory\" | Out-Null\n   }\n }\n \n-function InstallDotNetCli {\n-  $installScript = \"$DotNetRoot\\dotnet-install.ps1\"\n+function InitializeDotNetCli {\n+  # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism\n+  $env:DOTNET_MULTILEVEL_LOOKUP=0\n+  \n+  # Disable first run since we do not need all ASP.NET packages restored.\n+  $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1\n+\n+  # Source Build uses DotNetCoreSdkDir variable\n+  if ($env:DotNetCoreSdkDir -ne $null) {\n+    $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir    \n+  }\n+\n+  # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, \n+  # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.\n+  if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR \"sdk\\$($GlobalJson.sdk.version)\"))) {\n+    $dotnetRoot = $env:DOTNET_INSTALL_DIR\n+  } else {\n+    $dotnetRoot = Join-Path $RepoRoot \".dotnet\"\n+    $env:DOTNET_INSTALL_DIR = $dotnetRoot\n+    \n+    if ($restore) {\n+      InstallDotNetCli $dotnetRoot\n+    }\n+  }\n+\n+  $global:BuildDriver = Join-Path $dotnetRoot \"dotnet.exe\"    \n+  $global:BuildArgs = \"msbuild\"\n+}\n+\n+function InstallDotNetCli([string] $dotnetRoot) {\n+  $installScript = \"$dotnetRoot\\dotnet-install.ps1\"\n   if (!(Test-Path $installScript)) { \n-    CreateDirectory $DotNetRoot\n+    Create-Directory $dotnetRoot\n     Invoke-WebRequest \"https://dot.net/v1/dotnet-install.ps1\" -OutFile $installScript\n   }\n   \n-  & $installScript -Version $GlobalJson.sdk.version -InstallDir $DotNetRoot\n+  & $installScript -Version $GlobalJson.sdk.version -InstallDir $dotnetRoot\n   if ($lastExitCode -ne 0) {\n     throw \"Failed to install dotnet cli (exit code '$lastExitCode').\"\n   }\n }\n \n-# This is a temporary workaround for https://github.com/Microsoft/msbuild/issues/2095 and\n-# https://github.com/dotnet/cli/issues/6589\n-# Currently, SDK's always get resolved to the global location, but we want our packages\n-# to all be installed into a local folder (prevent machine contamination from global state).\n-# \n-# We are restoring all of our packages locally and setting NuGetPackageRoot to reference the\n-# local location, but this breaks Custom SDK's which are expecting the SDK to be available\n-# from the global user folder.\n-function MakeGlobalSdkAvailableLocal {\n-  $RepoToolsetSource = Join-Path $DefaultNuGetPackageRoot \"roslyntools.repotoolset\\$ToolsetVersion\\\"\n-  $RepoToolsetDestination = Join-Path $NuGetPackageRoot \"roslyntools.repotoolset\\$ToolsetVersion\\\"\n-  if (!(Test-Path $RepoToolsetDestination)) {\n-    Copy-Item $RepoToolsetSource -Destination $RepoToolsetDestination -Recurse\n+function InitializeVisualStudioBuild {\n+  $inVSEnvironment = !($env:VS150COMNTOOLS -eq $null) -and (Test-Path $env:VS150COMNTOOLS)\n+\n+  if ($inVSEnvironment) {\n+    $vsInstallDir = Join-Path $env:VS150COMNTOOLS \"..\\..\"\n+  } else {    \n+    $vsInstallDir = LocateVisualStudio\n+  \n+    $env:VS150COMNTOOLS = Join-Path $vsInstallDir \"Common7\\Tools\\\"\n+    $env:VSSDK150Install = Join-Path $vsInstallDir \"VSSDK\\\"\n+    $env:VSSDKInstall = Join-Path $vsInstallDir \"VSSDK\\\"\n   }\n+\n+  $global:BuildDriver = Join-Path $vsInstallDir \"MSBuild\\15.0\\Bin\\msbuild.exe\"\n+  $global:BuildArgs = \"/nodeReuse:$(!$ci)\"\n }\n-function InstallToolset {\n-  if (!(Test-Path $ToolsetBuildProj)) {\n-    CreateDirectory $TempDir\n \n-    $proj = Join-Path $TempDir \"_restore.proj\"\n-    '<Project Sdk=\"RoslynTools.RepoToolset\"><Target Name=\"NoOp\"/></Project>' | Set-Content $proj\n-    & $DotNetExe msbuild $proj /t:NoOp /m /nologo /clp:None /warnaserror /v:$verbosity /p:NuGetPackageRoot=$NuGetPackageRoot /p:__ExcludeSdkImports=true\n+function LocateVisualStudio {\n+  $vswhereVersion = $GlobalJson.vswhere.version\n+  $toolsRoot = Join-Path $RepoRoot \".tools\"\n+  $vsWhereDir = Join-Path $toolsRoot \"vswhere\\$vswhereVersion\"\n+  $vsWhereExe = Join-Path $vsWhereDir \"vswhere.exe\"\n+\n+  if (!(Test-Path $vsWhereExe)) {\n+    Create-Directory $vsWhereDir\n+    Write-Host \"Downloading vswhere\"\n+    Invoke-WebRequest \"https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe\" -OutFile $vswhereExe\n   }\n-}\n \n-function Build {\n-  if ($OfficialBuild) {\n-    MakeGlobalSdkAvailableLocal\n+  $vsInstallDir = & $vsWhereExe -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VSSDK -requires Microsoft.Net.Component.4.6.TargetingPack -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -requires Microsoft.VisualStudio.Component.VSSDK\n+\n+  if (!(Test-Path $vsInstallDir)) {\n+    throw \"Failed to locate Visual Studio (exit code '$lastExitCode').\"\n   }\n \n-  if ($ci -or $log) {\n-    CreateDirectory($logDir)\n-    $logCmd = \"/bl:\" + (Join-Path $LogDir \"Build.binlog\")\n-  } else {\n-    $logCmd = \"\"\n+  return $vsInstallDir\n+}\n+\n+function InitializeToolset {\n+  if (!(Test-Path $ToolsetBuildProj)) {\n+   $proj = Join-Path $TempDir \"_restore.proj\"   \n+   '<Project Sdk=\"RoslynTools.RepoToolset\"><Target Name=\"NoOp\"/></Project>' | Set-Content $proj\n+    & $BuildDriver $BuildArgs $proj /t:NoOp /m /nologo /clp:None /warnaserror /v:$verbosity /p:NuGetPackageRoot=$NuGetPackageRoot /p:__ExcludeSdkImports=true","path":"eng/common/build.ps1","position":159,"original_position":159,"commit_id":"3f5b64f4292fb83d98faefa7e16013a06264277e","original_commit_id":"3f5b64f4292fb83d98faefa7e16013a06264277e","user":{"login":"chcosta","id":10092143,"avatar_url":"https://avatars3.githubusercontent.com/u/10092143?v=4","gravatar_id":"","url":"https://api.github.com/users/chcosta","html_url":"https://github.com/chcosta","followers_url":"https://api.github.com/users/chcosta/followers","following_url":"https://api.github.com/users/chcosta/following{/other_user}","gists_url":"https://api.github.com/users/chcosta/gists{/gist_id}","starred_url":"https://api.github.com/users/chcosta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chcosta/subscriptions","organizations_url":"https://api.github.com/users/chcosta/orgs","repos_url":"https://api.github.com/users/chcosta/repos","events_url":"https://api.github.com/users/chcosta/events{/privacy}","received_events_url":"https://api.github.com/users/chcosta/received_events","type":"User","site_admin":false},"body":"Consider adding some of the redundant args between this function and \"Build\" into \"BuildArgs\".  ie `/m /nologo /warnaserror /v:$verbosity /p:NuGetPackageRoot=$NuGetPackageRoot`","created_at":"2018-04-16T21:30:01Z","updated_at":"2018-04-16T21:41:58Z","html_url":"https://github.com/dotnet/arcade/pull/104#discussion_r181891833","pull_request_url":"https://api.github.com/repos/dotnet/arcade/pulls/104","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/arcade/pulls/comments/181891833"},"html":{"href":"https://github.com/dotnet/arcade/pull/104#discussion_r181891833"},"pull_request":{"href":"https://api.github.com/repos/dotnet/arcade/pulls/104"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/arcade/pulls/104","id":178647847,"html_url":"https://github.com/dotnet/arcade/pull/104","diff_url":"https://github.com/dotnet/arcade/pull/104.diff","patch_url":"https://github.com/dotnet/arcade/pull/104.patch","issue_url":"https://api.github.com/repos/dotnet/arcade/issues/104","number":104,"state":"open","locked":false,"title":"Update to RepoToolset beta2-62730-01 and sync bootstrap scripts","user":{"login":"tmat","id":41759,"avatar_url":"https://avatars0.githubusercontent.com/u/41759?v=4","gravatar_id":"","url":"https://api.github.com/users/tmat","html_url":"https://github.com/tmat","followers_url":"https://api.github.com/users/tmat/followers","following_url":"https://api.github.com/users/tmat/following{/other_user}","gists_url":"https://api.github.com/users/tmat/gists{/gist_id}","starred_url":"https://api.github.com/users/tmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmat/subscriptions","organizations_url":"https://api.github.com/users/tmat/orgs","repos_url":"https://api.github.com/users/tmat/repos","events_url":"https://api.github.com/users/tmat/events{/privacy}","received_events_url":"https://api.github.com/users/tmat/received_events","type":"User","site_admin":false},"body":"I have restructured build.sh and build.ps1 to match each other closer.","created_at":"2018-03-30T22:41:27Z","updated_at":"2018-04-16T21:41:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"13d06c1a502a774e33260284a8c0772b7bbf9937","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/arcade/pulls/104/commits","review_comments_url":"https://api.github.com/repos/dotnet/arcade/pulls/104/comments","review_comment_url":"https://api.github.com/repos/dotnet/arcade/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/arcade/issues/104/comments","statuses_url":"https://api.github.com/repos/dotnet/arcade/statuses/3f5b64f4292fb83d98faefa7e16013a06264277e","head":{"label":"tmat:RT-beta2-62730-01","ref":"RT-beta2-62730-01","sha":"3f5b64f4292fb83d98faefa7e16013a06264277e","user":{"login":"tmat","id":41759,"avatar_url":"https://avatars0.githubusercontent.com/u/41759?v=4","gravatar_id":"","url":"https://api.github.com/users/tmat","html_url":"https://github.com/tmat","followers_url":"https://api.github.com/users/tmat/followers","following_url":"https://api.github.com/users/tmat/following{/other_user}","gists_url":"https://api.github.com/users/tmat/gists{/gist_id}","starred_url":"https://api.github.com/users/tmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmat/subscriptions","organizations_url":"https://api.github.com/users/tmat/orgs","repos_url":"https://api.github.com/users/tmat/repos","events_url":"https://api.github.com/users/tmat/events{/privacy}","received_events_url":"https://api.github.com/users/tmat/received_events","type":"User","site_admin":false},"repo":{"id":127478333,"name":"arcade","full_name":"tmat/arcade","owner":{"login":"tmat","id":41759,"avatar_url":"https://avatars0.githubusercontent.com/u/41759?v=4","gravatar_id":"","url":"https://api.github.com/users/tmat","html_url":"https://github.com/tmat","followers_url":"https://api.github.com/users/tmat/followers","following_url":"https://api.github.com/users/tmat/following{/other_user}","gists_url":"https://api.github.com/users/tmat/gists{/gist_id}","starred_url":"https://api.github.com/users/tmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmat/subscriptions","organizations_url":"https://api.github.com/users/tmat/orgs","repos_url":"https://api.github.com/users/tmat/repos","events_url":"https://api.github.com/users/tmat/events{/privacy}","received_events_url":"https://api.github.com/users/tmat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tmat/arcade","description":"Tools that provide common build infrastructure for multiple .NET Foundation projects.","fork":true,"url":"https://api.github.com/repos/tmat/arcade","forks_url":"https://api.github.com/repos/tmat/arcade/forks","keys_url":"https://api.github.com/repos/tmat/arcade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tmat/arcade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tmat/arcade/teams","hooks_url":"https://api.github.com/repos/tmat/arcade/hooks","issue_events_url":"https://api.github.com/repos/tmat/arcade/issues/events{/number}","events_url":"https://api.github.com/repos/tmat/arcade/events","assignees_url":"https://api.github.com/repos/tmat/arcade/assignees{/user}","branches_url":"https://api.github.com/repos/tmat/arcade/branches{/branch}","tags_url":"https://api.github.com/repos/tmat/arcade/tags","blobs_url":"https://api.github.com/repos/tmat/arcade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tmat/arcade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tmat/arcade/git/refs{/sha}","trees_url":"https://api.github.com/repos/tmat/arcade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tmat/arcade/statuses/{sha}","languages_url":"https://api.github.com/repos/tmat/arcade/languages","stargazers_url":"https://api.github.com/repos/tmat/arcade/stargazers","contributors_url":"https://api.github.com/repos/tmat/arcade/contributors","subscribers_url":"https://api.github.com/repos/tmat/arcade/subscribers","subscription_url":"https://api.github.com/repos/tmat/arcade/subscription","commits_url":"https://api.github.com/repos/tmat/arcade/commits{/sha}","git_commits_url":"https://api.github.com/repos/tmat/arcade/git/commits{/sha}","comments_url":"https://api.github.com/repos/tmat/arcade/comments{/number}","issue_comment_url":"https://api.github.com/repos/tmat/arcade/issues/comments{/number}","contents_url":"https://api.github.com/repos/tmat/arcade/contents/{+path}","compare_url":"https://api.github.com/repos/tmat/arcade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tmat/arcade/merges","archive_url":"https://api.github.com/repos/tmat/arcade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tmat/arcade/downloads","issues_url":"https://api.github.com/repos/tmat/arcade/issues{/number}","pulls_url":"https://api.github.com/repos/tmat/arcade/pulls{/number}","milestones_url":"https://api.github.com/repos/tmat/arcade/milestones{/number}","notifications_url":"https://api.github.com/repos/tmat/arcade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tmat/arcade/labels{/name}","releases_url":"https://api.github.com/repos/tmat/arcade/releases{/id}","deployments_url":"https://api.github.com/repos/tmat/arcade/deployments","created_at":"2018-03-30T22:24:55Z","updated_at":"2018-03-30T22:24:57Z","pushed_at":"2018-03-30T22:45:58Z","git_url":"git://github.com/tmat/arcade.git","ssh_url":"git@github.com:tmat/arcade.git","clone_url":"https://github.com/tmat/arcade.git","svn_url":"https://github.com/tmat/arcade","homepage":"","size":156,"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":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"19a8d7a90910ec43d23026cf9ddd8da2f1c48d21","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":121444325,"name":"arcade","full_name":"dotnet/arcade","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/arcade","description":"Tools that provide common build infrastructure for multiple .NET Foundation projects.","fork":false,"url":"https://api.github.com/repos/dotnet/arcade","forks_url":"https://api.github.com/repos/dotnet/arcade/forks","keys_url":"https://api.github.com/repos/dotnet/arcade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/arcade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/arcade/teams","hooks_url":"https://api.github.com/repos/dotnet/arcade/hooks","issue_events_url":"https://api.github.com/repos/dotnet/arcade/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/arcade/events","assignees_url":"https://api.github.com/repos/dotnet/arcade/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/arcade/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/arcade/tags","blobs_url":"https://api.github.com/repos/dotnet/arcade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/arcade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/arcade/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/arcade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/arcade/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/arcade/languages","stargazers_url":"https://api.github.com/repos/dotnet/arcade/stargazers","contributors_url":"https://api.github.com/repos/dotnet/arcade/contributors","subscribers_url":"https://api.github.com/repos/dotnet/arcade/subscribers","subscription_url":"https://api.github.com/repos/dotnet/arcade/subscription","commits_url":"https://api.github.com/repos/dotnet/arcade/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/arcade/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/arcade/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/arcade/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/arcade/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/arcade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/arcade/merges","archive_url":"https://api.github.com/repos/dotnet/arcade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/arcade/downloads","issues_url":"https://api.github.com/repos/dotnet/arcade/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/arcade/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/arcade/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/arcade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/arcade/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/arcade/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/arcade/deployments","created_at":"2018-02-13T22:29:54Z","updated_at":"2018-04-14T00:01:46Z","pushed_at":"2018-04-14T00:01:45Z","git_url":"git://github.com/dotnet/arcade.git","ssh_url":"git@github.com:dotnet/arcade.git","clone_url":"https://github.com/dotnet/arcade.git","svn_url":"https://github.com/dotnet/arcade","homepage":"","size":164,"stargazers_count":3,"watchers_count":3,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":66,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":9,"open_issues":66,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/arcade/pulls/104"},"html":{"href":"https://github.com/dotnet/arcade/pull/104"},"issue":{"href":"https://api.github.com/repos/dotnet/arcade/issues/104"},"comments":{"href":"https://api.github.com/repos/dotnet/arcade/issues/104/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/arcade/pulls/104/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/arcade/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/arcade/pulls/104/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/arcade/statuses/3f5b64f4292fb83d98faefa7e16013a06264277e"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"chcosta"}}