From 77f5aebb4f9eaf955df4d264284bfea5dfff7f01 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 27 Aug 2019 02:19:22 +0200 Subject: [PATCH 01/11] Use the new yaml --- azure-pipelines.yml | 104 ++++++++------------------------------------ build.cake | 71 +++--------------------------- 2 files changed, 25 insertions(+), 150 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e4c3a480..c7e2f4a0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,102 +1,34 @@ - trigger: - master - AndroidX - refs/tags/* variables: - VERBOSITY: normal BUILD_NUMBER: $[counter('$(Build.SourceBranchName)_counter', 1)] - MONO_VERSION: 5_18_1 - XCODE_VERSION: 10.2.1 - CAKE_VERSION: 0.34.1 - API_TOOLS_VERSION: 1.0.2-preview.13 - BINDERATOR_VERSION: 0.3.0 - ANDROIDX_TOOL_VERSION: 1.0.0-preview03 - DOTNET_CORE_VERSION: 2.2.x - # PACKAGE_VERSION_SUFFIX: - # XAMARIN_ANDROID_PATH: +# XAMARIN_ANDROID_PATH: +# SUPPORT_MERGED_DLL_URL: resources: repositories: - - repository: xamarin-templates + - repository: internal-templates type: github name: xamarin/yaml-templates endpoint: xamarin + ref: refs/heads/dev/signing-job + - repository: components + type: github + name: xamarin/XamarinComponents + endpoint: xamarin + ref: refs/heads/dev/templating jobs: - - # run the build - - job: build - strategy: - matrix: - macos: - imageName: 'Hosted Mac Internal Mojave' - windows: - imageName: 'Hosted Windows 2019 with VS2019' - displayName: 'Build' - pool: - name: $(imageName) - steps: - # install xamarin - - bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION) - displayName: 'Switch to the latest Xamarin SDK' - condition: eq(variables['System.JobName'], 'macos') - - bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer - displayName: 'Switch to the latest Xcode' - condition: eq(variables['System.JobName'], 'macos') - # install dotnet and tools - - bash: echo '##vso[task.setvariable variable=PATH;]'$PATH:$HOME/.dotnet/tools - displayName: 'Add ~/.dotnet/tools to the PATH environment variable' - condition: eq(variables['System.JobName'], 'macos') - - task: UseDotNet@2 - displayName: 'Use the correct version of the .NET Core SDK' - inputs: - version: $(DOTNET_CORE_VERSION) - - powershell: | - dotnet tool install -g cake.tool --version $(CAKE_VERSION) - dotnet tool install -g api-tools --version $(API_TOOLS_VERSION) - dotnet tool install -g xamarin.androidbinderator.tool --version $(BINDERATOR_VERSION) - dotnet tool install -g xamarin.androidx.migration.tool --version $(ANDROIDX_TOOL_VERSION) - displayName: 'Install dotnet tools' - # run the main build - - powershell: dotnet cake --target=ci --verbosity=$(VERBOSITY) - displayName: 'Run build' - # publish the nugets - - task: PublishBuildArtifacts@1 - condition: eq(variables['System.JobName'], 'macos') - displayName: 'Publish artifacts' - inputs: - PathToPublish: output - ArtifactName: nuget - # publish the output with the os name - - task: PublishBuildArtifacts@1 - displayName: 'Publish artifacts' - inputs: - PathToPublish: output - ArtifactName: 'output-$(System.JobName)' - - # only sign the packages when running on Windows, and using the private server which has the certificates + - template: .ci/prepare.yml@components + - template: .ci/build-manifest.yml@components + parameters: + tools: + 'xamarin.androidbinderator.tool': '0.3.0' + 'xamarin.androidx.migration.tool': '1.0.0-preview03' - ${{ if eq(variables['System.TeamProject'], 'devdiv') }}: - - job: signing - displayName: Signing NuGets - variables: - skipComponentGovernanceDetection: true - dependsOn: build - pool: - name: VSEng-XamarinCustom - demands: - - corpnet - condition: and(succeeded(), or(eq(variables['CodeSign'], 'true'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/AndroidX'))) - steps: - # don't checkout code and sign the packages - - checkout: none - - template: sign-artifacts.yml@xamarin-templates - parameters: - targetFolder: '$(Build.ArtifactStagingDirectory)/signed' - # publish the signed packages - - task: PublishBuildArtifacts@1 - displayName: 'Publish Signed NuGets' - inputs: - artifactName: nuget-signed - pathToPublish: '$(Build.ArtifactStagingDirectory)/signed' + - template: sign-artifacts/jobs/v1.yml@internal-templates + parameters: + dependsOn: [ 'build' ] diff --git a/build.cake b/build.cake index f57af45e..bc194561 100644 --- a/build.cake +++ b/build.cake @@ -4,20 +4,15 @@ // Cake Addins #addin nuget:?package=Cake.FileHelpers&version=3.2.0 #addin nuget:?package=Cake.Compression&version=0.2.3 -#addin nuget:?package=Xamarin.Nuget.Validator&version=1.1.1 using System.Text.RegularExpressions; using System.Xml; using System.Xml.Linq; -using Xamarin.Nuget.Validator; // The main configuration points var TARGET = Argument ("t", Argument ("target", "Default")); -var BUILD_CONFIG = Argument ("config", "Release"); -var VERBOSITY = (Verbosity) Enum.Parse (typeof(Verbosity), Argument ("v", Argument ("verbosity", "Normal")), true); -var PACKAGE_VERSION_SUFFIX = EnvironmentVariable ("PACKAGE_VERSION_SUFFIX"); -var XAMARIN_ANDROID_PATH = EnvironmentVariable ("XAMARIN_ANDROID_PATH"); -var JAVA_HOME = EnvironmentVariable ("JAVA_HOME"); +var CONFIGURATION = Argument ("c", Argument ("configuration", "Release")); +var VERBOSITY = Argument ("v", Argument ("verbosity", Verbosity.Normal)); // Lists all the artifacts and their versions for com.android.support.* // https://dl.google.com/dl/android/maven2/com/android/support/group-index.xml @@ -30,6 +25,7 @@ var REF_DOCS_URL = "https://bosstoragemirror.blob.core.windows.net/android-docs- var SUPPORT_MERGED_DLL_URL = EnvironmentVariable("SUPPORT_MERGED_DLL_URL") ?? $"https://github.com/xamarin/AndroidSupportComponents/releases/download/28.0.0.2/AndroidSupport.Merged.dll"; // Resolve Xamarin.Android installation +var XAMARIN_ANDROID_PATH = EnvironmentVariable ("XAMARIN_ANDROID_PATH"); var ANDROID_SDK_BASE_VERSION = "v1.0"; var ANDROID_SDK_VERSION = "v9.0"; if (string.IsNullOrEmpty(XAMARIN_ANDROID_PATH)) { @@ -53,7 +49,6 @@ var BUILD_TIMESTAMP = DateTime.UtcNow.ToString(); var REQUIRED_DOTNET_TOOLS = new [] { "xamarin-android-binderator", - "api-tools", "xamarin.androidx.migration.tool" }; @@ -141,17 +136,13 @@ Task("libs") .Does(() => { var settings = new MSBuildSettings() - .SetConfiguration(BUILD_CONFIG) + .SetConfiguration(CONFIGURATION) .SetVerbosity(VERBOSITY) .SetMaxCpuCount(0) .WithRestore() - .WithProperty("PackageVersionSuffix", PACKAGE_VERSION_SUFFIX) .WithProperty("DesignTimeBuild", "false") .WithProperty("AndroidSdkBuildToolsVersion", "28.0.3"); - if (!string.IsNullOrEmpty (JAVA_HOME)) - settings.WithProperty ("JavaSdkDirectory", JAVA_HOME); - MSBuild("./generated/AndroidX.sln", settings); }); @@ -160,20 +151,16 @@ Task("nuget") .Does(() => { var settings = new MSBuildSettings() - .SetConfiguration(BUILD_CONFIG) + .SetConfiguration(CONFIGURATION) .SetVerbosity(VERBOSITY) .SetMaxCpuCount(0) .WithRestore() - .WithProperty("PackageVersionSuffix", PACKAGE_VERSION_SUFFIX) .WithProperty("PackageRequireLicenseAcceptance", "true") .WithProperty("PackageOutputPath", MakeAbsolute ((DirectoryPath)"./output/").FullPath) .WithProperty("DesignTimeBuild", "false") .WithProperty("AndroidSdkBuildToolsVersion", "28.0.3") .WithTarget("Pack"); - if (!string.IsNullOrEmpty (JAVA_HOME)) - settings.WithProperty ("JavaSdkDirectory", JAVA_HOME); - MSBuild("./generated/AndroidX.sln", settings); }); @@ -206,7 +193,7 @@ Task("samples") // build the samples var settings = new MSBuildSettings() - .SetConfiguration(BUILD_CONFIG) + .SetConfiguration(CONFIGURATION) .SetVerbosity(VERBOSITY) .SetMaxCpuCount(0) .WithRestore() @@ -215,49 +202,9 @@ Task("samples") .WithProperty("DesignTimeBuild", "false") .WithProperty("AndroidSdkBuildToolsVersion", "28.0.3"); - if (!string.IsNullOrEmpty (JAVA_HOME)) - settings.WithProperty ("JavaSdkDirectory", JAVA_HOME); - MSBuild("./samples/BuildAll/BuildAll.sln", settings); }); -Task("nuget-validation") - .Does(() => -{ - var options = new NugetValidatorOptions { - Copyright = "© Microsoft Corporation. All rights reserved.", - Author = "Microsoft", - Owner = "Microsoft", - NeedsProjectUrl = true, - NeedsLicenseUrl = true, - ValidateRequireLicenseAcceptance = true, - ValidPackageNamespace = new [] { "Xamarin" }, - }; - - var nupkgFiles = GetFiles("./output/*.nupkg"); - Information("Found {0} NuGet packages to validate.", nupkgFiles.Count()); - - foreach (var nupkgFile in nupkgFiles) { - var fname = nupkgFile.GetFilename(); - Information($"Verifiying metadata of {fname}..."); - var result = NugetValidator.Validate(MakeAbsolute(nupkgFile).FullPath, options); - if (!result.Success) { - Error($"Metadata validation failed for: {fname} "); - Error(string.Join("\n ", result.ErrorMessages)); - throw new Exception($"Invalid Metadata for: {fname}"); - } else { - Information($"Metadata validation passed for: {fname}"); - } - } -}); - -Task ("diff") - .Does (() => -{ - RunProcess("api-tools", - "nuget-diff output --latest --prerelease --group-ids --ignore-unchanged --output output/api-diff --cache externals/package_cache"); -}); - Task ("generate-mapping") .IsDependentOn ("merge") .Does (() => @@ -281,7 +228,7 @@ Task ("merge") .Does (() => { // find all the dlls - var allDlls = GetFiles($"./generated/*/bin/{BUILD_CONFIG}/monoandroid*/Xamarin.*.dll"); + var allDlls = GetFiles($"./generated/*/bin/{CONFIGURATION}/monoandroid*/Xamarin.*.dll"); var mergeDlls = allDlls .GroupBy(d => new FileInfo(d.FullPath).Name) .Select(g => g.FirstOrDefault()) @@ -333,9 +280,7 @@ Task ("full-run") Task ("Default") .IsDependentOn ("binderate") .IsDependentOn ("nuget") - .IsDependentOn ("nuget-validation") .IsDependentOn ("generate-mapping") - .IsDependentOn ("diff") .IsDependentOn ("samples"); Task ("ci") @@ -343,9 +288,7 @@ Task ("ci") .IsDependentOn ("inject-variables") .IsDependentOn ("binderate") .IsDependentOn ("nuget") - .IsDependentOn ("nuget-validation") .IsDependentOn ("generate-mapping") - .IsDependentOn ("diff") .IsDependentOn ("samples"); RunTarget (TARGET); From 9d4afe29164b34d8995a2559e90d79724104f96e Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 27 Aug 2019 02:21:34 +0200 Subject: [PATCH 02/11] Mistakes right off the bad, does not bode well --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c7e2f4a0..01868388 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,7 +23,7 @@ resources: jobs: - template: .ci/prepare.yml@components - - template: .ci/build-manifest.yml@components + - template: .ci/build.yml@components parameters: tools: 'xamarin.androidbinderator.tool': '0.3.0' From ce7706f4d732a638455ec68a8f88ce3d3d0ecb31 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 27 Aug 2019 02:22:37 +0200 Subject: [PATCH 03/11] Yup, forgot this as well --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 01868388..b66a2b3f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,8 +26,8 @@ jobs: - template: .ci/build.yml@components parameters: tools: - 'xamarin.androidbinderator.tool': '0.3.0' - 'xamarin.androidx.migration.tool': '1.0.0-preview03' + - 'xamarin.androidbinderator.tool': '0.3.0' + - 'xamarin.androidx.migration.tool': '1.0.0-preview03' - ${{ if eq(variables['System.TeamProject'], 'devdiv') }}: - template: sign-artifacts/jobs/v1.yml@internal-templates parameters: From 0e408dda75a8e3eaba42edb0791d79c74a2eb3ac Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 27 Aug 2019 02:24:47 +0200 Subject: [PATCH 04/11] Use the correct "master" branch --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b66a2b3f..2888ae81 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,6 +23,8 @@ resources: jobs: - template: .ci/prepare.yml@components + parameters: + masterBranchName: 'AndroidX' - template: .ci/build.yml@components parameters: tools: From 25a692ef385f5f05d02dda7b1a1159bbd85e8943 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 27 Aug 2019 02:27:05 +0200 Subject: [PATCH 05/11] dsafasdf --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2888ae81..1ea13856 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,6 +27,7 @@ jobs: masterBranchName: 'AndroidX' - template: .ci/build.yml@components parameters: + cakeTemplatesBranch: 'dev/templating' tools: - 'xamarin.androidbinderator.tool': '0.3.0' - 'xamarin.androidx.migration.tool': '1.0.0-preview03' From 54e516fcab8d6b4ef6951a9860f1c82f67e180a2 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 27 Aug 2019 02:31:40 +0200 Subject: [PATCH 06/11] sss --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1ea13856..be066735 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,6 +24,7 @@ resources: jobs: - template: .ci/prepare.yml@components parameters: + buildType: 'basic' masterBranchName: 'AndroidX' - template: .ci/build.yml@components parameters: From 9c4f4de54a447c654761a978010715958b490e75 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 28 Aug 2019 02:48:12 +0200 Subject: [PATCH 07/11] Fix the build warnings and errors --- config.json | 4 +++- source/AndroidXProject.cshtml | 2 +- source/androidx.slice/slice-view/transforms/Metadata.xml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index 033136b4..3b76af63 100644 --- a/config.json +++ b/config.json @@ -533,6 +533,7 @@ "artifactId" : "guava", "version" : "27.1.0", "nugetId" : "Xamarin.Google.Guava", + "nugetVersion" : "27.1.0.2", "dependencyOnly" : true }, { @@ -540,6 +541,7 @@ "artifactId" : "failureaccess", "version" : "1.0.1", "nugetId" : "Xamarin.Google.Guava.FailureAccess", + "nugetVersion" : "1.0.1.1", "dependencyOnly" : true }, { @@ -547,7 +549,7 @@ "artifactId" : "listenablefuture", "version" : "1.0", "nugetId" : "Xamarin.Google.Guava.ListenableFuture", - "nugetVersion" : "1.0", + "nugetVersion" : "1.0.0.1", "dependencyOnly" : true } ] diff --git a/source/AndroidXProject.cshtml b/source/AndroidXProject.cshtml index 9fcfa776..33f58855 100644 --- a/source/AndroidXProject.cshtml +++ b/source/AndroidXProject.cshtml @@ -151,7 +151,7 @@ @foreach (var dep in @Model.NuGetDependencies) { if (!dep.IsProjectReference) { - + } } diff --git a/source/androidx.slice/slice-view/transforms/Metadata.xml b/source/androidx.slice/slice-view/transforms/Metadata.xml index 49f512f0..c73003d9 100644 --- a/source/androidx.slice/slice-view/transforms/Metadata.xml +++ b/source/androidx.slice/slice-view/transforms/Metadata.xml @@ -2,5 +2,5 @@ androidx.recyclerview.widget.RecyclerView.ViewHolder androidx.recyclerview.widget.RecyclerView.ViewHolder Java.Lang.Object - public + \ No newline at end of file From dc3f7e05271fdc0bc5ef58550756329a886c6f48 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 28 Aug 2019 15:23:38 +0200 Subject: [PATCH 08/11] Use the correct build number --- azure-pipelines.yml | 2 +- build.cake | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index be066735..ebe5bd05 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,7 +4,7 @@ trigger: - refs/tags/* variables: - BUILD_NUMBER: $[counter('$(Build.SourceBranchName)_counter', 1)] + BUILD_NUMBER: $(Build.BuildNumber) # XAMARIN_ANDROID_PATH: # SUPPORT_MERGED_DLL_URL: diff --git a/build.cake b/build.cake index bc194561..c875d34f 100644 --- a/build.cake +++ b/build.cake @@ -3,7 +3,6 @@ // Cake Addins #addin nuget:?package=Cake.FileHelpers&version=3.2.0 -#addin nuget:?package=Cake.Compression&version=0.2.3 using System.Text.RegularExpressions; using System.Xml; From b73ec9fe4c1723ad3725b33042a11117fc549f0c Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Thu, 29 Aug 2019 13:45:19 +0200 Subject: [PATCH 09/11] Update azure-pipelines.yml --- azure-pipelines.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ebe5bd05..dbcfb65f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,7 +14,6 @@ resources: type: github name: xamarin/yaml-templates endpoint: xamarin - ref: refs/heads/dev/signing-job - repository: components type: github name: xamarin/XamarinComponents @@ -24,7 +23,6 @@ resources: jobs: - template: .ci/prepare.yml@components parameters: - buildType: 'basic' masterBranchName: 'AndroidX' - template: .ci/build.yml@components parameters: From 78211866fbace517507eb92203e200b5287837e8 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Fri, 30 Aug 2019 19:42:51 +0200 Subject: [PATCH 10/11] Update --- azure-pipelines.yml | 10 ++-------- build.cake | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ebe5bd05..f191c068 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,8 +5,8 @@ trigger: variables: BUILD_NUMBER: $(Build.BuildNumber) + BUILD_COMMIT: $(Build.SourceVersion) # XAMARIN_ANDROID_PATH: -# SUPPORT_MERGED_DLL_URL: resources: repositories: @@ -14,21 +14,15 @@ resources: type: github name: xamarin/yaml-templates endpoint: xamarin - ref: refs/heads/dev/signing-job - repository: components type: github name: xamarin/XamarinComponents endpoint: xamarin - ref: refs/heads/dev/templating jobs: - - template: .ci/prepare.yml@components - parameters: - buildType: 'basic' - masterBranchName: 'AndroidX' - template: .ci/build.yml@components parameters: - cakeTemplatesBranch: 'dev/templating' + masterBranchName: 'AndroidX' tools: - 'xamarin.androidbinderator.tool': '0.3.0' - 'xamarin.androidx.migration.tool': '1.0.0-preview03' diff --git a/build.cake b/build.cake index c875d34f..d79c63c8 100644 --- a/build.cake +++ b/build.cake @@ -42,7 +42,7 @@ if (!DirectoryExists($"{XAMARIN_ANDROID_PATH}/{ANDROID_SDK_VERSION}")) throw new Exception($"Unable to find Xamarin.Android {ANDROID_SDK_VERSION} at {XAMARIN_ANDROID_PATH}."); // Load all the git variables -var BUILD_COMMIT = EnvironmentVariable("BUILD_SOURCEVERSION") ?? "DEV"; +var BUILD_COMMIT = EnvironmentVariable("BUILD_COMMIT") ?? "DEV"; var BUILD_NUMBER = EnvironmentVariable("BUILD_NUMBER") ?? "DEBUG"; var BUILD_TIMESTAMP = DateTime.UtcNow.ToString(); From bcc9cfe08726c89ff35d8a27ce37e63c9d55c838 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 17 Sep 2019 15:26:37 +0200 Subject: [PATCH 11/11] Updates --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f191c068..1de02704 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,7 +24,7 @@ jobs: parameters: masterBranchName: 'AndroidX' tools: - - 'xamarin.androidbinderator.tool': '0.3.0' + - 'xamarin.androidbinderator.tool': '0.4.0' - 'xamarin.androidx.migration.tool': '1.0.0-preview03' - ${{ if eq(variables['System.TeamProject'], 'devdiv') }}: - template: sign-artifacts/jobs/v1.yml@internal-templates