-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExecute-RealRazzle.ps1
More file actions
125 lines (103 loc) · 3.93 KB
/
Execute-RealRazzle.ps1
File metadata and controls
125 lines (103 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
[CmdLetBinding()]
param(
$razzle,
$arch,
$flavor,
$binaries,
$depotRoot,
[switch]$noPrompt,
[switch]$noSymbolicLinks)
function New-RazzleLink($linkName, $binaries)
{
if ($noSymbolicLinks.IsPresent)
{
return;
}
Write-Verbose "Linking $linkName -> $binaries ..."
if (!(test-path $binaries))
{
Write-Verbose "Making new dir $binaries"
mkdir $binaries | Out-Null
}
$currentTarget = $null
if (test-path $linkName)
{
$currentTarget = (Get-Item $linkName).Target
}
if (($currentTarget -eq $null) -or ($currentTarget -ne $binaries))
{
Write-Verbose "Making new link $linkName -> $binaries"
gsudo New-Item $linkName -ItemType SymbolicLink -Target $binaries -Force
}
}
function Retarget-OSRazzle($binariesRoot, $srcRoot = $env:OSBuildRoot)
{
Write-Verbose "Retarget-OSRazzle"
if ($noSymbolicLinks.IsPresent) {
return;
}
Write-Verbose ("Retargeting $srcRoot -> $binariesRoot")
Push-Location ($srcRoot+"\src")
$binRoot = $srcRoot.Replace("f:","w:")
$binRoot = $binRoot.Replace("F:","w:")
$binRoot = $binRoot.Replace("c:\src","w:")
$binRoot = $binRoot.Replace("C:\src","w:")
Write-Verbose "Branch binRoot is $binRoot"
Pop-Location
New-RazzleLink "$binariesPrefix\os" $binRoot
New-RazzleLink ($srcRoot+"\bin") ($binRoot+"\bin")
New-RazzleLink ($srcRoot+"\bldcache") ($binRoot+"\bldcache")
New-RazzleLink ($srcRoot+"\bldout") ($binRoot+"\bldout")
New-RazzleLink ($srcRoot+"\cdg") ($binRoot+"\cdg")
New-RazzleLink ($srcRoot+"\intl") ($binRoot+"\intl")
New-RazzleLink ($srcRoot+"\engcache") ($binRoot+"\engcache")
New-RazzleLink ($srcRoot+"\pgo") ($binRoot+"\pgo")
New-RazzleLink ($srcRoot+"\public") ($binRoot+"\public")
New-RazzleLink ($srcRoot+"\pubpkg") ($binRoot+"\pubpkg")
New-RazzleLink ($srcRoot+"\obj") ($binRoot+"\obj")
New-RazzleLink ($srcRoot+"\osdep") ($binRoot+"\osdep")
New-RazzleLink ($srcRoot+"\out") ($binRoot+"\out")
New-RazzleLink ($srcRoot+"\Temp") ($binRoot+"\Temp")
New-RazzleLink ($srcRoot+"\tools") ($binRoot+"\tools")
New-RazzleLink ($srcRoot+"\utilities") ($binRoot+"\utilities")
New-RazzleLink ($binRoot+"\src") ($srcRoot+"\src")
New-RazzleLink ($srcRoot+"\TestPayload") ($binRoot+"\TestPayload")
Write-Verbose ("Retargeting done")
}
function Retarget-Razzle
{
Write-Verbose "Retarget-Razzle"
if ($noSymbolicLinks.IsPresent) {
return;
}
Write-Verbose ("Retargeting common paths")
New-RazzleLink "c:\Symbols" "$binariesPrefix\Symbols"
New-RazzleLink "c:\Symcache" "$binariesPrefix\Symbols"
New-RazzleLink "c:\Sym" "$binariesPrefix\Symbols"
#New-RazzleLink $env:temp "$binariesPrefix\Temp"
New-RazzleLink $env:HOMEDRIVE$env:HOMEPATH\.nuget "$binariesPrefix\NuGet"
New-RazzleLink "c:\Temp" "$binariesPrefix\Temp"
New-RazzleLink "c:\Logs" "$binariesPrefix\Logs"
New-RazzleLink "c:\CrashDumps" "$binariesPrefix\CrashDumps"
New-RazzleLink "c:\ProgramData\dbg\Sym" "$binariesPrefix\Symbols"
New-RazzleLink "c:\ProgramData\dbg\Src" "$binariesPrefix\src"
Write-Verbose ("Retargeting done")
}
Write-Verbose "Execute-RealRazzle"
Remove-Item "$env:_XOSROOT\*.$arch.$flavor.env.json" -Exclude $env:EnlistmentEnv
Retarget-Razzle
Retarget-OSRazzle $binaries (Get-item $depotRoot).Parent.FullName
$arch = $arch.Replace("x64","amd64")
$setRazzlePs1Dir = "$env:_XROOT\developer\$env:USERNAME"
Write-Verbose "Reseting setrazzle.ps1: $setRazzlePs1Dir"
mkdir $setRazzlePs1Dir -ErrorAction Ignore | Out-Null
$setRazzlePs1 = "$setRazzlePs1Dir\setrazzle.ps1"
Set-Content "" -Path $setRazzlePs1
if ($noPrompt) {
$args += "noprompt"
}
Write-Verbose ".$razzle $flavor $arch $env:RazzleOptions $args"
.$razzle $flavor $arch $env:RazzleOptions @args
$envData = Get-ChildItem env: | Select-Object -Property Name,Value
$envData | ConvertTo-Json -Depth 2 | Set-Content $env:EnlistmentEnv
Write-Verbose "Stored razzle environment in '$env:EnlistmentEnv'"