Add SiteExtension.proj to replace build-extension.ps1 (#10168)

* Add SiteExtension.proj

* Publish workers, hash hard links

* Add workers.props, avoid publishing worker files

* Refactor how worker is packaged

* Add PrivateSiteExtension

* Fix duplicate build and file write error

* Comment and split out powershell regex match

* Fix MoveSymbols

* Publish PrivateSiteExtension

* Remove Python worker from private extension

* Zip site extension artifacts

* Clean dotnet worker files

* Default ZipArtifactsPath to PackageOutputPath

* Add comments, update dotnet sdk

* Add explicit CI restore stage

* Split out build stage as well

* Add python.props back in with redirection message

* Fix integration build issue

* Fix symbols output

* Revert python.props changes

* Revert global.json change

* Extract build site extension into template

* Remove build-extension.ps1

* Add build-extensions.ps1 back, with error directing to replacement

* Fix log publishing

* Fix check-vuln placement

* Fix deletion of code-sign summary files

* Fix symbol SBOM and artifact

* Add single/multi-tfm support for SiteExtension.proj

* Fix end-of-file line breaks

* Extract Workers to their own props files

* Fix ZipPublish when zip not specified

* Remove redundant python removal

* .proj -> .csproj

* Remove minorVersionPrefix

* Update CODEOWNERS

* Add EnsureWorkersFolder target

* Fix windows build

* Pack linux artifact

* Add release config

* Fix nuget signing path

* Add condition for hard link hashes

* Add IsZippable check and readme
This commit is contained in:
Jacob Viau 2024-11-14 09:38:18 -08:00 коммит произвёл GitHub
Родитель cc01cfae7f
Коммит 05fe9de98e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
28 изменённых файлов: 596 добавлений и 511 удалений

Просмотреть файл

@ -9,12 +9,9 @@
# Adding codeowner for Python specific files such that GitHub automatically adds python folks as a reviewer.
build/python.props @vrdmr @gavin-aguiar @YunchuWang @pdthummar @hallvictoria
eng/build/Workers.Python.props @vrdmr @gavin-aguiar @YunchuWang @pdthummar @hallvictoria
# Deps.json validation file
test/WebJobs.Script.Tests/Microsoft.Azure.WebJobs.Script.WebHost.deps.json @fabiocav @brettsam @mathewc
src/WebJobs.Script.WebHost/PreJIT/* @vrdmr @pragnagopa @eliaslopezgt @VpOfEngineering @azure/azure-functions-core
# CI owners
eng/ci/* @fabiocav @jviau @brettsam
src/WebJobs.Script.WebHost/PreJIT/* @vrdmr @pragnagopa @eliaslopezgt @azure/azure-functions-core

Просмотреть файл

@ -11,6 +11,7 @@
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<EngRoot>$(RepoRoot)eng/</EngRoot>
<TargetsRoot>$(EngRoot)build/</TargetsRoot>
</PropertyGroup>
<PropertyGroup>

Просмотреть файл

@ -1,5 +1,5 @@
<Project>
<Import Project="$(EngRoot)build/Engineering.targets" />
<Import Project="$(TargetsRoot)Engineering.targets" />
</Project>

Просмотреть файл

@ -1,219 +1 @@
param (
[string]$buildNumber = "0",
[string]$suffix = "",
[ValidateSet("6", "8", "")][string]$minorVersionPrefix = "",
[string]$hashesForHardlinksFile = "hashesForHardlinks.txt"
)
Import-Module "$PSScriptRoot\Get-AzureFunctionsVersion.psm1" -Force
$rootDir = Split-Path -Parent $PSScriptRoot
$outDir = "$rootDir\out"
$publishDir = "$outDir\pub\WebJobs.Script.WebHost"
$extensionVersion = Get-AzureFunctionsVersion $buildNumber $suffix $minorVersionPrefix
Write-Host "Site extension version: $extensionVersion"
function ZipContent([string] $sourceDirectory, [string] $target) {
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
Write-Host "======================================"
Write-Host "Zipping $sourceDirectory into $target"
if (Test-Path $target) {
Remove-Item $target
}
Add-Type -assembly "system.io.compression.filesystem"
[IO.Compression.ZipFile]::CreateFromDirectory($sourceDirectory, $target)
Write-Host "Done zipping $target. Elapsed: $($stopwatch.Elapsed)"
Write-Host "======================================"
Write-Host ""
}
function BuildRuntime([string] $targetRid, [bool] $isSelfContained) {
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
$publishTarget = "$publishDir\release_$targetRid"
$projectPath = "$rootDir\src\WebJobs.Script.WebHost\WebJobs.Script.WebHost.csproj"
if (-not (Test-Path $projectPath))
{
throw "Project path '$projectPath' does not exist."
}
$cmd = "publish", $projectPath , "-r", "$targetRid", "--self-contained", "$isSelfContained", "-v", "m", "-c", "Release", "-p:IsPackable=false", "-p:BuildNumber=$buildNumber", "-p:MinorVersionPrefix=$minorVersionPrefix"
Write-Host "======================================"
Write-Host "Building $targetRid"
Write-Host " Self-Contained: $isSelfContained"
Write-Host " Publish Directory: $publishTarget"
Write-Host ""
Write-Host "dotnet $cmd"
Write-Host ""
& dotnet $cmd
if ($LASTEXITCODE -ne 0)
{
exit $LASTEXITCODE
}
Write-Host ""
$symbols = Get-ChildItem -Path $publishTarget -Filter *.pdb
$symbols += Get-ChildItem -Path "$publishTarget\workers\dotnet-isolated\*" -Include "*.pdb", "*.dbg" -Recurse
Write-Host "Zipping symbols: $($symbols.Count) symbols found"
$symbolsPath = "$publishDir\Symbols"
if (!(Test-Path -PathType Container $symbolsPath)) {
New-Item -ItemType Directory -Path $symbolsPath | Out-Null
}
$symbols | Compress-Archive -DestinationPath "$symbolsPath\Functions.Symbols.$extensionVersion.$targetRid.zip" | Out-Null
$symbols | Remove-Item | Out-Null
Write-Host ""
CleanOutput $publishTarget
Write-Host ""
Write-Host "Done building $targetRid. Elapsed: $($stopwatch.Elapsed)"
Write-Host "======================================"
Write-Host ""
}
function GetFolderSizeInMb([string] $rootPath) {
return [math]::Round((Get-ChildItem $rootPath -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1Mb, 2)
}
function CleanOutput([string] $rootPath) {
Write-Host "Cleaning build output under $rootPath"
Write-Host " Current size: $(GetFolderSizeInMb $rootPath) Mb"
Write-Host " Removing any linux and osx runtimes"
Remove-Item -Recurse -Force "$privateSiteExtensionPath\$bitness\runtimes\linux" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$privateSiteExtensionPath\$bitness\runtimes\osx" -ErrorAction SilentlyContinue
Write-Host " Removing python worker"
Remove-Item -Recurse -Force "$rootPath\workers\python" -ErrorAction SilentlyContinue
$keepRuntimes = @('win', 'win-x86', 'win10-x86', 'win-x64', 'win10-x64')
Write-Host " Removing all powershell runtimes except $keepRuntimes"
Get-ChildItem "$rootPath\workers\powershell" -Directory -ErrorAction SilentlyContinue |
ForEach-Object { Get-ChildItem "$($_.FullName)\runtimes" -Directory -Exclude $keepRuntimes } |
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " Removing FunctionsNetHost(linux executable) and dependencies from dotnet-isolated worker"
$dotnetIsolatedBinPath = Join-Path $rootPath "workers\dotnet-isolated\bin"
if (Test-Path $dotnetIsolatedBinPath) {
Remove-Item -Path (Join-Path $dotnetIsolatedBinPath "FunctionsNetHost") -ErrorAction SilentlyContinue
Get-ChildItem -Path $dotnetIsolatedBinPath -Filter "*.so" | Remove-Item -ErrorAction SilentlyContinue
}
Write-Host " Current size: $(GetFolderSizeInMb $rootPath) Mb"
}
function CreateSiteExtensions() {
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
$siteExtensionPath = "$publishDir\temp_extension"
if (Test-Path $siteExtensionPath) {
Write-Host " Existing site extension path found. Deleting."
Remove-Item $siteExtensionPath -Recurse -Force | Out-Null
}
# The official site extension needs to be nested inside a folder with its version.
# Not using the suffix (eg: '-ci') here as it may not work correctly in a private stamp
$officialSiteExtensionPath = "$siteExtensionPath\$extensionVersion"
Write-Host "======================================"
Write-Host "Copying build to temp directory to prepare for zipping official site extension."
Copy-Item -Path $publishDir\release_win-x86\ -Destination $officialSiteExtensionPath\32bit -Force -Recurse > $null
Copy-Item -Path $publishDir\release_win-x64 -Destination $officialSiteExtensionPath\64bit -Force -Recurse > $null
Copy-Item -Path $officialSiteExtensionPath\32bit\applicationHost.xdt -Destination $officialSiteExtensionPath -Force > $null
Write-Host " Deleting workers directory: $officialSiteExtensionPath\32bit\workers"
Remove-Item -Recurse -Force "$officialSiteExtensionPath\32bit\workers" -ErrorAction SilentlyContinue
Write-Host " Moving workers directory: $officialSiteExtensionPath\64bit\workers to $officialSiteExtensionPath\workers"
Move-Item -Path "$officialSiteExtensionPath\64bit\workers" -Destination "$officialSiteExtensionPath\workers"
# This goes in the root dir
Copy-Item $rootDir\src\WebJobs.Script.WebHost\extension.xml $siteExtensionPath > $null
Write-Host "Done copying. Elapsed: $($stopwatch.Elapsed)"
Write-Host "======================================"
Write-Host ""
Write-Host "======================================"
Write-Host "Generating hashes for hard links"
WriteHashesFile $siteExtensionPath/$extensionVersion
Write-Host "Done generating hashes for hard links into $siteExtensionPath/$extensionVersion"
Write-Host "======================================"
Write-Host
$zipOutput = "$publishDir\SiteExtension"
$hashesForHardLinksPath = "$siteExtensionPath\$extensionVersion\$hashesForHardlinksFile"
New-Item -Itemtype directory -path $zipOutput -Force > $null
if ($minorVersionPrefix -eq "") {
ZipContent $siteExtensionPath "$zipOutput\Functions.$extensionVersion.zip"
} elseif ($minorVersionPrefix -eq "8") {
Write-Host "======================================"
# Only the "Functions" site extension supports hard links
Write-Host "MinorVersionPrefix is '8'. Removing $hashesForHardLinksPath before zipping."
Remove-Item -Force "$hashesForHardLinksPath" -ErrorAction Stop
# The .NET 8 host doesn't require any workers. Doing this to save space.
Write-Host "Removing workers before zipping."
# The host requires that this folder exists and it cannot be empty
Remove-Item -Recurse -Force "$siteExtensionPath\$extensionVersion\workers" -ErrorAction Stop
New-Item -Path "$siteExtensionPath\$extensionVersion" -Name "workers" -ItemType Directory -ErrorAction Stop | Out-Null
Set-Content -Force -Path "$siteExtensionPath\$extensionVersion\workers\this_folder_intentionally_empty.txt" -Value ".NET 8 builds do not have workers. However, this folder must contain at least one file." -ErrorAction Stop
Write-Host "======================================"
Write-Host
ZipContent $siteExtensionPath "$zipOutput\FunctionsInProc8.$extensionVersion.zip"
} elseif ($minorVersionPrefix -eq "6") {
# Only the "Functions" site extension supports hard links
Write-Host "======================================"
Write-Host "MinorVersionPrefix is '6'. Removing $hashesForHardLinksPath before zipping."
Remove-Item -Force "$hashesForHardLinksPath" -ErrorAction Stop
Write-Host "======================================"
Write-Host
ZipContent $siteExtensionPath "$zipOutput\FunctionsInProc.$extensionVersion.zip"
}
Remove-Item $siteExtensionPath -Recurse -Force > $null
Write-Host "======================================"
$stopwatch.Reset()
Write-Host "Copying build to temp directory to prepare for zipping private site extension."
Copy-Item -Path $publishDir\release_win-x86\ -Destination $siteExtensionPath\SiteExtensions\Functions\32bit -Force -Recurse > $null
Copy-Item -Path $siteExtensionPath\SiteExtensions\Functions\32bit\applicationHost.xdt -Destination $siteExtensionPath\SiteExtensions\Functions -Force > $null
Write-Host "Done copying. Elapsed: $($stopwatch.Elapsed)"
Write-Host "======================================"
Write-Host ""
$zipOutput = "$publishDir\PrivateSiteExtension"
New-Item -Itemtype directory -path $zipOutput -Force > $null
ZipContent $siteExtensionPath "$zipOutput\Functions.Private.$extensionVersion.win-x32.inproc.zip"
Remove-Item $siteExtensionPath -Recurse -Force > $null
}
function WriteHashesFile([string] $directoryPath) {
New-Item -Path "$directoryPath/../temp_hashes" -ItemType Directory | Out-Null
$temp_current = (Get-Location)
Set-Location $directoryPath
Get-ChildItem -Recurse $directoryPath | Where-Object { $_.PsIsContainer -eq $false } | Foreach-Object { "Hash:" + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((Get-FileHash -Algorithm MD5 $_.FullName).Hash)) + " FileName:" + (Resolve-Path -Relative -Path $_.FullName) } | Out-File -FilePath "$directoryPath\..\temp_hashes\$hashesForHardlinksFile"
Move-Item -Path "$directoryPath/../temp_hashes/$hashesForHardlinksFile" -Destination "$directoryPath" -Force
Set-Location $temp_current
Remove-Item "$directoryPath/../temp_hashes" -Recurse -Force > $null
}
Write-Host "Output directory: $publishDir"
if (Test-Path $publishDir) {
Write-Host " Existing build output found. Deleting."
Remove-Item $publishDir -Recurse -Force -ErrorAction Stop
}
Write-Host "Extensions version: $extensionVersion"
Write-Host ""
BuildRuntime "win-x86"
BuildRuntime "win-x64"
CreateSiteExtensions
Write-Error "This script is no longer used. Instead, publish src/WebJobs.Script.SiteExtension/WebJobs.Script.SiteExtension.proj directly."

Просмотреть файл

@ -8,12 +8,12 @@
<PatchVersion>0</PatchVersion>
<BuildNumber Condition="'$(BuildNumber)' == '' ">0</BuildNumber>
<PreviewVersion></PreviewVersion>
<!-- During previews, always generate this suffix, even for official releases -->
<_VersionSuffix Condition="'$(PreviewVersion)' != ''">-preview.$(PreviewVersion).$(BuildNumber)</_VersionSuffix>
<!-- Otherwise, use the suffix directly, adding a '-' -->
<_VersionSuffix Condition="'$(PreviewVersion)' == '' and '$(VersionSuffix)' != ''">-$(VersionSuffix)</_VersionSuffix>
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
<Version>$(VersionPrefix)$(_VersionSuffix)</Version>
<AssemblyVersion>$(MajorVersion).$(MinorVersion).0.0</AssemblyVersion>

Просмотреть файл

@ -1,5 +1,6 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.PythonWorker" Version="4.34.0" />
</ItemGroup>
<!-- See /eng/build/Workers.Python.props -->
<Target Name="_DoNotImport" BeforeTargets="Build">
<Error Text="This file should not be imported. Import '$(TargetsRoot)Workers.props'." />
</Target>
</Project>

Просмотреть файл

@ -1,171 +0,0 @@
function WriteLog
{
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[System.String]
$Message,
[Switch]
$Throw
)
$Message = (Get-Date -Format G) + " -- $Message"
if ($Throw)
{
throw $Message
}
Write-Host $Message
}
Class PackageInfo {
[string]$Name
[string]$Version
}
function NewPackageInfo
{
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[System.String]
$PackageInformation
)
$parts = $PackageInformation.Split(" ")
if ($parts.Count -gt 2)
{
WriteLog "Invalid package format. The string should only contain 'name<space>version'. Current value: '$PackageInformation'"
}
$packageInfo = [PackageInfo]::New()
$packageInfo.Name = $parts[0]
$packageInfo.Version = $parts[1]
return $packageInfo
}
function GetPackageInfo
{
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[System.String]
$Name,
[Parameter(Mandatory=$false)]
[System.String]
$MajorVersion
)
$result = $null
$includeAllVersion = if (-not [string]::IsNullOrWhiteSpace($MajorVersion)) { "-AllVersions" } else { "" }
$packageInfo = & { NuGet list $Name -Source $SOURCE -PreRelease $includeAllVersion }
if ($packageInfo -like "*No packages found*")
{
WriteLog "Package name $Name not found in $SOURCE." -Throw
}
if (-not $MajorVersion)
{
$result = NewPackageInfo -PackageInformation $packageInfo
}
else
{
foreach ($thisPackage in $packageInfo.Split([System.Environment]::NewLine))
{
$package = NewPackageInfo -PackageInformation $thisPackage
if ($package.Version.StartsWith($MajorVersion))
{
$result = $package
break
}
}
}
return $result
}
WriteLog "Script started."
# Make sure the project path exits
$path = "$PSScriptRoot\..\src\WebJobs.Script"
if (-not (Test-Path $path))
{
WriteLog "Failed to find '$path' to update package references" -Throw
}
$URL = "https://raw.githubusercontent.com/Azure/azure-functions-integration-tests/main/integrationTestsBuild/V4/HostBuild.json"
$SOURCE = "https://azfunc.pkgs.visualstudio.com/e6a70c92-4128-439f-8012-382fe78d6396/_packaging/AzureFunctionsPreRelease/nuget/v3/index.json"
WriteLog "Get the list of packages to update"
$packagesToUpdate = Invoke-RestMethod -Uri $URL -ErrorAction Stop
if ($packagesToUpdate.Count -eq 0)
{
WriteLog "There are no packages to update in '$URL'" -Throw
}
# Update packages references
WriteLog "Package references to update: $($packagesToUpdate.Count)"
$currentDirectory = Get-Location
try
{
set-location $path
foreach ($package in $packagesToUpdate)
{
$packageInfo = GetPackageInfo -Name $package.Name -MajorVersion $package.MajorVersion
if ($package.Name -eq "Microsoft.Azure.Functions.PythonWorker")
{
# The PythonWorker is not defined in the src/WebJobs.Script/WebJobs.Script.csproj. It is defined in build/python.props.
# To update the package version, the xml file build/python.props needs to be updated directly.
$pythonPropsFilePath = "$PSScriptRoot\python.props"
if (-not (Test-Path $pythonPropsFilePath))
{
WriteLog "Python Props file '$pythonPropsFilePath' does not exist." -Throw
}
WriteLog "Set Python package version in '$pythonPropsFilePath' to '$($packageInfo.Version)'"
# Read the xml file
[xml]$xml = Get-Content $pythonPropsFilePath -Raw -ErrorAction Stop
# Replace the package version
$xml.Project.ItemGroup.PackageReference.Version = $packageInfo.Version
# Save the file
$xml.Save($pythonPropsFilePath)
if ($LASTEXITCODE -ne 0)
{
WriteLog "Failed to update Python Props file" -Throw
}
}
else
{
WriteLog "Adding '$($packageInfo.Name)' '$($packageInfo.Version)' to project"
& { dotnet add package $packageInfo.Name -v $packageInfo.Version -s $SOURCE --no-restore }
if ($LASTEXITCODE -ne 0)
{
WriteLog "dotnet add package '$($packageInfo.Name)' -v '$($packageInfo.Version)' -s $SOURCE --no-restore failed" -Throw
}
}
}
}
finally
{
Set-Location $currentDirectory
}
WriteLog "Script completed."

Просмотреть файл

@ -1,5 +1,6 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)RepositoryInfo.targets" />
<Import Project="$(MSBuildThisFileDirectory)ZipPublish.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,15 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.DotNetIsolatedNativeHost" Version="1.0.11" />
</ItemGroup>
<Target Name="CleanDotnetWorkerFiles" BeforeTargets="AssignTargetPaths" Condition="$(RuntimeIdentifier.StartsWith(win))">
<!-- Remove unnecessary dotnet isolated files -->
<ItemGroup>
<_DotnetWorkerFiles Include="@(None)" Condition="'%(None.DestinationSubDirectory)' == 'workers\dotnet-isolated\bin\'" />
<None Remove="@(_DotnetWorkerFiles)" Condition="'%(Extension)' != '.dll' AND '%(Extension)' != '.exe'" />
</ItemGroup>
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.17.0" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.10.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,29 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.0" Version="4.0.3148" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.2" Version="4.0.4025" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.4026" />
</ItemGroup>
<Target Name="RemovePowershellWorkerRuntimes" BeforeTargets="AssignTargetPaths" Condition="$(RuntimeIdentifier.StartsWith(win))">
<ItemGroup>
<_KeepPowerShellRuntime Include="win;win-x86;win10-x86;win-x64;win10-x64" />
</ItemGroup>
<PropertyGroup>
<!--
Match files that start with "workers/powershell/{version}/runtimes" but also not one of the win runtimes we want to keep.
1. Transform @(_KeepPowerShellRuntime) into a regex that matches runtime folders to keep, all or'd together.
2. Build a regex that matches all runtimes except the runtimes folders from the first step.
-->
<_PowershellRuntimesToKeepRegex>@(_KeepPowerShellRuntime->'%(Identity)(/|\\)', '|')</_PowershellRuntimesToKeepRegex>
<_PowershellRuntimesToRemoveRegex>^workers(/|\\)powershell(/|\\).*(/|\\)runtimes(/|\\)(?!$(_PowershellRuntimesToKeepRegex))</_PowershellRuntimesToRemoveRegex>
</PropertyGroup>
<ItemGroup>
<_PowershellRuntimeToRemove Include="@(None)" Condition="'%(None.TargetPath)' != '' AND $([System.Text.RegularExpressions.Regex]::IsMatch('%(None.TargetPath)', $(_PowershellRuntimesToRemoveRegex)))" />
<None Remove="@(_PowershellRuntimeToRemove)" />
</ItemGroup>
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,15 @@
<Project>
<ItemGroup>
<!-- Python worker does not ship with the host for windows. -->
<PackageReference Include="Microsoft.Azure.Functions.PythonWorker" Version="4.34.0" Condition="!$(RuntimeIdentifier.StartsWith('win'))" />
</ItemGroup>
<!-- PythonWorker package injects its content files through custom targets. -->
<Target Name="SuppressPythonWorker" AfterTargets="Initialize" BeforeTargets="CopyOnPublish" Condition="$(RuntimeIdentifier.StartsWith('win'))">
<ItemGroup>
<SourceFiles Remove="@(SourceFiles)" />
</ItemGroup>
</Target>
</Project>

21
eng/build/Workers.props Normal file
Просмотреть файл

@ -0,0 +1,21 @@
<Project>
<!-- Individual workers are in their own props file. -->
<Import Project="$(MSBuildThisFileDirectory)Workers.*.props" />
<!-- Remove all worker items from the ReadyToRun publish list -->
<Target Name="ExcludeWorkers" AfterTargets="ComputeFilesToPublish" BeforeTargets="ResolveReadyToRunCompilers" Condition="'$(PublishReadyToRun)' == 'true'">
<ItemGroup>
<_WorkerPublishFiles Include="@(ResolvedFileToPublish)" Condition="$([System.String]::new('%(ResolvedFileToPublish.TargetPath)').StartsWith('workers'))" />
<ResolvedFileToPublish Remove="@(_WorkerPublishFiles)" />
</ItemGroup>
</Target>
<!-- Add all worker items back to the publish list -->
<Target Name="ReAddWorkersToPublish" AfterTargets="CreateReadyToRunImages" BeforeTargets="CopyFilesToPublishDirectory" Condition="'$(PublishWorkers)' != 'false'">
<ItemGroup>
<ResolvedFileToPublish Include="@(_WorkerPublishFiles)" />
</ItemGroup>
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,55 @@
<Project>
<ItemDefinitionGroup>
<!-- Makes these properties referencable for all items in this group -->
<ZipArtifact>
<TargetPath></TargetPath>
<TargetName></TargetName>
</ZipArtifact>
</ItemDefinitionGroup>
<Target Name="PrepareZipArtifacts" AfterTargets="Publish">
<PropertyGroup>
<!-- By default, we zip to package output path (as this is the 'packed' publish artifact). -->
<ZipArtifactsPath Condition="'$(ZipArtifactsPath)' == '' AND '$(ZipAfterPublish)' == 'true'">$(PackageOutputPath)</ZipArtifactsPath>
<ZipArtifactsPath Condition="'$(ZipArtifactsPath)' != ''">$([MSBuild]::EnsureTrailingSlash('$(ZipArtifactsPath)'))</ZipArtifactsPath>
<_RuntimeIdentifierWithPeriod Condition="'$(RuntimeIdentifier)' != ''">.$(RuntimeIdentifier.ToLowerInvariant())</_RuntimeIdentifierWithPeriod>
</PropertyGroup>
<!-- If no publish artifact is available, we will add the publish directory as a default. -->
<ItemGroup Condition="'$(ZipArtifactsPath)' != '' AND '@(ZipArtifact)' == ''">
<ZipArtifact Include="$(PublishDir)" TargetPath="$(ZipArtifactsPath)$(AssemblyName).$(Version)$(_RuntimeIdentifierWithPeriod).zip" />
</ItemGroup>
</Target>
<!--
Allows for zipping publish outputs:
Zip with a pre-determined name/location:
> `dotnet publish -p:ZipAfterPublish=true`
Zip with a pre-determined name to the provided location
> `dotnet publish -p:ZipArtifactsPath={some_directory}`
-->
<Target Name="ZipPublishArtifacts"
AfterTargets="Publish"
DependsOnTargets="PrepareZipArtifacts"
Condition="'$(ZipArtifactsPath)' != '' AND '@(ZipArtifact)' != '' AND '$(IsCrossTargetingBuild)' != 'true' AND '$(IsZippable)' == 'true'">
<ItemGroup Condition="'$(ZipArtifactsPath)' != ''">
<ZipArtifact Condition="'%(TargetPath)' == '' AND '%(TargetName)' != ''">
<TargetPath>$([MSBuild]::EnsureTrailingSlash('$(ZipArtifactsPath)'))%(TargetName)</TargetPath>
</ZipArtifact>
</ItemGroup>
<!-- Get all parent directories we will be zipping artifacts to. So we can ensure they exist. -->
<ItemGroup>
<_ZipArtifactTargetPath Include="@(ZipArtifact->'%(TargetPath)')" />
<_ZipArtifactTargetDirectories Include="@(_ZipArtifactTargetPath->'%(RootDir)%(Directory)'->Distinct())" />
</ItemGroup>
<Error Condition="'%(ZipArtifact.TargetPath)' == ''" Text="ZipArtifact %(Identity) has no TargetPath or TargetName (required)." />
<MakeDir Directories="@(_ZipArtifactTargetDirectories)" /> <!-- Ensure parent directories exist. -->
<Delete Files="@(ZipArtifact->'%(TargetPath)')" /> <!-- Delete any existing zip artifacts. -->
<ZipDirectory SourceDirectory="@(ZipArtifact)" DestinationFile="%(TargetPath)" /> <!-- Generate zip artifacts. -->
</Target>
</Project>

Просмотреть файл

@ -6,18 +6,19 @@ jobs:
project: src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj
configuration: release
runtime: linux-x64
log_dir: $(Build.ArtifactStagingDirectory)/log
build_args: '-v m -c $(configuration) -r $(runtime) --self-contained true -p:BuildNumber=$(buildNumber) -p:IsPackable=false'
publish_zip_dir: $(Build.ArtifactStagingDirectory)/Linux
artifacts_path: $(Build.ArtifactStagingDirectory)
log_dir: $(artifacts_path)/log
zip_artifacts_path: $(artifacts_path)/Linux
build_args: '-v m -c $(configuration) -r $(runtime) --self-contained true -p:BuildNumber=$(buildNumber)'
templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputParentDirectory: $(artifacts_path)
outputs:
# TODO: onboard to Azure Artifacts Drops to allow accessing this from docker linux pipeline in msazure
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/azure-artifacts/artifact-services-onboarding
- output: pipelineArtifact
displayName: Publish linux artifacts
path: $(publish_zip_dir)
path: $(zip_artifacts_path)
artifact: Linux
- output: pipelineArtifact
displayName: Publish logs
@ -58,4 +59,4 @@ jobs:
publishWebProjects: false # we use our own publish logic
zipAfterPublish: false # we use our own zip logic
projects: $(project)
arguments: '$(build_args) --no-build -p:PublishZipDir=$(publish_zip_dir) -bl:$(log_dir)/publish.binlog'
arguments: '$(build_args) --no-build -p:ZipArtifactsPath=$(zip_artifacts_path) -bl:$(log_dir)/publish.binlog'

Просмотреть файл

@ -2,6 +2,20 @@ jobs:
- job: BuildArtifactsWindows
displayName: Build Windows Artifacts
pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows
variables:
${{ if or( eq( variables['Build.Reason'], 'PullRequest' ), and(not( contains( variables['Build.SourceBranch'], 'release/in-proc' ) ), not( contains( variables['Build.SourceBranch'], 'release/4.' ) ), not( contains( variables['Build.SourceBranch'], 'release/ExtensionsMetadataGenerator/' ) ) ) ) }}:
packSuffixSwitchTemp: --version-suffix $(buildNumber)
emgSuffixSwitchTemp: --version-suffix ci$(buildNumber)
packSuffixSwitch: $[variables.packSuffixSwitchTemp]
emgSuffixSwitch: $[variables.emgSuffixSwitchTemp]
nuget_package_path: $(Build.ArtifactStagingDirectory)/NugetPackages
log_dir: $(Build.ArtifactStagingDirectory)/log
templateContext:
outputParentDirectory: $(Build.ArtifactStagingDirectory)
outputs:
@ -15,48 +29,29 @@ jobs:
artifact: PrivateSiteExtension
- output: pipelineArtifact
displayName: Publish site extension symbols
path: $(Build.ArtifactStagingDirectory)/Symbols
path: $(Build.ArtifactStagingDirectory)/SiteExtensionSymbols
artifact: Symbols
- output: pipelineArtifact
displayName: Publish nuget packages
path: $(Build.ArtifactStagingDirectory)/NugetPackages
artifact: NugetPackages
pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows
variables:
${{ if or( eq( variables['Build.Reason'], 'PullRequest' ), and(not( contains( variables['Build.SourceBranch'], 'release/in-proc.' ) ), not( contains( variables['Build.SourceBranch'], 'release/4.' ) ), not( contains( variables['Build.SourceBranch'], 'release/ExtensionsMetadataGenerator/' ) ) ) ) }}:
suffixTemp: $(buildNumber)
packSuffixSwitchTemp: --version-suffix $(buildNumber)
emgSuffixSwitchTemp: --version-suffix ci$(buildNumber)
suffix: $[variables.suffixTemp] # this resolves to an empty string if it is missing
packSuffixSwitch: $[variables.packSuffixSwitchTemp]
emgSuffixSwitch: $[variables.emgSuffixSwitchTemp]
- output: pipelineArtifact
displayName: Publish logs
path: $(log_dir)
artifact: Windows_Log
sbomEnabled: false
condition: always()
steps:
- template: /eng/ci/templates/install-dotnet.yml@self
- task: PowerShell@2
displayName: Build artifacts
inputs:
filePath: build/build-extensions.ps1
arguments: '-buildNumber "$(buildNumber)" -suffix "$(suffix)"'
- task: CopyFiles@2
inputs:
SourceFolder: out/pub/WebJobs.Script.WebHost
Contents: '**/*.zip'
TargetFolder: $(Build.ArtifactStagingDirectory)
- template: /eng/ci/templates/steps/build-site-ext.yml@self
- task: DotNetCoreCLI@2
displayName: Build host packages
inputs:
command: custom
custom: pack
arguments: -p:BuildNumber=$(buildNumber) -c release $(packSuffixSwitch)
arguments: -p:BuildNumber=$(buildNumber) -c release $(packSuffixSwitch) -o $(nuget_package_path)
projects: |
**/WebJobs.Script.csproj
**/WebJobs.Script.WebHost.csproj
@ -78,17 +73,12 @@ jobs:
pattern: Microsoft.Azure.WebJobs.Script.Abstractions*.dll
signType: dll
- task: DeleteFiles@1
displayName: Delete CodeSignSummary files
inputs:
contents: '**/CodeSignSummary-*.md'
- task: DotNetCoreCLI@2
displayName: Pack Abstractions
inputs:
command: custom
custom: pack
arguments: '--no-build -c release'
arguments: '--no-build -c release -o $(nuget_package_path)'
projects: |
**/WebJobs.Script.Abstractions.csproj
@ -99,24 +89,19 @@ jobs:
pattern: Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator*.dll
signType: dll-strong-name
- task: DeleteFiles@1
displayName: Delete CodeSignSummary files
inputs:
contents: '**/CodeSignSummary-*.md'
- task: DotNetCoreCLI@2
displayName: Pack ExtensionsMetadataGenerator
inputs:
command: custom
custom: pack
arguments: '--no-build -c release $(emgSuffixSwitch)'
arguments: '--no-build -c release $(emgSuffixSwitch) -o $(nuget_package_path)'
projects: |
**/ExtensionsMetadataGenerator.csproj
- template: ci/sign-files.yml@eng
parameters:
displayName: Sign NugetPackages
folderPath: out/pkg/release
folderPath: $(nuget_package_path)
pattern: '*.nupkg'
signType: nuget
@ -125,8 +110,7 @@ jobs:
inputs:
contents: '**/CodeSignSummary-*.md'
- task: CopyFiles@2
- task: DeleteFiles@1
displayName: Delete CodeSignSummary files
inputs:
SourceFolder: out/pkg/release
Contents: '**/*.nupkg'
TargetFolder: $(Build.ArtifactStagingDirectory)/NugetPackages
contents: '$(nuget_package_path)/**/CodeSignSummary-*.md'

Просмотреть файл

@ -0,0 +1,32 @@
parameters:
- name: project
type: string
default: src/WebJobs.Script.SiteExtension/WebJobs.Script.SiteExtension.csproj
steps:
# Restore must be a separate step so we can pass in 'PublishReadyToRun=true'
- task: DotNetCoreCLI@2
displayName: Restore site extension
inputs:
command: custom
custom: restore
projects: ${{ parameters.project }}
arguments: '-v m -p:PublishReadyToRun=true -bl:$(log_dir)/site_ext.restore.binlog'
- task: DotNetCoreCLI@2
displayName: Build site extension
inputs:
command: custom
custom: build
projects: ${{ parameters.project }}
arguments: '--no-restore -v m -c release -p:BuildNumber=$(buildNumber) -bl:$(log_dir)/site_ext.build.binlog'
- task: DotNetCoreCLI@2
displayName: Publish site extension
inputs:
command: custom
custom: publish
publishWebProjects: false # we use our own publish logic
zipAfterPublish: false # we use our own zip logic
projects: ${{ parameters.project }}
arguments: '--no-build -v m -c release -p:BuildNumber=$(buildNumber) -p:ZipArtifactsPath=$(Build.ArtifactStagingDirectory) -bl:$(log_dir)/site_ext.publish.binlog'

Просмотреть файл

@ -0,0 +1,23 @@
<Project>
<!--
Publish.MultiTFM.targets: Kicks off an inner-publish per TFM
-->
<Target Name="Publish" DependsOnTargets="_PublishBuild;_PublishNoBuild" />
<Target Name="_PublishBuild" DependsOnTargets="Build;_PublishCore" Condition="'$(NoBuild)' != 'true'" />
<Target Name="_PublishNoBuild" DependsOnTargets="_PublishCore" Condition="'$(NoBuild)' == 'true'" />
<Target Name="_PublishCore">
<ItemGroup>
<_TargetFramework Include="$(TargetFrameworks)" />
<!-- Make normalization explicit: Trim; Deduplicate by keeping first occurrence, case insensitive -->
<_TargetFrameworkNormalized Include="@(_TargetFramework-&gt;Trim()-&gt;Distinct())" />
<_InnerBuildProjects Include="$(MSBuildProjectFile)">
<AdditionalProperties>TargetFramework=%(_TargetFrameworkNormalized.Identity)</AdditionalProperties>
</_InnerBuildProjects>
</ItemGroup>
<MSBuild Projects="@(_InnerBuildProjects)" Condition="'@(_InnerBuildProjects)' != '' " Targets="Publish" BuildInParallel="$(BuildInParallel)" />
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,168 @@
<Project>
<!--
Publish.SingleTFM.targets: publish steps for a single TFM.
-->
<Import Project="Tasks.targets" />
<PropertyGroup>
<PublishWebHostDependsOn>
ValidatePublishSettings;
PublishProjectReferences;
PublishPrivateProjectReferences;
RemoveUnneededRuntimes;
MoveSymbols;
DeletePrivateSymbols;
WriteHardLinkHashes;
</PublishWebHostDependsOn>
<PublishPropertiesToRemove>ZipAfterPublish;ZipArtifactsPath</PublishPropertiesToRemove>
</PropertyGroup>
<Target Name="ValidatePublishSettings">
<Error Condition="'$(SiteExtensionName)' == ''" Text="SiteExtensionName property must be set." />
<Error Condition="'@(PublishRuntimeIdentifier)' == ''" Text="PublishRuntimeIdentifier item group must be non-empty." />
</Target>
<!-- We set many properties and items in targets to ensure $(Version) is finalized. -->
<Target Name="UpdatePaths" BeforeTargets="AddRuntimesToProjects;AssignTargetPaths">
<PropertyGroup>
<SiteExtensionRelativeDir>SiteExtension/$(Version)/</SiteExtensionRelativeDir>
<SiteExtensionDir>$([MSBuild]::NormalizePath('$(PublishDir)$(SiteExtensionRelativeDir)'))</SiteExtensionDir>
<PrivateSiteExtensionRelativeDir>PrivateSiteExtension/SiteExtensions/Functions/</PrivateSiteExtensionRelativeDir>
<PrivateSiteExtensionDir>$([MSBuild]::NormalizePath('$(PublishDir)$(PrivateSiteExtensionRelativeDir)'))</PrivateSiteExtensionDir>
</PropertyGroup>
<ItemGroup>
<None Include="applicationHost.xdt" TargetPath="$(SiteExtensionRelativeDir)applicationHost.xdt" CopyToPublishDirectory="PreserveNewest" />
<None Include="applicationHost.xdt" TargetPath="$(PrivateSiteExtensionRelativeDir)applicationHost.xdt" CopyToPublishDirectory="PreserveNewest" />
<None Include="extension.xml" TargetPath="SiteExtension/extension.xml" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
</Target>
<!-- Update files from worker pagaes to be copied into public SiteExtension. -->
<Target Name="UpdateWorkerPaths" DependsOnTargets="UpdatePaths" BeforeTargets="AssignTargetPaths">
<ItemGroup>
<None Condition="'%(None.TargetPath)' != '' AND $([System.String]::new('%(None.TargetPath)').StartsWith('workers'))">
<TargetPath>$(SiteExtensionRelativeDir)%(None.TargetPath)</TargetPath>
</None>
</ItemGroup>
</Target>
<Target Name="AddRuntimesToProjects" BeforeTargets="AssignProjectConfiguration">
<ItemGroup>
<_ProjectReferenceWithRuntimes Include="@(ProjectReference)">
<AdditionalProperties>
<!-- These properties will not be pass transitively and are safe for build. -->
RuntimeIdentifier=%(PublishRuntimeIdentifier.Identity);
SelfContained=%(PublishRuntimeIdentifier.SelfContained)
</AdditionalProperties>
<PublishRuntime>%(PublishRuntimeIdentifier.Identity)</PublishRuntime>
<PublishDir>$(SiteExtensionDir)%(PublishRuntimeIdentifier.PublishDir)/</PublishDir>
<PublishPrivateDir>$(PrivateSiteExtensionDir)%(PublishRuntimeIdentifier.PublishDir)/</PublishPrivateDir>
<PublishPrivate>%(PublishRuntimeIdentifier.PrivateExtension)</PublishPrivate>
<Private>false</Private> <!-- Avoids including transitive output. -->
</_ProjectReferenceWithRuntimes>
<ProjectReference Remove="@(ProjectReference)" />
<ProjectReference Include="@(_ProjectReferenceWithRuntimes)" />
</ItemGroup>
</Target>
<Target Name="PublishWebHost" AfterTargets="PrepareForPublish" BeforeTargets="Publish" DependsOnTargets="$(PublishWebHostDependsOn)" />
<!-- Publishes projects for the public site extension. -->
<Target Name="PublishProjectReferences" AfterTargets="PrepareForPublish" BeforeTargets="Publish">
<ItemGroup>
<_PublishProjectReferenceExistent Include="@(_MSBuildProjectReferenceExistent)">
<AdditionalProperties>%(AdditionalProperties);PublishDir=%(PublishDir);_IsPublishing=true;PublishWorkers=false</AdditionalProperties>
</_PublishProjectReferenceExistent>
<ZipArtifact Include="$(PublishDir)SiteExtension" TargetName="SiteExtension/$(SiteExtensionName).$(Version).zip" />
</ItemGroup>
<MSBuild Projects="@(_PublishProjectReferenceExistent)"
Targets="Publish"
BuildInParallel="$(BuildInParallel)"
Properties="NoBuild=true"
RemoveProperties="$(PublishPropertiesToRemove)"/>
</Target>
<!-- Publishes projects for the private site extension. -->
<Target Name="PublishPrivateProjectReferences" AfterTargets="PublishProjectReferences" BeforeTargets="Publish">
<ItemGroup>
<_PublishPrivateProjectReferenceExistent Include="@(_MSBuildProjectReferenceExistent)" Condition="%(PublishPrivate)">
<AdditionalProperties>%(AdditionalProperties);PublishDir=%(PublishPrivateDir);_IsPublishing=true</AdditionalProperties>
</_PublishPrivateProjectReferenceExistent>
<ZipArtifact
Include="$(PublishDir)PrivateSiteExtension"
TargetName="@(_PublishPrivateProjectReferenceExistent->'PrivateSiteExtension/$(SiteExtensionName).Private.$(Version).%(PublishRuntime).zip')" />
</ItemGroup>
<MSBuild Projects="@(_PublishPrivateProjectReferenceExistent)"
Targets="Publish"
BuildInParallel="$(BuildInParallel)"
Properties="NoBuild=true"
RemoveProperties="$(PublishPropertiesToRemove)"/>
<RemoveDir Directories="@(_PublishPrivateProjectReferenceExistent->'%(PublishPrivateDir)/workers/python')" />
</Target>
<Target Name="RemoveUnneededRuntimes">
<!-- These shouldn't exist since we build/publish with a windows runtime, but just in case. -->
<ItemGroup>
<_RuntimesToRemove Include="@(PublishRuntimeIdentifier->'$(SiteExtensionDir)%(PublishDir)/runtimes/linux')" />
<_RuntimesToRemove Include="@(PublishRuntimeIdentifier->'$(SiteExtensionDir)%(PublishDir)/runtimes/osx')" />
<_RuntimesToRemove Include="@(PublishRuntimeIdentifier->'$(PrivateSiteExtensionDir)%(PublishDir)/runtimes/linux')" Condition="%(PrivateExtension)" />
<_RuntimesToRemove Include="@(PublishRuntimeIdentifier->'$(PrivateSiteExtensionDir)%(PublishDir)/runtimes/osx')" Condition="%(PrivateExtension)" />
</ItemGroup>
<RemoveDir Directories="@(_RuntimesToRemove)" />
</Target>
<Target Name="EnsureWorkersFolder"
AfterTargets="CopyFilesToPublishDirectory" BeforeTargets="ZipPublishArtifacts" Condition="!Exists('$(SiteExtensionDir)workers')">
<MakeDir Directories="$(SiteExtensionDir)workers" />
<WriteLinesToFile
File="$(SiteExtensionDir)workers/this_folder_intentionally_empty.txt"
Lines="This build does not include workers, but the host requires this folder to contain at least one file." />
</Target>
<!-- Copies symbols from SiteExtension out so they can be distributed independently. -->
<Target Name="MoveSymbols">
<ItemGroup>
<_SymbolDirs Include="@(PublishRuntimeIdentifier->'$(SiteExtensionDir)%(PublishDir)')">
<Destination>$(PublishDir)Symbols/$(SiteExtensionName).Symbols.$(Version).%(Identity)</Destination>
<ZipArtifact>$(SiteExtensionName).Symbols.$(Version).%(Identity).zip</ZipArtifact>
</_SymbolDirs>
<_WorkerSymbols Include="$(SiteExtensionDir)workers/**/*.pdb" Destination="$(PublishDir)Symbols/$(SiteExtensionName).Symbols.$(Version).%(PublishRuntimeIdentifier.Identity)/workers" />
<ZipArtifact Include="@(_SymbolDirs->'%(Destination)')" TargetName="SiteExtensionSymbols/%(_SymbolDirs.ZipArtifact)" />
</ItemGroup>
<MoveSymbols Directories="@(_SymbolDirs)" Destinations="%(Destination)" />
<Copy SourceFiles="@(_WorkerSymbols)" DestinationFiles="%(Destination)/%(RecursiveDir)%(Filename)%(Extension)" SkipUnchangedFiles="true" />
<Delete Files="@(_WorkerSymbols)" />
</Target>
<!-- Remove all symbols (.pdb) from PrivateSiteExtension -->
<Target Name="DeletePrivateSymbols">
<ItemGroup>
<_PrivateSymbolsToRemove Include="$(PrivateSiteExtensionDir)/**/*.pdb" />
</ItemGroup>
<Delete Files="@(_PrivateSymbolsToRemove)" />
</Target>
<!-- Calculate all the file hashes for the SiteExtension -->
<Target Name="ComputeHardLinkHashes">
<ItemGroup>
<_FilesToHash Include="$(SiteExtensionDir)**" />
</ItemGroup>
<GetFileHash Files="@(_FilesToHash)" HashEncoding="base64">
<Output TaskParameter="Items" ItemName="_HashedFiles" />
</GetFileHash>
</Target>
<!-- Write calculated hashes and filepaths to hashesForHardlinks.txt -->
<Target Name="WriteHardLinkHashes" DependsOnTargets="ComputeHardLinkHashes" Condition="'$(ShouldWriteHardLinkHashes)' != 'false'">
<ItemGroup>
<_HashedFiles RelativePath=".$([System.IO.Path]::DirectorySeparatorChar)$([MSBuild]::MakeRelative('$(SiteExtensionDir)', '%(Identity)'))" />
</ItemGroup>
<WriteLinesToFile
Overwrite="true"
File="$(SiteExtensionDir)/hashesForHardlinks.txt"
Lines="@(_HashedFiles->'Hash: %(FileHash) FileName: %(RelativePath)')" />
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,100 @@
<Project>
<UsingTask TaskName="MoveSymbols" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Directories ParameterType="System.String[]" Required="true" />
<Destinations ParameterType="System.String[]" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
if (Directories.Length != Destinations.Length)
{
Log.LogError("Directories and Destinations must have the same length.");
return false;
}
for (int i = 0; i < Directories.Length; i++)
{
string directory = Directories[i];
string destination = Destinations[i];
if (!Directory.Exists(directory))
{
Log.LogError($"directory directory {directory} does not exist.");
return false;
}
Log.LogMessage(MessageImportance.Low, $"Moving symbols from {directory} to {destination}");
if (!Directory.Exists(destination))
{
Directory.CreateDirectory(destination);
}
foreach (string file in Directory.EnumerateFiles(directory, "*.pdb", SearchOption.AllDirectories))
{
string relative = file.Substring(directory.Length + 1);
string target = Path.Combine(destination, relative);
if (File.Exists(target))
{
File.Delete(target);
}
string dir = Path.GetDirectoryName(target);
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
File.Move(file, target);
}
}
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="MoveDir" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Directories ParameterType="System.String[]" Required="true" />
<Destinations ParameterType="System.String[]" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
if (Directories.Length != Destinations.Length)
{
Log.LogError("Directories and Destinations must have the same length.");
return false;
}
for (int i = 0; i < Directories.Length; i++)
{
string directory = Directories[i];
string destination = Destinations[i];
if (!Directory.Exists(directory))
{
Log.LogError($"Directory '{directory}' does not exist.");
return false;
}
if (Directory.Exists(destination))
{
Log.LogError($"Destination directory '{destination}' already exists.");
return false;
}
Directory.Move(directory, destination);
}
]]>
</Code>
</Task>
</UsingTask>
</Project>

