diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f343fb4156..1205d8280a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,8 @@ pool: variables: solution: 'src\AppInstallerCLI.sln' EnableDetectorVcpkg: true + EnablePipelineCache: true + VCPKG_BINARY_SOURCES: "clear;nuget,https://pkgs.dev.azure.com/shine-oss/winget-cli/_packaging/WinGetDependencies/nuget/v3/index.json,readwrite" # Do not set the build version for a PR build. @@ -57,7 +59,6 @@ jobs: artifactIdentifier: 'x64release' variables: - BuildVer: $[counter(dependencies.GetReleaseTag.outputs['GetTag.tag'], 1)] buildOutDir: $(Build.SourcesDirectory)\src\$(buildPlatform)\$(buildConfiguration) buildOutDirAnyCpu: $(Build.SourcesDirectory)\src\AnyCPU\$(buildConfiguration) artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform) @@ -67,6 +68,21 @@ jobs: - task: NuGetToolInstaller@1 displayName: Install Nuget + - task: NuGetAuthenticate@1 + displayName: Authenticate to NuGet Feed + + - task: PowerShell@2 + displayName: Configure vcpkg NuGet binary cache credentials + inputs: + targetType: inline + script: | + $nugetExe = (& "$(VCPKG_INSTALLATION_ROOT)\vcpkg.exe" fetch nuget) | Select-Object -Last 1 + $feedUrl = "https://pkgs.dev.azure.com/shine-oss/winget-cli/_packaging/WinGetDependencies/nuget/v3/index.json" + & $nugetExe sources add -Name "WinGetDependencies" -Source $feedUrl -Username "AzureDevOps" -Password "$env:SYSTEM_ACCESSTOKEN" -StorePasswordInClearText + & $nugetExe setapikey "AzureDevOps" -Source $feedUrl + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + # Restores all projects, including native (vcxproj) projects - task: NuGetCommand@2 displayName: Restore Solution @@ -104,7 +120,7 @@ jobs: condition: not(eq(variables['Build.Reason'], 'PullRequest')) inputs: filePath: 'src\binver\Update-BinVer.ps1' - arguments: '-TargetFile binver\binver\version.h -BuildVersion $(BuildVer)' + arguments: '-TargetFile binver\binver\version.h' workingDirectory: 'src' # Build all solutions in the root directory. @@ -114,13 +130,17 @@ jobs: platform: '$(buildPlatform)' solution: '$(solution)' configuration: '$(buildConfiguration)' - msbuildArgs: '/bl:$(artifactsDir)\msbuild.binlog + msbuildArgs: '/graph /reportfileaccesses + /bl:$(artifactsDir)\msbuild.binlog /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=SideloadOnly - /p:WingetCleanIntermediateFiles=true' + /p:WingetCleanIntermediateFiles=false' maximumCpuCount: true + msbuildArchitecture: x64 + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) - task: MSBuild@1 displayName: Build MSIX Test Installer File @@ -283,6 +303,13 @@ jobs: TargetFolder: '$(artifactsDir)\E2ETests\Scripts' flattenFolders: true + - task: CopyFiles@2 + displayName: Copy MSBuildCache logs + inputs: + SourceFolder: '$(Build.SourcesDirectory)\MSBuildCacheLogs' + TargetFolder: '$(artifactsDir)\MSBuildCacheLogs' + condition: succeededOrFailed() + - task: PublishPipelineArtifact@1 displayName: Publish Pipeline Artifacts inputs: @@ -672,6 +699,21 @@ jobs: - task: NuGetToolInstaller@1 displayName: Install Nuget + - task: NuGetAuthenticate@1 + displayName: Authenticate to NuGet Feed + + - task: PowerShell@2 + displayName: Configure vcpkg NuGet binary cache credentials + inputs: + targetType: inline + script: | + $nugetExe = (& "$(VCPKG_INSTALLATION_ROOT)\vcpkg.exe" fetch nuget) | Select-Object -Last 1 + $feedUrl = "https://pkgs.dev.azure.com/shine-oss/winget-cli/_packaging/WinGetDependencies/nuget/v3/index.json" + & $nugetExe sources add -Name "WinGetDependencies" -Source $feedUrl -Username "AzureDevOps" -Password "$env:SYSTEM_ACCESSTOKEN" -StorePasswordInClearText + & $nugetExe setapikey "AzureDevOps" -Source $feedUrl + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + - task: NuGetCommand@2 displayName: Restore Solution inputs: @@ -690,7 +732,7 @@ jobs: platform: '$(buildPlatform)' solution: '$(solution)' configuration: '$(buildConfiguration)' - msbuildArgs: '/bl:$(artifactsDir)\msbuild.binlog' + msbuildArgs: '/bl:$(artifactsDir)\msbuild.binlog /p:MSBuildCacheEnabled=false' maximumCpuCount: true - task: CopyFiles@2 diff --git a/src/AppInstallerCLI/packages.config b/src/AppInstallerCLI/packages.config index f229371b33..ce05529419 100644 --- a/src/AppInstallerCLI/packages.config +++ b/src/AppInstallerCLI/packages.config @@ -1,4 +1,4 @@ - - + + \ No newline at end of file diff --git a/src/AppInstallerCLICore/packages.config b/src/AppInstallerCLICore/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/AppInstallerCLICore/packages.config +++ b/src/AppInstallerCLICore/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj index ad2925f603..c8d8332399 100644 --- a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj +++ b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj @@ -1116,6 +1116,11 @@ {ca460806-5e41-4e97-9a3d-1d74b433b663} + + {6aa3791a-0713-4548-a357-87a323e7ac3a} + false + false + diff --git a/src/AppInstallerCommonCore/packages.config b/src/AppInstallerCommonCore/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/AppInstallerCommonCore/packages.config +++ b/src/AppInstallerCommonCore/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/AppInstallerRepositoryCore/packages.config b/src/AppInstallerRepositoryCore/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/AppInstallerRepositoryCore/packages.config +++ b/src/AppInstallerRepositoryCore/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/AppInstallerSharedLib/packages.config b/src/AppInstallerSharedLib/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/AppInstallerSharedLib/packages.config +++ b/src/AppInstallerSharedLib/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ec7737aa4f..3dfb6f2952 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -45,6 +45,25 @@ $(WinGetMacros)$(DefineConstants) + + + $(SolutionDir)packages\microsoft.msbuildcache.azurepipelines\0.1.328-preview + + $(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);\**\VSApplicationInsights\*;\**\.solution-triplet + + + + + + + + + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 0000000000..0df1b27e2c --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 6a42f20e99..243f5fac22 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -13,6 +13,8 @@ + + diff --git a/src/Microsoft.Management.Configuration.OutOfProc/packages.config b/src/Microsoft.Management.Configuration.OutOfProc/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/Microsoft.Management.Configuration.OutOfProc/packages.config +++ b/src/Microsoft.Management.Configuration.OutOfProc/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/Microsoft.Management.Configuration/packages.config b/src/Microsoft.Management.Configuration/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/Microsoft.Management.Configuration/packages.config +++ b/src/Microsoft.Management.Configuration/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/Microsoft.Management.Deployment.InProc/packages.config b/src/Microsoft.Management.Deployment.InProc/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/Microsoft.Management.Deployment.InProc/packages.config +++ b/src/Microsoft.Management.Deployment.InProc/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/Microsoft.Management.Deployment.OutOfProc/packages.config b/src/Microsoft.Management.Deployment.OutOfProc/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/Microsoft.Management.Deployment.OutOfProc/packages.config +++ b/src/Microsoft.Management.Deployment.OutOfProc/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/Microsoft.Management.Deployment/packages.config b/src/Microsoft.Management.Deployment/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/Microsoft.Management.Deployment/packages.config +++ b/src/Microsoft.Management.Deployment/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/WinGetServer/packages.config b/src/WinGetServer/packages.config index a4d92efeae..e57c06d54c 100644 --- a/src/WinGetServer/packages.config +++ b/src/WinGetServer/packages.config @@ -1,4 +1,4 @@ - - + + \ No newline at end of file diff --git a/src/WinGetUtil/packages.config b/src/WinGetUtil/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/WinGetUtil/packages.config +++ b/src/WinGetUtil/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/WinGetYamlFuzzing/packages.config b/src/WinGetYamlFuzzing/packages.config index 18270c6de7..49236e89e6 100644 --- a/src/WinGetYamlFuzzing/packages.config +++ b/src/WinGetYamlFuzzing/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/WindowsPackageManager/packages.config b/src/WindowsPackageManager/packages.config index f7979cb735..dad4d07b35 100644 --- a/src/WindowsPackageManager/packages.config +++ b/src/WindowsPackageManager/packages.config @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/src/nuget.config b/src/nuget.config index 32ddd30f3b..3b3d763620 100644 --- a/src/nuget.config +++ b/src/nuget.config @@ -1,5 +1,10 @@  + + + + +