@@ -24,136 +24,52 @@ function ZipContent([string] $sourceDirectory, [string] $target)
24
24
[IO.Compression.ZipFile ]::CreateFromDirectory($sourceDirectory , $target )
25
25
}
26
26
27
- function CrossGen ([string ] $runtime , [string ] $publishTarget , [string ] $privateSiteExtensionPath )
28
- {
29
- Write-Host " publishTarget: " $publishTarget
30
- Write-Host " privateSiteExtensionPath: " $privateSiteExtensionPath
31
-
32
- $selfContained = Join-Path $publishTarget " self-contained"
33
- $crossGen = " $publishTarget \download\crossgen\crossgen.exe"
34
- $symbolsPath = Join-Path $publishTarget " Symbols"
35
- new-item - itemtype directory - path $symbolsPath
36
-
37
- # https://dotnet.myget.org/feed/dotnet-core/package/nuget/runtime.win-x86.Microsoft.NETCore.Jit
38
- DownloadNupkg " https://dotnet.myget.org/F/dotnet-core/api/v2/package/runtime.$runtime .Microsoft.NETCore.Jit/2.2.0-servicing-26820-03" @ (" runtimes\$runtime \native\clrjit.dll" ) @ (" $publishTarget \download\clrjit" )
39
- # https://dotnet.myget.org/feed/dotnet-core/package/nuget/runtime.win-x86.Microsoft.NETCore.Runtime.CoreCLR
40
- DownloadNupkg " https://dotnet.myget.org/F/dotnet-core/api/v2/package/runtime.$runtime .Microsoft.NETCore.Runtime.CoreCLR/2.2.0-servicing-26820-03" @ (" tools\crossgen.exe" ) @ (" $publishTarget \download\crossgen" )
41
-
42
- # Publish self-contained app with all required dlls for crossgen
43
- dotnet publish .\src\WebJobs.Script.WebHost\WebJobs.Script.WebHost.csproj - r $runtime - o " $selfContained " - v q / p:BuildNumber= $buildNumber
44
-
45
- # Modify web.config for inproc
46
- dotnet tool install - g dotnet- xdt -- version 2.1 .0 2> $null
47
- dotnet- xdt - s " $privateSiteExtensionPath \web.config" - t " $privateSiteExtensionPath \web.InProcess.$runtime .xdt" - o " $privateSiteExtensionPath \web.config"
48
-
49
- $successfullDlls = @ ()
50
- $failedDlls = @ ()
51
-
52
- Get-ChildItem $privateSiteExtensionPath - Filter * .dll |
53
- Foreach-Object {
54
- $prm = " /JITPath" , " $publishTarget \download\clrjit\clrjit.dll" , " /Platform_Assemblies_Paths" , " $selfContained " , " /nologo" , " /in" , $_.FullName
55
- # output for Microsoft.Azure.WebJobs.Script.WebHost.dll is Microsoft.Azure.WebJobs.Script.WebHost.exe.dll by default
56
- if ($_.FullName -like " *Microsoft.Azure.WebJobs.Script.WebHost.dll" ) {
57
- $prm += " /out"
58
- $prm += Join-Path $privateSiteExtensionPath " Microsoft.Azure.WebJobs.Script.WebHost.ni.dll"
59
- }
60
-
61
- & $crossGen $prm >> $buildOutput \crossgenout.$runtime.txt 2>&1
62
-
63
- $niDll = Join-Path $privateSiteExtensionPath $ ([io.path ]::GetFileNameWithoutExtension($_.FullName ) + " .ni.dll" )
64
- if ([System.IO.File ]::Exists($niDll )) {
65
- Remove-Item $_.FullName
66
- Rename-Item - Path $niDll - NewName $_.FullName
67
-
68
- & $crossGen " /Platform_Assemblies_Paths" , " $selfContained " , " /CreatePDB" , " $symbolsPath " , $_.FullName >> $buildOutput \crossgenout- PDBs.$runtime.txt 2>&1
69
-
70
- $successfullDlls += [io.path ]::GetFileName($_.FullName )
71
- } else {
72
- $failedDlls += [io.path ]::GetFileName($_.FullName )
73
- }
74
- }
75
-
76
- # print results of crossgen process
77
- $successfullDllsCount = $successfullDlls.length
78
- $failedDllsCount = $failedDlls.length
79
- Write-Host " CrossGen($runtime ) results: Successfull: $successfullDllsCount , Failed: $failedDllsCount "
80
- if ($failedDlls.length -gt 0 ) {
81
- Write-Host " Failed CrossGen dlls:"
82
- Write-Host $failedDlls
83
- }
84
-
85
-
86
- if ($runtime -eq " win-x86" ) {
87
- Copy-Item - Path $privateSiteExtensionPath \runtimes\win\native\* - Destination $privateSiteExtensionPath - Force
88
- }
89
-
90
- # read-host "Press ENTER to continue..."
91
- Remove-Item - Recurse - Force $selfContained - ErrorAction SilentlyContinue
92
- Remove-Item - Recurse - Force $publishTarget \download - ErrorAction SilentlyContinue
93
- }
94
-
95
- function AddDiaSymReaderToPath ()
96
- {
97
- $infoContent = dotnet -- info
98
- $sdkBasePath = $infoContent |
99
- Where-Object {$_ -match ' Base Path:' } |
100
- ForEach-Object {
101
- $_ -replace ' \s+Base Path:' , ' '
102
- }
103
-
104
- $diaSymPath = Join-Path $sdkBasePath.Trim () " Roslyn\bincore\runtimes\win\native"
105
-
106
- Write-Host " Adding DiaSymReader location to path ($diaSymPath )" - ForegroundColor Yellow
107
- $env: Path = " $diaSymPath ;$env: Path "
108
- }
109
-
110
- function DownloadNupkg ([string ] $nupkgPath , [string []]$from , [string []]$to ) {
111
- $tempFolderName = [System.IO.Path ]::GetFileNameWithoutExtension([System.IO.Path ]::GetTempFileName())
112
- $tempFolder = [System.IO.Path ]::Combine([System.IO.Path ]::GetTempPath() , $tempFolderName )
113
- [System.IO.Directory ]::CreateDirectory($tempFolder )
114
- Remove-Item $tempFolder
115
- $tempFile = [System.IO.Path ]::GetTempFileName() |
116
- Rename-Item - NewName { $_ -replace ' tmp$' , ' zip' } - PassThru
117
-
118
- Write-Host " Downloading '$nupkgPath ' to '$tempFile '"
119
- Invoke-WebRequest - Uri $nupkgPath - OutFile $tempFile
120
- Write-Host " Extracting from '$tempFile ' to '$tempFolder '"
121
- Add-Type - AssemblyName System.IO.Compression.FileSystem
122
- [System.IO.Compression.ZipFile ]::ExtractToDirectory($tempFile , $tempFolder )
123
-
124
- # copy nupkg files
125
- for ($i = 0 ; $i -lt $from.length ; $i ++ ) {
126
- New-Item $to - Type Directory - Force
127
- Copy-Item - Path $ (" $tempFolder \" + $from [$i ]) - Destination $ ($to [$i ] + " \" ) - Force - Verbose
128
- }
129
- }
130
-
131
27
function BuildPackages ([bool ] $isNoRuntime ) {
132
28
if ($isNoRuntime ) {
133
29
BuildOutput " "
134
30
$applicationHost = Get-Content $buildOutput \publish.no- runtime\SiteExtensions\Functions\applicationHost.xdt
135
31
$applicationHost -replace " \\%XDT_BITNESS%" , " " | Out-File $buildOutput \publish.no- runtime\SiteExtensions\Functions\applicationHost.xdt
136
32
137
33
CreateZips " .no-runtime"
138
- } else {
139
- BuildOutput " win-x86"
140
- BuildOutput " win-x64"
141
-
34
+ } else {
35
+ BuildOutput " win-x86" 1
36
+ BuildOutput " win-x64" 1
37
+ BuildOutput " win-x86" 0
38
+ BuildOutput " win-x64" 0
39
+
40
+ # Use self-contained as the site extension until Antares has .NET Core 3 deployed.
41
+ # Ignore 64bit folder
142
42
New-Item - Itemtype directory - path $buildOutput \publish.runtime\SiteExtensions\Functions
143
- Move-Item - Path $buildOutput \publish.win- x86\SiteExtensions\Functions - Destination $buildOutput \publish.runtime\SiteExtensions\Functions\32bit - Force
144
- Move-Item - Path $buildOutput \publish.win- x64\SiteExtensions\Functions - Destination $buildOutput \publish.runtime\SiteExtensions\Functions\64bit - Force
145
- Move-Item - Path $buildOutput \publish.runtime\SiteExtensions\Functions\32bit\applicationHost.xdt - Destination $buildOutput \publish.runtime\SiteExtensions\Functions - Force
146
- Remove-Item - Path $buildOutput \publish.runtime\SiteExtensions\Functions\64bit\applicationHost.xdt
43
+ Copy-Item - Path $buildOutput \publish.win- x86.self- contained\SiteExtensions\Functions - Destination $buildOutput \publish.runtime\SiteExtensions\Functions\32bit - Recurse - Force
44
+ # Move-Item -Path $buildOutput\publish.win-x64\SiteExtensions\Functions -Destination $buildOutput\publish.runtime\SiteExtensions\Functions\64bit -Force
45
+ Copy-Item - Path $buildOutput \publish.runtime\SiteExtensions\Functions\32bit\applicationHost.xdt - Destination $buildOutput \publish.runtime\SiteExtensions\Functions - Force
46
+
47
+ # To minimize size skip 64bit folder.
48
+ # Until site extension is in Antares, use self-contained.
49
+ New-Item - Itemtype directory - path $buildOutput \publish.self- contained\SiteExtensions\Functions
50
+ Move-Item - Path $buildOutput \publish.win- x86.self- contained\SiteExtensions\Functions - Destination $buildOutput \publish.self- contained\SiteExtensions\Functions\32bit - Force
51
+ Copy-Item - Path $buildOutput \publish.runtime\SiteExtensions\Functions\applicationHost.xdt - Destination $buildOutput \publish.self- contained\SiteExtensions\Functions - Force
52
+
53
+ # Remove-Item -Path $buildOutput\publish.runtime\SiteExtensions\Functions\64bit\applicationHost.xdt
147
54
148
55
CreateZips " .runtime"
149
56
}
150
57
}
151
58
152
59
153
- function BuildOutput ([string ] $runtime ) {
60
+ function BuildOutput ([string ] $runtime , [ bool ] $isSelfContained ) {
154
61
$runtimeSuffix = " "
155
- if (! [string ]::IsNullOrEmpty($runtime )) {
62
+ $ridSwitch = " "
63
+ $hasRuntime = ! [string ]::IsNullOrEmpty($runtime )
64
+
65
+ if ($hasRuntime -and ! $isSelfContained ) {
66
+ Write-Host " Building $runtime "
156
67
$runtimeSuffix = " .$runtime "
68
+ $ridSwitch = " -r" , " $runtime " , " --self-contained" , " false" , " /p:PublishReadyToRun=true"
69
+ } elseif ($hasRuntime -and $isSelfContained ) {
70
+ Write-Host " Building $runtime self-contained"
71
+ $runtimeSuffix = " .$runtime .self-contained"
72
+ $ridSwitch = " -r" , " $runtime " , " --self-contained" , " true" , " /p:PublishReadyToRun=true" , " /p:PublishReadyToRunEmitSymbols=true"
157
73
} else {
158
74
$runtimeSuffix = " .no-runtime"
159
75
}
@@ -162,16 +78,17 @@ function BuildOutput([string] $runtime) {
162
78
$siteExtensionPath = " $publishTarget \SiteExtensions"
163
79
$privateSiteExtensionPath = " $siteExtensionPath \Functions"
164
80
165
- dotnet publish .\src\WebJobs.Script.WebHost\WebJobs.Script.WebHost.csproj - o " $privateSiteExtensionPath " - v q / p:BuildNumber= $buildNumber / p:IsPackable= false - c Release
166
-
167
- # replace IL dlls with crossgen dlls
168
- # TODO: Re-add this.
169
- # if (![string]::IsNullOrEmpty($runtime)) {
170
- # CrossGen $runtime $publishTarget $privateSiteExtensionPath
171
- # }
81
+ New-Item - Itemtype directory - path $privateSiteExtensionPath
82
+
83
+ dotnet publish .\src\WebJobs.Script.WebHost\WebJobs.Script.WebHost.csproj $ridSwitch - o " $privateSiteExtensionPath " - v q / p:BuildNumber= $buildNumber / p:IsPackable= false - c Release
84
+
85
+ if ($hasRuntime -and $isSelfContained ) {
86
+ Write-Host " Moving symbols"
87
+ New-Item - Itemtype directory - path $publishTarget \Symbols
88
+ Move-Item - Path $privateSiteExtensionPath \* .pdb - Destination $publishTarget \Symbols
89
+ }
172
90
}
173
91
174
-
175
92
function CreateZips ([string ] $runtimeSuffix ) {
176
93
$publishTarget = " $buildOutput \publish$runtimeSuffix "
177
94
$siteExtensionPath = " $publishTarget \SiteExtensions"
@@ -188,8 +105,6 @@ function CreateZips([string] $runtimeSuffix) {
188
105
# Project cleanup (trim some project files - this should be revisited)
189
106
cleanExtension " "
190
107
191
-
192
-
193
108
# Make the zip
194
109
ZipContent $publishTarget " $buildOutput \Functions.Private.$extensionVersion$runtimeSuffix .zip"
195
110
@@ -198,17 +113,15 @@ function CreateZips([string] $runtimeSuffix) {
198
113
cleanExtension " 32bit"
199
114
cleanExtension " 64bit"
200
115
201
- # Create private extension for internal usage. To minimize size remove 64bit folder.
116
+ # Create private extension for internal usage.
202
117
$tempPath = " $buildOutput \win-x32.inproc.temp\SiteExtensions"
203
118
204
119
# Make a temp location
205
120
New-Item - Itemtype directory - path $tempPath - ErrorAction SilentlyContinue
206
121
207
122
# Copy all files to temp folder
208
- Copy-Item - Path $privateSiteExtensionPath - Destination $tempPath - Recurse
209
-
210
- # Delete x64 folder to reduce size
211
- Remove-Item " $tempPath \Functions\64bit" - Recurse
123
+ $selfContainedPath = " $buildOutput \publish.self-contained\SiteExtensions\Functions"
124
+ Copy-Item - Path $selfContainedPath - Destination $tempPath - Recurse
212
125
213
126
# Make the zip
214
127
ZipContent " $buildOutput \win-x32.inproc.temp" " $buildOutput \Functions.Private.$extensionVersion .win-x32.inproc.zip"
@@ -218,16 +131,16 @@ function CreateZips([string] $runtimeSuffix) {
218
131
219
132
# Zip up symbols for builds with runtime embedded
220
133
if ($runtimeSuffix -eq " " ) {
221
- ZipContent " $buildOutput \publish.win-x86\Symbols" " $buildOutput \Functions.Symbols.$extensionVersion .win-x86.zip"
222
- ZipContent " $buildOutput \publish.win-x64\Symbols" " $buildOutput \Functions.Symbols.$extensionVersion .win-x64.zip"
134
+ ZipContent " $buildOutput \publish.win-x86.self-contained \Symbols" " $buildOutput \Functions.Symbols.$extensionVersion .win-x86.zip"
135
+ ZipContent " $buildOutput \publish.win-x64.self-contained \Symbols" " $buildOutput \Functions.Symbols.$extensionVersion .win-x64.zip"
223
136
}
224
137
225
138
# Build site extension
226
139
Write-Host " privateSiteExtensionPath: " $privateSiteExtensionPath
227
140
Rename-Item " $privateSiteExtensionPath " " $siteExtensionPath \$extensionVersion "
228
141
Copy-Item .\src\WebJobs.Script.WebHost\extension.xml " $siteExtensionPath "
229
- ZipContent $siteExtensionPath " $buildOutput \Functions.$extensionVersion$runtimeSuffix .zip"
230
142
143
+ ZipContent $siteExtensionPath " $buildOutput \Functions.$extensionVersion$runtimeSuffix .zip"
231
144
}
232
145
233
146
function cleanExtension ([string ] $bitness ) {
@@ -254,12 +167,12 @@ $projects =
254
167
" WebJobs.Script" ,
255
168
" WebJobs.Script.WebHost" ,
256
169
" WebJobs.Script.Grpc"
257
-
170
+
258
171
foreach ($project in $projects )
259
172
{
260
173
261
174
$cmd = " pack" , " src\$project \$project .csproj" , " -o" , " $buildOutput " , " --no-build" , " -p:PackageVersion=$extensionVersion "
262
-
175
+
263
176
& dotnet $cmd
264
177
}
265
178
@@ -274,9 +187,7 @@ $bypassPackaging = $env:APPVEYOR_PULL_REQUEST_NUMBER -and -not $env:APPVEYOR_PUL
274
187
if ($bypassPackaging ){
275
188
Write-Host " Bypassing artifact packaging and CrossGen for pull request." - ForegroundColor Yellow
276
189
} else {
277
- AddDiaSymReaderToPath
278
-
279
- # build no-runntime extension
190
+ # build no-runtime extension
280
191
BuildPackages 1
281
192
282
193
# build win-x86 and win-x64 extension
0 commit comments