diff --git a/eng/automation/SignVerifyIgnore.txt b/eng/automation/SignVerifyIgnore.txt new file mode 100644 index 000000000..80d9968a0 --- /dev/null +++ b/eng/automation/SignVerifyIgnore.txt @@ -0,0 +1,2 @@ +**\*.xml,ignore unsigned .xml +**\cab*.cab.cab,ignore unsigned .cab diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 18823840b..6db6baac5 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -146,22 +146,22 @@ $userName = "dn-bot" # Insert credential nodes for Maestro's private feeds InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password +# 3.1 uses a different feed url format so it's handled differently here $dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") if ($dotnet31Source -ne $null) { AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password } -$dotnet5Source = $sources.SelectSingleNode("add[@key='dotnet5']") -if ($dotnet5Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet5-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password +$dotnetVersions = @('5','6','7','8') + +foreach ($dotnetVersion in $dotnetVersions) { + $feedPrefix = "dotnet" + $dotnetVersion; + $dotnetSource = $sources.SelectSingleNode("add[@key='$feedPrefix']") + if ($dotnetSource -ne $null) { + AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password + } } -$dotnet6Source = $sources.SelectSingleNode("add[@key='dotnet6']") -if ($dotnet6Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet6-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet6-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password -} - -$doc.Save($filename) +$doc.Save($filename) \ No newline at end of file diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index ad3fb74fd..e86f8388c 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -105,53 +105,33 @@ if [ "$?" == "0" ]; then PackageSources+=('dotnet3.1-internal-transport') fi -# Ensure dotnet5-internal and dotnet5-internal-transport are in the packageSources if the public dotnet5 feeds are present -grep -i "" +DotNetVersions=('5' '6' '7' '8') - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile +for DotNetVersion in ${DotNetVersions[@]} ; do + FeedPrefix="dotnet${DotNetVersion}"; + grep -i "" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=("$FeedPrefix-internal") + + grep -i "" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding $FeedPrefix-internal-transport to the packageSources." + PackageSourcesNodeFooter="" + PackageSourceTemplate="${TB}" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=("$FeedPrefix-internal-transport") fi - PackageSources+=('dotnet5-internal') - - grep -i "" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding dotnet5-internal-transport to the packageSources." - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet5-internal-transport') -fi - -# Ensure dotnet6-internal and dotnet6-internal-transport are in the packageSources if the public dotnet6 feeds are present -grep -i "" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet6-internal') - - grep -i "" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding dotnet6-internal-transport to the packageSources." - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet6-internal-transport') -fi +done # I want things split line by line PrevIFS=$IFS @@ -188,4 +168,4 @@ if [ "$?" == "0" ]; then echo "Neutralized disablePackageSources entry for '$DisabledSourceName'" fi done -fi +fi \ No newline at end of file diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index f1e1cb539..aa74ab4a8 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -287,6 +287,25 @@ function InstallDotNet([string] $dotnetRoot, [string] $runtimeSourceFeedKey = '', [switch] $noPath) { + $dotnetVersionLabel = "'sdk v$version'" + + if ($runtime -ne '' -and $runtime -ne 'sdk') { + $runtimePath = $dotnetRoot + $runtimePath = $runtimePath + "\shared" + if ($runtime -eq "dotnet") { $runtimePath = $runtimePath + "\Microsoft.NETCore.App" } + if ($runtime -eq "aspnetcore") { $runtimePath = $runtimePath + "\Microsoft.AspNetCore.App" } + if ($runtime -eq "windowsdesktop") { $runtimePath = $runtimePath + "\Microsoft.WindowsDesktop.App" } + $runtimePath = $runtimePath + "\" + $version + + $dotnetVersionLabel = "runtime toolset '$runtime/$architecture v$version'" + + if (Test-Path $runtimePath) { + Write-Host " Runtime toolset '$runtime/$architecture v$version' already installed." + $installSuccess = $true + Exit + } + } + $installScript = GetDotNetInstallScript $dotnetRoot $installParameters = @{ Version = $version @@ -323,18 +342,18 @@ function InstallDotNet([string] $dotnetRoot, } else { $location = "public location"; } - Write-Host "Attempting to install dotnet from $location." + Write-Host " Attempting to install $dotnetVersionLabel from $location." try { & $installScript @variation $installSuccess = $true break } catch { - Write-Host "Failed to install dotnet from $location." + Write-Host " Failed to install $dotnetVersionLabel from $location." } } if (-not $installSuccess) { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from any of the specified locations." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install $dotnetVersionLabel from any of the specified locations." ExitWithExitCode 1 } } @@ -360,15 +379,22 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = } # Minimum VS version to require. - $vsMinVersionReqdStr = '16.8' + $vsMinVersionReqdStr = '17.6' $vsMinVersionReqd = [Version]::new($vsMinVersionReqdStr) # If the version of msbuild is going to be xcopied, # use this version. Version matches a package here: - # https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=16.10.0-preview2&view=overview - $defaultXCopyMSBuildVersion = '16.10.0-preview2' + # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/RoslynTools.MSBuild/versions/17.6.0-2 + $defaultXCopyMSBuildVersion = '17.6.0-2' - if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } + if (!$vsRequirements) { + if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { + $vsRequirements = $GlobalJson.tools.vs + } + else { + $vsRequirements = New-Object PSObject -Property @{ version = $vsMinVersionReqdStr } + } + } $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { $vsMinVersionReqdStr } $vsMinVersion = [Version]::new($vsMinVersionStr) @@ -392,7 +418,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # Locate Visual Studio installation or download x-copy msbuild. $vsInfo = LocateVisualStudio $vsRequirements if ($vsInfo -ne $null) { - $vsInstallDir = $vsInfo.installationPath + # Ensure vsInstallDir has a trailing slash + $vsInstallDir = Join-Path $vsInfo.installationPath "\" $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion @@ -406,6 +433,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if($vsMinVersion -lt $vsMinVersionReqd){ Write-Host "Using xcopy-msbuild version of $defaultXCopyMSBuildVersion since VS version $vsMinVersionStr provided in global.json is not compatible" $xcopyMSBuildVersion = $defaultXCopyMSBuildVersion + $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] } else{ # If the VS version IS compatible, look for an xcopy msbuild package @@ -573,7 +601,7 @@ function InitializeBuildTool() { ExitWithExitCode 1 } $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') - $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp3.1' } + $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net8.0' } } elseif ($msbuildEngine -eq "vs") { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore @@ -635,10 +663,18 @@ function InitializeNativeTools() { InstallDirectory = "$ToolsDir" } } + if ($env:NativeToolsOnMachine) { + Write-Host "Variable NativeToolsOnMachine detected, enabling native tool path promotion..." + $nativeArgs += @{ PathPromotion = $true } + } & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs } } +function Read-ArcadeSdkVersion() { + return $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' +} + function InitializeToolset() { if (Test-Path variable:global:_ToolsetBuildProj) { return $global:_ToolsetBuildProj @@ -646,7 +682,7 @@ function InitializeToolset() { $nugetCache = GetNuGetPackageCachePath - $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' + $toolsetVersion = Read-ArcadeSdkVersion $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" if (Test-Path $toolsetLocationFile) { @@ -731,6 +767,8 @@ function MSBuild() { (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll')) (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')), (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll')) + (Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.ArcadeLogging.dll')), + (Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.Arcade.Sdk.dll')) ) $selectedPath = $null foreach ($path in $possiblePaths) { @@ -803,7 +841,8 @@ function MSBuild-Core() { Write-Host "See log: $buildLog" -ForegroundColor DarkGray } - if ($ci) { + # When running on Azure Pipelines, override the returned exit code to avoid double logging. + if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null) { Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error @@ -898,11 +937,13 @@ if (!$disableConfigureToolsetImport) { function Enable-Nuget-EnhancedRetry() { if ($ci) { Write-Host "Setting NUGET enhanced retry environment variables" - $env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true' - $env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6 - $env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 - Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true' - Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6' - Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' + $env:NUGET_ENABLE_ENHANCED_HTTP_RETRY = 'true' + $env:NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT = 6 + $env:NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 + $env:NUGET_RETRY_HTTP_429 = 'true' + Write-PipelineSetVariable -Name 'NUGET_ENABLE_ENHANCED_HTTP_RETRY' -Value 'true' + Write-PipelineSetVariable -Name 'NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT' -Value '6' + Write-PipelineSetVariable -Name 'NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' + Write-PipelineSetVariable -Name 'NUGET_RETRY_HTTP_429' -Value 'true' } } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 17f0a3658..e8d478943 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -184,6 +184,35 @@ function InstallDotNetSdk { function InstallDotNet { local root=$1 local version=$2 + local runtime=$4 + + local dotnetVersionLabel="'$runtime v$version'" + if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then + runtimePath="$root" + runtimePath="$runtimePath/shared" + case "$runtime" in + dotnet) + runtimePath="$runtimePath/Microsoft.NETCore.App" + ;; + aspnetcore) + runtimePath="$runtimePath/Microsoft.AspNetCore.App" + ;; + windowsdesktop) + runtimePath="$runtimePath/Microsoft.WindowsDesktop.App" + ;; + *) + ;; + esac + runtimePath="$runtimePath/$version" + + dotnetVersionLabel="runtime toolset '$runtime/$architecture v$version'" + + if [ -d "$runtimePath" ]; then + echo " Runtime toolset '$runtime/$architecture v$version' already installed." + local installSuccess=1 + return + fi + fi GetDotNetInstallScript "$root" local install_script=$_GetDotNetInstallScript @@ -228,17 +257,17 @@ function InstallDotNet { for variationName in "${variations[@]}"; do local name="$variationName[@]" local variation=("${!name}") - echo "Attempting to install dotnet from $variationName." + echo " Attempting to install $dotnetVersionLabel from $variationName." bash "$install_script" "${variation[@]}" && installSuccess=1 if [[ "$installSuccess" -eq 1 ]]; then break fi - echo "Failed to install dotnet from $variationName." + echo " Failed to install $dotnetVersionLabel from $variationName." done if [[ "$installSuccess" -eq 0 ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from any of the specified locations." + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install $dotnetVersionLabel from any of the specified locations." ExitWithExitCode 1 fi } @@ -312,7 +341,7 @@ function InitializeBuildTool { # return values _InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildToolCommand="msbuild" - _InitializeBuildToolFramework="netcoreapp3.1" + _InitializeBuildToolFramework="net8.0" } # Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116 @@ -416,13 +445,6 @@ function MSBuild { export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" - - export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true - export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6 - export NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS=1000 - Write-PipelineSetVariable -name "NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY" -value "true" - Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT" -value "6" - Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS" -value "1000" fi local toolset_dir="${_InitializeToolset%/*}" @@ -435,6 +457,8 @@ function MSBuild { possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" ) + possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" ) for path in "${possiblePaths[@]}"; do if [[ -f $path ]]; then selectedPath=$path @@ -479,7 +503,9 @@ function MSBuild-Core { # We should not Write-PipelineTaskError here because that message shows up in the build summary # The build already logged an error, that's the reason it failed. Producing an error here only adds noise. echo "Build failed with exit code $exit_code. Check errors above." - if [[ "$ci" == "true" ]]; then + + # When running on Azure Pipelines, override the returned exit code to avoid double logging. + if [[ "$ci" == "true" && -n ${SYSTEM_TEAMPROJECT:-} ]]; then Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error @@ -493,6 +519,17 @@ function MSBuild-Core { RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } +function GetDarc { + darc_path="$temp_dir/darc" + version="$1" + + if [[ -n "$version" ]]; then + version="--darcversion $version" + fi + + "$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version +} + ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` @@ -511,7 +548,7 @@ global_json_file="${repo_root}global.json" # determine if global.json contains a "runtimes" entry global_json_has_runtimes=false if command -v jq &> /dev/null; then - if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then + if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then global_json_has_runtimes=true fi elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then diff --git a/eng/pipelines/common/device-tests.yml b/eng/pipelines/common/device-tests.yml index 1f64ccb92..292dc3861 100644 --- a/eng/pipelines/common/device-tests.yml +++ b/eng/pipelines/common/device-tests.yml @@ -3,7 +3,7 @@ parameters: iosPool: { } catalystPool: { } windowsPool: { } - androidApiLevels: [ 30 ] + androidApiLevels: [ 33 ] iosVersions: [ 'latest' ] catalystVersions: [ 'latest' ] provisionatorChannel: 'latest' diff --git a/eng/pipelines/common/pack.yml b/eng/pipelines/common/pack.yml index d04fcd654..4c0595348 100644 --- a/eng/pipelines/common/pack.yml +++ b/eng/pipelines/common/pack.yml @@ -33,17 +33,63 @@ parameters: default: $(System.DefaultWorkingDirectory) steps: - - template: provision.yml - parameters: - checkoutDirectory: ${{ parameters.checkoutDirectory }} - poolName: ${{ parameters.poolName }} - provisionatorChannel: ${{ parameters.provisionatorChannel }} - gitHubToken: ${{ parameters.gitHubToken }} + + - ${{ if ne(variables['Build.DefinitionName'], 'dotnet-maui') }}: + - template: provision.yml + parameters: + checkoutDirectory: ${{ parameters.checkoutDirectory }} + poolName: ${{ parameters.poolName }} + provisionatorChannel: ${{ parameters.provisionatorChannel }} + gitHubToken: ${{ parameters.gitHubToken }} - ${{ each step in parameters.prepareSteps }}: - ${{ each pair in step }}: ${{ pair.key }}: ${{ pair.value }} + - task: PowerShell@2 + condition: eq(variables['PrivateBuild'], 'true') + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + + - pwsh: | + if ($env:JAVA_HOME_11_X64) { + $env:JAVA_HOME = $env:JAVA_HOME_11_X64 + } else { + $path = (Get-ChildItem $env:ProgramFiles\Microsoft\jdk-11.*\bin\java.exe) | Select-Object -First 1 + if ($path -and (Test-Path $path)) { + $env:JAVA_HOME = $path.Directory.Parent.FullName + } + } + if ($env:JAVA_HOME) { + echo "##vso[task.setvariable variable=JAVA_HOME]$env:JAVA_HOME" + echo "JAVA_HOME set to '$env:JAVA_HOME'" + } else { + echo "Unable to set JAVA_HOME" + } + displayName: 'Setup JDK Paths' + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) + + - pwsh: | + if ($env:ANDROID_SDK_ROOT) { + echo "ANDROID_SDK_ROOT already set to '$env:ANDROID_SDK_ROOT'" + } else { + if ((Test-Path "${env:ProgramFiles(x86)}\Android\android-sdk")) { + $env:ANDROID_SDK_ROOT = "${env:ProgramFiles(x86)}\Android\android-sdk" + } + if ($env:ANDROID_SDK_ROOT) { + echo "##vso[task.setvariable variable=ANDROID_SDK_ROOT]$env:ANDROID_SDK_ROOT" + echo "ANDROID_SDK_ROOT set to '$env:ANDROID_SDK_ROOT'" + } else { + echo "Unable to set ANDROID_SDK_ROOT" + } + } + displayName: 'Setup ANDROID_SDK_ROOT Paths' + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) + - pwsh: ./build.ps1 --target=dotnet --configuration="Release" --verbosity=diagnostic --nugetsource="${{ parameters.nugetFolder }}" displayName: 'Install .NET' retryCountOnTaskFailure: 3 @@ -75,6 +121,7 @@ steps: ${{ parameters.checkoutDirectory }}/artifacts/**/*.zip ${{ parameters.checkoutDirectory }}/artifacts/vs-workload.props ${{ parameters.checkoutDirectory }}/eng/automation/SignList.xml + ${{ parameters.checkoutDirectory }}/eng/automation/SignVerifyIgnore.txt !${{ parameters.checkoutDirectory}}/artifacts/docs-packs/** TargetFolder: $(build.artifactstagingdirectory) flattenFolders: true diff --git a/eng/pipelines/common/provision.yml b/eng/pipelines/common/provision.yml index 435e74443..34e05a4e9 100644 --- a/eng/pipelines/common/provision.yml +++ b/eng/pipelines/common/provision.yml @@ -149,6 +149,15 @@ steps: - pwsh: dotnet nuget locals all --clear displayName: 'Clear all NuGet caches' + - ${{ if eq(variables['System.TeamProject'], 'devdiv') }}: + - task: PowerShell@2 + condition: eq(variables['PrivateBuild'], 'true') + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) # Prepare for Reunion packages # - ${{ if eq(variables['System.TeamProject'], 'devdiv') }}: # - task: NuGetAuthenticate@0 @@ -161,11 +170,4 @@ steps: # $xml.configuration.RemoveChild($xml.configuration.disabledPackageSources) # $xml.Save($path) # displayName: 'Add "wasdk-internal" to NuGet.config' - # - task: PowerShell@2 - # condition: eq(variables['PrivateBuild'], 'true') - # displayName: Setup Private Feeds Credentials - # inputs: - # filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 - # arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token - # env: - # Token: $(dn-bot-dnceng-artifact-feeds-rw) \ No newline at end of file + diff --git a/eng/pipelines/common/sign.yml b/eng/pipelines/common/sign.yml index 4b9209051..702350362 100644 --- a/eng/pipelines/common/sign.yml +++ b/eng/pipelines/common/sign.yml @@ -1,6 +1,6 @@ stages: - stage: nuget_signing - dependsOn: pack_net6 + dependsOn: pack_net displayName: Sign Nuget jobs: - template: sign-artifacts/jobs/v2.yml@yaml-templates @@ -13,7 +13,7 @@ stages: signedArtifactPath: signed displayName: Sign Phase condition: and(succeeded(), eq(variables.signingCondition, true)) - + - template: nuget-msi-convert/job/v3.yml@yaml-templates parameters: yamlResourceName: yaml-templates @@ -23,3 +23,19 @@ stages: artifactPath: signed propsArtifactName: nuget signType: Real + postConvertSteps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: nuget + downloadPath: $(Build.ArtifactStagingDirectory)\sign-verify + patterns: | + **/SignVerifyIgnore.txt + + - task: MicroBuildCodesignVerify@3 + displayName: verify signed msi content + inputs: + TargetFolders: | + $(Build.ArtifactStagingDirectory)\bin\manifests + $(Build.ArtifactStagingDirectory)\bin\manifests-multitarget + ExcludeSNVerify: true + ApprovalListPathForCerts: $(Build.ArtifactStagingDirectory)\sign-verify\SignVerifyIgnore.txt diff --git a/eng/pipelines/common/variables.yml b/eng/pipelines/common/variables.yml index 7c368452c..9d7e56598 100644 --- a/eng/pipelines/common/variables.yml +++ b/eng/pipelines/common/variables.yml @@ -2,7 +2,7 @@ variables: - name: BuildVersion value: $[counter('buildversion-counter', 5000)] - name: NUGET_VERSION - value: 5.8.1 + value: 6.4.0 - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE value: true - name: DOTNET_VERSION @@ -57,14 +57,12 @@ variables: value: 7.1.3 - name: Codeql.Enabled value: false -- ${{ if ne(variables['Build.DefinitionName'], 'MAUI-private') }}: - - name: PrivateBuild - value: false +- group: Xamarin-Secrets # Variable groups required for private builds -- ${{ if eq(variables['Build.DefinitionName'], 'MAUI-private') }}: +- ${{ if or(eq(variables['System.TeamProject'], 'DevDiv'), eq(variables['Build.DefinitionName'], 'dotnet-maui')) }}: - name: PrivateBuild value: true # For eng/common/SetupNugetSources.ps1 - group: DotNetBuilds storage account read tokens - group: AzureDevOps-Artifact-Feeds-Pats -- group: Xamarin-Secrets + diff --git a/eng/pipelines/maui-release-internal.yml b/eng/pipelines/maui-release-internal.yml new file mode 100644 index 000000000..193ccce53 --- /dev/null +++ b/eng/pipelines/maui-release-internal.yml @@ -0,0 +1,86 @@ +trigger: + branches: + include: + - main + - release/* + tags: + include: + - '*' + paths: + include: + - '*' + exclude: + - .github/* + - docs/* + - CODE-OF-CONDUCT.md + - CONTRIBUTING.md + - LICENSE.TXT + - PATENTS.TXT + - README.md + - SECURITY.md + - THIRD-PARTY-NOTICES.TXT + + +variables: + - template: /eng/pipelines/common/variables.yml + +parameters: + - name: provisionatorChannel + displayName: 'Provisionator channel' + type: string + default: 'latest' # Support for launching a build against a Provisionator PR (e.g., pr/[github-account-name]/[pr-number]) as a means to test in-progress Provisionator changes + + - name: PackPlatforms + type: object + default: + - name: Windows + poolName: $(windowsNet6VmPool) + vmImage: $(windowsNet6VmImage) + artifact: nuget + +# resources: +# repositories: +# - repository: yaml-templates +# type: github +# name: xamarin/yaml-templates +# endpoint: xamarin +# ref: refs/heads/main +# - repository: sdk-insertions +# type: github +# name: xamarin/sdk-insertions +# ref: refs/heads/main +# endpoint: xamarin + +stages: + + - stage: pack_net + displayName: Pack .NET MAUI + dependsOn: [] + jobs: + - ${{ each PackPlatform in parameters.PackPlatforms }}: + - job: pack_net_${{ PackPlatform.name }} + workspace: + clean: all + displayName: ${{ PackPlatform.name }} + timeoutInMinutes: 240 + pool: + name: ${{ PackPlatform.poolName }} + vmImage: ${{ PackPlatform.vmImage }} + ${{ if startsWith(PackPlatform.poolName, 'VSEng-VSMac-Xamarin-Shared') }}: + demands: + - macOS.Name -equals Ventura + - macOS.Architecture -equals x64 + steps: + - template: common/pack.yml + parameters: + platform: ${{ PackPlatform.name }} + poolName: ${{ PackPlatform.poolName }} + provisionatorChannel: ${{ parameters.provisionatorChannel }} + artifact: ${{ PackPlatform.artifact }} + + - ${{ if or(eq(variables['System.TeamProject'], 'DevDiv'), eq(variables['Build.DefinitionName'], 'dotnet-maui')) }}: + - template: common/sign.yml # Sign only using the private server + # - template: common/insertion.yml # Insert on VS and SDK + # parameters: + # poolName: $(windowsNet6VmPool) + # vmImage: $(windowsNet6VmImage) diff --git a/eng/pipelines/maui-release.yml b/eng/pipelines/maui-release.yml index c71072ea3..84d020608 100644 --- a/eng/pipelines/maui-release.yml +++ b/eng/pipelines/maui-release.yml @@ -54,12 +54,12 @@ resources: stages: - - stage: pack_net6 + - stage: pack_net displayName: Pack .NET MAUI dependsOn: [] jobs: - ${{ each PackPlatform in parameters.PackPlatforms }}: - - job: pack_net6_${{ PackPlatform.name }} + - job: pack_net_${{ PackPlatform.name }} workspace: clean: all displayName: ${{ PackPlatform.name }} @@ -84,4 +84,4 @@ stages: - template: common/insertion.yml # Insert on VS and SDK parameters: poolName: $(windowsNet6VmPool) - vmImage: $(windowsNet6VmImage) + vmImage: $(windowsNet6VmImage) \ No newline at end of file diff --git a/eng/provisioning/provisioning.csx b/eng/provisioning/provisioning.csx index e54d08f61..f4ef2ee47 100644 --- a/eng/provisioning/provisioning.csx +++ b/eng/provisioning/provisioning.csx @@ -15,10 +15,11 @@ string SKIP_ANDROID_API_SDKS = Environment.GetEnvironmentVariable ("SKIP_ANDROID if(String.IsNullOrWhiteSpace(ANDROID_API_SDKS) && String.IsNullOrWhiteSpace(SKIP_ANDROID_API_SDKS)) { AndroidSdk() - .ApiLevel((AndroidApiLevel)21) - .ApiLevel((AndroidApiLevel)22) .ApiLevel((AndroidApiLevel)23) .ApiLevel((AndroidApiLevel)24) + .ApiLevel((AndroidApiLevel)25) + .ApiLevel((AndroidApiLevel)26) + .ApiLevel((AndroidApiLevel)27) .ApiLevel((AndroidApiLevel)28) .ApiLevel((AndroidApiLevel)29) .ApiLevel((AndroidApiLevel)30) @@ -35,7 +36,8 @@ if(String.IsNullOrWhiteSpace(ANDROID_API_SDKS) && String.IsNullOrWhiteSpace(SKIP .VirtualDevice("Android_x64_API30", (AndroidApiLevel)30, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.x86_64, AndroidVirtualDevice.NEXUS_5X) .VirtualDevice("Android_x64_API31", (AndroidApiLevel)31, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.x86_64, AndroidVirtualDevice.NEXUS_5X) .VirtualDevice("Android_x64_API32", (AndroidApiLevel)32, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.x86_64, AndroidVirtualDevice.NEXUS_5X) - .VirtualDevice("Android_x64_API33", (AndroidApiLevel)33, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.x86_64, AndroidVirtualDevice.NEXUS_5X); + .VirtualDevice("Android_x64_API33", (AndroidApiLevel)33, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.x86_64, AndroidVirtualDevice.NEXUS_5X) + .VirtualDevice("Android_x64_API34", (AndroidApiLevel)34, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.x86_64, AndroidVirtualDevice.NEXUS_5X); if (IsArm64) @@ -51,7 +53,8 @@ if(String.IsNullOrWhiteSpace(ANDROID_API_SDKS) && String.IsNullOrWhiteSpace(SKIP .VirtualDevice("Android_arm64_API30", (AndroidApiLevel)30, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.ARM64_v8a, AndroidVirtualDevice.NEXUS_5X) .VirtualDevice("Android_arm64_API31", (AndroidApiLevel)31, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.ARM64_v8a, AndroidVirtualDevice.NEXUS_5X) .VirtualDevice("Android_arm64_API32", (AndroidApiLevel)32, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.ARM64_v8a, AndroidVirtualDevice.NEXUS_5X) - .VirtualDevice("Android_arm64_API33", (AndroidApiLevel)33, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.ARM64_v8a, AndroidVirtualDevice.NEXUS_5X); + .VirtualDevice("Android_arm64_API33", (AndroidApiLevel)33, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.ARM64_v8a, AndroidVirtualDevice.NEXUS_5X) + .VirtualDevice("Android_arm64_API34", (AndroidApiLevel)34, AndroidSystemImageApi.GooglePlayStore, AndroidSystemImageAbi.ARM64_v8a, AndroidVirtualDevice.NEXUS_5X); } AndroidSdk().SdkManagerPackage ("build-tools;33.0.0");