From e45987b33a53fdbe9330b15ae2dd5688645b85cd Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Wed, 24 Mar 2021 11:34:29 -0400 Subject: [PATCH] [ci] Build and pack updates, bump to .NET 5.0.201 --- .../automation/azure-pipelines-nightly.yaml | 2 +- .../automation/azure-pipelines-oss.yaml | 50 ++++++++----------- build-tools/automation/azure-pipelines.yaml | 37 +++++--------- .../yaml-templates/commercial-build.yaml | 18 ++----- .../create-packs/Directory.Build.targets | 25 +++++----- .../create-packs/Microsoft.Android.Sdk.proj | 1 - build-tools/scripts/Packaging.mk | 5 +- build-tools/scripts/msbuild.mk | 8 +++ .../Microsoft.Android.Sdk.ILLink.csproj | 2 +- 9 files changed, 64 insertions(+), 84 deletions(-) diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index 8376e3754ec..a21c4c5676a 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -39,7 +39,7 @@ variables: InstallerArtifactName: installers-unsigned TestAssembliesArtifactName: test-assemblies DotNetCoreVersion: 3.1.405 - DotNet5Version: 5.0.100 + DotNet5Version: 5.0.201 HostedMacImage: macOS-10.15 GitHub.Token: $(github--pat--vs-mobiletools-engineering-service2) NUnit.NumberOfTestWorkers: 4 diff --git a/build-tools/automation/azure-pipelines-oss.yaml b/build-tools/automation/azure-pipelines-oss.yaml index adbe40e2a59..a2dc6e05db6 100644 --- a/build-tools/automation/azure-pipelines-oss.yaml +++ b/build-tools/automation/azure-pipelines-oss.yaml @@ -27,7 +27,7 @@ variables: EXTRA_MSBUILD_ARGS: /p:AutoProvision=True /p:AutoProvisionUsesSudo=True /p:IgnoreMaxMonoVersion=False PREPARE_FLAGS: PREPARE_CI=1 PREPARE_CI_PR=1 DotNetCoreVersion: 3.1.405 - DotNet5Version: 5.0.100 + DotNet5Version: 5.0.201 GitHub.Token: $(github--pat--vs-mobiletools-engineering-service2) stages: @@ -110,17 +110,11 @@ stages: displayName: make jenkins - script: > - echo "make create-pkg create-vsix V=1 CONFIGURATION=$(XA.Build.Configuration)" && - make create-pkg create-vsix V=1 CONFIGURATION=$(XA.Build.Configuration) + echo "make create-installers V=1 CONFIGURATION=$(XA.Build.Configuration)" && + make create-installers V=1 CONFIGURATION=$(XA.Build.Configuration) workingDirectory: $(Build.SourcesDirectory) displayName: create installers - - script: > - echo "make package-oss CONFIGURATION=$(XA.Build.Configuration) V=1" && - make package-oss CONFIGURATION=$(XA.Build.Configuration) V=1 - workingDirectory: $(Build.SourcesDirectory) - displayName: package oss - - script: > mkdir -p bin/Build$(XA.Build.Configuration)/$(InstallerArtifactName) && cp bin/Build$(XA.Build.Configuration)/*.vsix bin/Build$(XA.Build.Configuration)/$(InstallerArtifactName) && @@ -134,6 +128,12 @@ stages: artifactName: $(InstallerArtifactName) - macOS and Windows targetPath: $(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/$(InstallerArtifactName) + - task: PublishPipelineArtifact@1 + displayName: upload nupkgs + inputs: + artifactName: $(NuGetArtifactName) - macOS + targetPath: $(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName) + - script: > echo "all-tests CONFIGURATION=$(XA.Build.Configuration) V=1" && make all-tests CONFIGURATION=$(XA.Build.Configuration) V=1 @@ -146,19 +146,6 @@ stages: workingDirectory: $(Build.SourcesDirectory) displayName: package build status - - task: MSBuild@1 - displayName: pack all nupkgs - inputs: - solution: $(Build.SourcesDirectory)/build-tools/create-packs/Microsoft.Android.Sdk.proj - configuration: $(XA.Build.Configuration) - msbuildArguments: /t:CreateAllPacks /restore /bl:$(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/create-all-packs.binlog - - - task: PublishPipelineArtifact@1 - displayName: upload nupkgs - inputs: - artifactName: $(NuGetArtifactName) - macOS - targetPath: $(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName) - - script: > echo "make run-performance-tests CONFIGURATION=$(XA.Build.Configuration) V=1" && make run-performance-tests CONFIGURATION=$(XA.Build.Configuration) V=1 @@ -186,6 +173,15 @@ stages: - checkout: self submodules: recursive + - template: yaml-templates/use-dot-net.yaml + parameters: + version: $(DotNet5Version) + remove_dotnet: true + + - template: yaml-templates/use-dot-net.yaml + parameters: + version: $(DotNetCoreVersion) + - task: NuGetToolInstaller@1 displayName: 'Use NuGet 5.x' inputs: @@ -214,16 +210,12 @@ stages: - script: make jenkins V=1 PREPARE_CI_PR=1 PREPARE_AUTOPROVISION=1 CONFIGURATION=$(XA.Build.Configuration) displayName: make jenkins + - script: make create-nupkgs V=1 CONFIGURATION=$(XA.Build.Configuration) + displayName: make create-nupkgs + - script: make package-deb V=1 CONFIGURATION=$(XA.Build.Configuration) displayName: make package-deb - - task: MSBuild@1 - displayName: pack all nupkgs - inputs: - solution: $(System.DefaultWorkingDirectory)/build-tools/create-packs/Microsoft.Android.Sdk.proj - configuration: $(XA.Build.Configuration) - msbuildArguments: /t:CreateAllPacks /restore /bl:$(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/create-all-packs.binlog - - script: > mkdir -p $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/linux-artifacts && cp $(System.DefaultWorkingDirectory)/*xamarin.android*.tar.bz2 $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/linux-artifacts && diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index a64050937db..340340adbf0 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -54,7 +54,7 @@ variables: TestAssembliesArtifactName: test-assemblies NUnitConsoleVersion: 3.11.1 DotNetCoreVersion: 3.1.405 - DotNet5Version: 5.0.103 + DotNet5Version: 5.0.201 HostedMacImage: macOS-10.15 HostedWinVS2019: Hosted Windows 2019 with VS2019 VSEngWinVS2019: Xamarin-Android-Win2019 @@ -158,7 +158,7 @@ stages: - template: yaml-templates/upload-results.yaml parameters: solution: $(System.DefaultWorkingDirectory)/xamarin-android/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj - artifactName: Build Results - Nightly macOS + artifactName: Build Results - macOS - script: mono $(System.DefaultWorkingDirectory)/xamarin-android/build-tools/xaprepare/xaprepare/bin/$(XA.Build.Configuration)/xaprepare.exe --s=DetermineApplicableTests --no-emoji --run-mode=CI displayName: determine which test stages to run @@ -357,11 +357,12 @@ stages: projects: Xamarin.Android.sln arguments: '-c $(XA.Build.Configuration) -target:Prepare -m:1 -p:AutoProvision=true -bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\dotnet-build-prepare.binlog' + # Build, pack .nupkgs, and extract workload packs to dotnet preview test directory - task: DotNetCoreCLI@2 displayName: Build Solution inputs: projects: Xamarin.Android.sln - arguments: '-c $(XA.Build.Configuration) -m:1 -bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\dotnet-build.binlog' + arguments: '-t:PackDotNet -c $(XA.Build.Configuration) -m:1 -bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\dotnet-build.binlog' - task: MSBuild@1 displayName: msbuild create-vsix @@ -370,14 +371,6 @@ stages: configuration: $(XA.Build.Configuration) msbuildArguments: /p:CreateVsixContainer=True /p:ZipPackageCompressionLevel=Normal /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\dotnet-create-vsix.binlog - # Pack .nupkgs and extract workload packs to dotnet preview test directory - - task: MSBuild@1 - displayName: PackDotNet - inputs: - solution: Xamarin.Android.sln - configuration: $(XA.Build.Configuration) - msbuildArguments: /t:PackDotNet /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\dotnet-packdotnet.binlog - - task: MSBuild@1 displayName: msbuild xabuild inputs: @@ -414,15 +407,13 @@ stages: displayName: install apkdiff dotnet tool continueOnError: true - # Limit the amount of worker threads used to run these tests in parallel to half of what is currently available (8) on the Windows pool. - # Using all available cores seems to occasionally bog down our machines and cause parallel test execution to slow down dramatically. - # Only run a subset of the Xamarin.Android.Build.Tests against the local Windows build tree. - template: yaml-templates\run-nunit-tests.yaml parameters: + useDotNet: true testRunTitle: Smoke MSBuild Tests - Windows Dotnet Build - testAssembly: $(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\net472\Xamarin.Android.Build.Tests.dll + testAssembly: $(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\netcoreapp3.1\Xamarin.Android.Build.Tests.dll testResultsFile: TestResult-SmokeMSBuildTests-WinDotnetBuildTree-$(XA.Build.Configuration).xml - nunitConsoleExtraArgs: --where "cat == SmokeTests" + dotNetTestExtraArgs: --filter "TestCategory = SmokeTests $(DotNetNUnitCategories)" - template: yaml-templates\upload-results.yaml parameters: @@ -489,15 +480,13 @@ stages: workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-android displayName: make jenkins - - task: MSBuild@1 - displayName: pack all nupkgs + - task: DotNetCoreCLI@2 + displayName: extract workload packs inputs: - solution: $(System.DefaultWorkingDirectory)/xamarin-android/build-tools/create-packs/Microsoft.Android.Sdk.proj - configuration: $(XA.Build.Configuration) - msbuildArguments: >- - /t:CreateAllPacks,ExtractWorkloadPacks /restore - /p:NuGetLicense=$(System.DefaultWorkingDirectory)/xamarin-android/external/monodroid/tools/scripts/License.txt - /bl:$(System.DefaultWorkingDirectory)/xamarin-android/bin/Build$(XA.Build.Configuration)/create-all-packs.binlog + projects: $(System.DefaultWorkingDirectory)/xamarin-android/build-tools/create-packs/Microsoft.Android.Sdk.proj + arguments: >- + -t:CreateAllPacks,ExtractWorkloadPacks -c $(XA.Build.Configuration) + -bl:$(System.DefaultWorkingDirectory)/xamarin-android/bin/Build$(XA.Build.Configuration)/create-all-packs.binlog - script: > mkdir -p $(System.DefaultWorkingDirectory)/xamarin-android/bin/Build$(XA.Build.Configuration)/nuget-linux && diff --git a/build-tools/automation/yaml-templates/commercial-build.yaml b/build-tools/automation/yaml-templates/commercial-build.yaml index e32aa45b4bc..f044c4a0fe7 100644 --- a/build-tools/automation/yaml-templates/commercial-build.yaml +++ b/build-tools/automation/yaml-templates/commercial-build.yaml @@ -86,17 +86,9 @@ steps: /p:MicroBuildOverridePluginDirectory=$(Build.StagingDirectory)/MicroBuild/Plugins /bl:${{ parameters.xaSourcePath }}/bin/Build$(XA.Build.Configuration)/restore-sign-pkg-content.binlog -# Create and upload .nupkgs -- task: MSBuild@1 - displayName: pack all nupkgs - inputs: - solution: ${{ parameters.xaSourcePath }}/build-tools/create-packs/Microsoft.Android.Sdk.proj - configuration: $(XA.Build.Configuration) - msbuildArguments: >- - /t:CreateAllPacks - /restore - /p:NuGetLicense=${{ parameters.xaSourcePath }}/external/monodroid/tools/scripts/License.txt - /bl:${{ parameters.xaSourcePath }}/bin/Build$(XA.Build.Configuration)/create-all-packs.binlog +- script: make create-installers V=1 CONFIGURATION=$(XA.Build.Configuration) + workingDirectory: ${{ parameters.xaSourcePath }} + displayName: make create-installers - task: PublishPipelineArtifact@1 displayName: upload nupkgs @@ -104,10 +96,6 @@ steps: artifactName: $(NuGetArtifactName) targetPath: ${{ parameters.xaSourcePath }}/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName) -- script: make create-installers V=1 CONFIGURATION=$(XA.Build.Configuration) - workingDirectory: ${{ parameters.xaSourcePath }} - displayName: make create-installers - - script: > mkdir -p bin/Build$(XA.Build.Configuration)/$(InstallerArtifactName) && cp bin/Build$(XA.Build.Configuration)/*.vsix bin/Build$(XA.Build.Configuration)/$(InstallerArtifactName) && diff --git a/build-tools/create-packs/Directory.Build.targets b/build-tools/create-packs/Directory.Build.targets index 4560c7359c5..55d036440c9 100644 --- a/build-tools/create-packs/Directory.Build.targets +++ b/build-tools/create-packs/Directory.Build.targets @@ -17,6 +17,7 @@ + $(XamarinAndroidSourcePath)external\monodroid\tools\scripts\License.txt $(XamarinAndroidSourcePath)LICENSE LICENSE @@ -71,23 +72,23 @@ - + - - - - - - - - - - - + + + + + + + + + + + <_PackageFiles Include="$(NetCoreAppToolsSourceDir)generator.dll" PackagePath="tools" /> <_PackageFiles Include="$(NetCoreAppToolsSourceDir)generator.runtimeconfig.json" PackagePath="tools" /> - <_PackageFiles Include="$(NetCoreAppToolsSourceDir)Java.Interop.Tools.Generator.dll" PackagePath="tools" /> <_PackageFiles Include="$(NetCoreAppToolsSourceDir)javadoc-to-mdoc.dll" PackagePath="tools" /> <_PackageFiles Include="$(NetCoreAppToolsSourceDir)javadoc-to-mdoc.runtimeconfig.json" PackagePath="tools" /> <_PackageFiles Include="$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\Version*" PackagePath="tools" /> diff --git a/build-tools/scripts/Packaging.mk b/build-tools/scripts/Packaging.mk index b83c292457d..24ef8a0e4be 100644 --- a/build-tools/scripts/Packaging.mk +++ b/build-tools/scripts/Packaging.mk @@ -5,7 +5,10 @@ USE_COMMERCIAL_INSTALLER_NAME=true EXPERIMENTAL=false endif -create-installers: create-pkg create-vsix +create-installers: create-nupkgs create-pkg create-vsix + +create-nupkgs: + $(call DOTNET_BINLOG,create-all-packs) -t:CreateAllPacks $(topdir)/build-tools/create-packs/Microsoft.Android.Sdk.proj create-pkg: MONO_IOMAP=all MONO_OPTIONS="$(MONO_OPTIONS)" $(call MSBUILD_BINLOG,create-pkg) /p:Configuration=$(CONFIGURATION) /t:CreatePkg \ diff --git a/build-tools/scripts/msbuild.mk b/build-tools/scripts/msbuild.mk index 082209a1276..bfb7020ca28 100644 --- a/build-tools/scripts/msbuild.mk +++ b/build-tools/scripts/msbuild.mk @@ -23,6 +23,8 @@ # $(MSBUILD_FLAGS): Additional MSBuild flags; contains $(CONFIGURATION), $(V), $(MSBUILD_ARGS). MSBUILD = msbuild +DOTNET_TOOL = dotnet +DOTNET_VERB = build MSBUILD_FLAGS = /p:Configuration=$(CONFIGURATION) $(MSBUILD_ARGS) ifeq ($(OS_NAME),Darwin) @@ -43,6 +45,12 @@ define MSBUILD_BINLOG /binaryLogger:"$(dir $(realpath $(firstword $(MAKEFILE_LIST))))/bin/$(if $(3),$(3),Build)$(CONFIGURATION)/msbuild-`date +%Y%m%dT%H%M%S`-$(1).binlog" endef +# $(call DOTNET_BINLOG,name,dotnet=$(DOTNET_TOOL)) build=$(DOTNET_VERB) +define DOTNET_BINLOG + $(if $(2),$(2),$(DOTNET_TOOL)) $(DOTNET_VERB) -c $(CONFIGURATION) -v:n \ + -bl:"$(dir $(realpath $(firstword $(MAKEFILE_LIST))))/bin/Build$(CONFIGURATION)/msbuild-`date +%Y%m%dT%H%M%S`-$(1).binlog" +endef + else # $(MSBUILD) != 1 _CSC_EMITS_PDB := $(shell if $(_PKG_CONFIG) --atleast-version=4.9 mono ; then echo Pdb; fi ) ifeq ($(_CSC_EMITS_PDB),Pdb) diff --git a/src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj b/src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj index 39ddab0d226..48d3eaf93de 100644 --- a/src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj +++ b/src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj @@ -1,7 +1,7 @@  - net6.0 + net5.0 NET5_LINKER false $(XAInstallPrefix)xbuild\Xamarin\Android\