Просмотреть файл

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.Build.NoTargets">
<Import Project="../../build/common.props" />
<PropertyGroup>
<!-- TFM and RId are actually used. -->
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win</RuntimeIdentifier>
<SiteExtensionName>Functions</SiteExtensionName>
<IsZippable>true</IsZippable>
<CustomAfterNoTargets Condition="'$(TargetFramework)' != ''">$(MSBuildThisFileDirectory)Publish.SingleTFM.targets</CustomAfterNoTargets>
<CustomAfterNoTargets Condition="'$(TargetFramework)' == ''">$(MSBuildThisFileDirectory)Publish.MultiTFM.targets</CustomAfterNoTargets>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<Import Project="$(TargetsRoot)Workers.props" />
<ItemGroup>
<ProjectReference Include="../WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup>
<!-- This item group controls what runtimes we will publish for public & private site extension -->
<PublishRuntimeIdentifier Include="win-x86" SelfContained="false" PublishDir="32bit" PrivateExtension="true" />
<PublishRuntimeIdentifier Include="win-x64" SelfContained="false" PublishDir="64bit" PrivateExtension="false" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.applicationHost>
<sites>
<site name="%XDT_SITENAME%" xdt:Locator="Match(name)">
<application path="/" xdt:Locator="Match(path)" xdt:Transform="Remove" />
<application path="/" applicationPool="%XDT_APPPOOLNAME%" xdt:Transform="Insert">
<virtualDirectory path="/" physicalPath="%XDT_EXTENSIONPATH%\%XDT_BITNESS%" />
</application>
</site>
</sites>
</system.applicationHost>
</configuration>

