Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 17 additions & 87 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,102 +1,32 @@

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: <string>
# XAMARIN_ANDROID_PATH: <path to Xamarin.Android>
BUILD_NUMBER: $(Build.BuildNumber)
BUILD_COMMIT: $(Build.SourceVersion)
# XAMARIN_ANDROID_PATH: <path to Xamarin.Android>

resources:
repositories:
- repository: xamarin-templates
- repository: internal-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
- repository: components
type: github
name: xamarin/XamarinComponents
endpoint: xamarin

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/build.yml@components
parameters:
masterBranchName: 'AndroidX'
tools:
- 'xamarin.androidbinderator.tool': '0.4.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' ]
74 changes: 8 additions & 66 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,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
Expand All @@ -30,6 +24,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)) {
Expand All @@ -47,13 +42,12 @@ 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();

var REQUIRED_DOTNET_TOOLS = new [] {
"xamarin-android-binderator",
"api-tools",
"xamarin.androidx.migration.tool"
};

Expand Down Expand Up @@ -141,17 +135,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);
});

Expand All @@ -160,20 +150,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);
});

Expand Down Expand Up @@ -206,7 +192,7 @@ Task("samples")

// build the samples
var settings = new MSBuildSettings()
.SetConfiguration(BUILD_CONFIG)
.SetConfiguration(CONFIGURATION)
.SetVerbosity(VERBOSITY)
.SetMaxCpuCount(0)
.WithRestore()
Expand All @@ -215,49 +201,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 (() =>
Expand All @@ -281,7 +227,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())
Expand Down Expand Up @@ -333,19 +279,15 @@ Task ("full-run")
Task ("Default")
.IsDependentOn ("binderate")
.IsDependentOn ("nuget")
.IsDependentOn ("nuget-validation")
.IsDependentOn ("generate-mapping")
.IsDependentOn ("diff")
.IsDependentOn ("samples");

Task ("ci")
.IsDependentOn ("check-tools")
.IsDependentOn ("inject-variables")
.IsDependentOn ("binderate")
.IsDependentOn ("nuget")
.IsDependentOn ("nuget-validation")
.IsDependentOn ("generate-mapping")
.IsDependentOn ("diff")
.IsDependentOn ("samples");

RunTarget (TARGET);
4 changes: 3 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -533,21 +533,23 @@
"artifactId" : "guava",
"version" : "27.1.0",
"nugetId" : "Xamarin.Google.Guava",
"nugetVersion" : "27.1.0.2",
"dependencyOnly" : true
},
{
"groupId" : "com.google.guava",
"artifactId" : "failureaccess",
"version" : "1.0.1",
"nugetId" : "Xamarin.Google.Guava.FailureAccess",
"nugetVersion" : "1.0.1.1",
"dependencyOnly" : true
},
{
"groupId" : "com.google.guava",
"artifactId" : "listenablefuture",
"version" : "1.0",
"nugetId" : "Xamarin.Google.Guava.ListenableFuture",
"nugetVersion" : "1.0",
"nugetVersion" : "1.0.0.1",
"dependencyOnly" : true
}
]
Expand Down
2 changes: 1 addition & 1 deletion source/AndroidXProject.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<!-- PackageReference -->
@foreach (var dep in @Model.NuGetDependencies) {
if (!dep.IsProjectReference) {
<PackageReference Include="@(dep.NuGetPackageId)" Version="@(dep.NuGetVersion)" />
<PackageReference Include="@(dep.NuGetPackageId)" Version="@(dep.NuGetVersion)" PrivateAssets="none" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to make sure that the .nupkg will correctly import the dependencies - such as Guava.

}
}
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/androidx.slice/slice-view/transforms/Metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<attr path="/api/package[@name='androidx.slice.widget']/class[@name='LargeSliceAdapter']/method[@name='onCreateViewHolder' and count(parameter)=2 and parameter[1][@type='android.view.ViewGroup'] and parameter[2][@type='int']]" name="return">androidx.recyclerview.widget.RecyclerView.ViewHolder</attr>
<attr path="/api/package[@name='androidx.slice.widget']/class[@name='LargeSliceAdapter']/method[@name='onBindViewHolder' and count(parameter)=2 and parameter[1][@type='androidx.slice.widget.LargeSliceAdapter.SliceViewHolder'] and parameter[2][@type='int']]/parameter[1]" name="type">androidx.recyclerview.widget.RecyclerView.ViewHolder</attr>
<attr path="/api/package[@name='androidx.slice.widget']/class[@name='SliceView']/method[@name='onChanged' and count(parameter)=1 and parameter[1][@type='androidx.slice.Slice']]/parameter[1]" name="managedType">Java.Lang.Object</attr>
<attr path="/api/package[@name='androidx.slice.widget']/interface[@name='SliceActionView.SliceActionLoadingListener']" name="visibility">public</attr>
<remove-node path="/api/package[@name='androidx.slice.widget']/interface[@name='SliceActionView.SliceActionLoadingListener']" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to double check this change?

</metadata>