Просмотреть файл

@ -0,0 +1,3 @@
<extension>
<version>disabled</version>
</extension>

Просмотреть файл

@ -0,0 +1,24 @@
# Site Extension
This project is responsible for building the artifacts we ship to antares as a site extension.
## Usage
Like any MSBuild project, this can be restored, build, and published separately or together.
``` shell
# Together
dotnet publish -c {config}
# Separately
dotnet restore -p:PublishReadyToRun=true # needs to be set to true (fixed in .net9 SDK)
dotnet build -c {config} --no-restore
dotnet publish -c {config} --no-build
```
By default the outputs will not be zipped. To the zip the final outputs, add `-p:ZipAfterPublish=true` to the `publish` command.
## Outputs
The output site extension can be found at `{repo_root}/out/pub/WebJobs.Script.SiteExtension/{config}_win`. When using `-p:ZipAfterPublish=true`, the zipped package is found at `{repo_root}/out/pkg/{config}`

Просмотреть файл

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\build\common.props" />
<Import Project="..\..\build\python.props" />
<Import Project="$(TargetsRoot)Workers.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>Microsoft.Azure.WebJobs.Script.WebHost</AssemblyName>
@ -11,6 +11,7 @@
<TieredCompilation>false</TieredCompilation>
<NoWarn>NU5104</NoWarn>
<IdentityDependencyVersion>6.35.0</IdentityDependencyVersion>
<RuntimeIdentifiers>win-x86;win-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' != ''">
<PublishReadyToRun>true</PublishReadyToRun>
@ -58,10 +59,6 @@
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="Routing\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Data.Tables" Version="12.8.3" />
<PackageReference Include="Azure.Identity" Version="1.11.4" />
@ -133,42 +130,4 @@
<Content Update="web.config" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<!-- Remove all worker items from the ReadyToRun publish list -->
<Target Name="ExcludeWorkersFromReadyToRun" BeforeTargets="_PrepareForReadyToRunCompilation">
<CreateItem Include="@(ResolvedFileToPublish)" Condition="$([System.String]::new('%(ResolvedFileToPublish.TargetPath)').StartsWith('workers'))">
<Output TaskParameter="Include" ItemName="_ExcludeFromReadyToRun" />
</CreateItem>
<ItemGroup>
<ResolvedFileToPublish Remove="@(_ExcludeFromReadyToRun)" />
</ItemGroup>
</Target>
<!-- Add all worker items back to the publish list -->
<Target Name="IncludeWorkersInPublish" AfterTargets="CreateReadyToRunImages">
<CreateItem Include="@(_ExcludeFromReadyToRun)">
<Output TaskParameter="Include" ItemName="ResolvedFileToPublish" />
</CreateItem>
</Target>
<!--
Allows for zipping publish outputs:
Zip with a pre-determined name/location:
> `dotnet publish -p:PublishZip=true`
Zip with a pre-determined name to the provided location
> `dotnet publish -p:PublishZipDir={some directory}`
Zip with a provided name and location
> `dotnet publish -p:PublishZipTarget={some directory}/{some_file}.zip`
-->
<Target Name="ZipPublishContents" AfterTargets="Publish">
<PropertyGroup Condition="'$(PublishZipTarget)' == ''">
<PublishZipDir Condition="'$(PublishZipDir)' == '' AND '$(PublishZip)' == 'true'">$(PublishDir)..</PublishZipDir>
<PublishZipTarget Condition="'$(PublishZipDir)' != ''">$(PublishZipDir)\$(AssemblyName).$(Version).$(ArtifactsPivots).zip</PublishZipTarget>
</PropertyGroup>
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName('$(PublishZipTarget)'))" Condition="'$(PublishZipTarget)' != ''" />
<ZipDirectory SourceDirectory="$(PublishDir)" DestinationFile="$(PublishZipTarget)" Condition="'$(PublishZipTarget)' != ''" />
</Target>
</Project>

Просмотреть файл

@ -50,20 +50,10 @@
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer" Version="2.22.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.2.0" NoWarn="NU1701" />
<PackageReference Include="Microsoft.Azure.Functions.DotNetIsolatedNativeHost" Version="1.0.11" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.41" />
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.1" />
<!-- Workers -->
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.17.0" />
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.3.20240307.67" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.10.1" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.0" Version="4.0.3148" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.2" Version="4.0.4025" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.4026" />
<!-- /Workers -->
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="5.1.0-12067" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Timers.Storage" Version="1.0.0-beta.1" />

Просмотреть файл

@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\build\common.props" />
<Import Project="..\..\build\python.props" />
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
@ -20,6 +19,9 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>
<Import Project="$(TargetsRoot)Workers.props" />
<ItemGroup>
<Compile Remove="ScriptHostEndToEnd\ListenerFailureTests.cs" />
<Compile Remove="ServiceBus\ServiceBusEndToEndTestBase.cs" />
@ -37,13 +39,11 @@
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer" Version="2.22.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.8" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.6">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.6" NoWarn="NU1701" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.10.1" />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.11.2" />
<PackageReference Include="Microsoft.Azure.EventHubs" Version="2.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.5-11874" />
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.17.0" />
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />