diff --git a/build.cake b/build.cake index 069f7d458..bdcd90a4e 100644 --- a/build.cake +++ b/build.cake @@ -1,9 +1,16 @@ // Tools needed by cake addins -#tool nuget:?package=vswhere&version=2.7.1 +#tool nuget:?package=vswhere&version=2.8.4 // Cake Addins -#addin nuget:?package=Cake.FileHelpers&version=3.2.1 -#addin nuget:?package=Newtonsoft.Json&version=11.0.2 +#addin nuget:?package=Cake.FileHelpers&version=4.0.1 +#addin nuget:?package=Newtonsoft.Json&version=12.0.3 +//#addin nuget:?package=NuGet.Versioning&version=5.8.1 + +// Usage: +// dotnet tool install -g xamarin.androidx.migration.tool +// dotnet tool install -g xamarin.androidbinderator.tool +// dotnet tool install -g cake.tool +// dotnet cake -v using System; using System.Text.RegularExpressions; @@ -31,7 +38,7 @@ var REF_PARAMNAMES_URL = "https://bosstoragemirror.blob.core.windows.net/android var XAMARIN_ANDROID_PATH = EnvironmentVariable ("XAMARIN_ANDROID_PATH"); var ANDROID_SDK_BASE_VERSION = "v1.0"; var ANDROID_SDK_VERSION = "v9.0"; -string AndroidSdkBuildTools = $"29.0.2"; +string AndroidSdkBuildTools = "29.0.2"; if (string.IsNullOrEmpty(XAMARIN_ANDROID_PATH)) { if (IsRunningOnWindows()) { @@ -52,13 +59,8 @@ 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", - "xamarin.androidx.migration.tool" -}; - string nuget_version_template = - // "71.vvvv.0-preview3" // pre AndroidX version + //"71.vvvv.0-preview3" // pre AndroidX version "1xx.yy.zz.ww-suffix" // AndroidX version preview //"1xx.yy.zz" // AndroidX version stable/release ; @@ -132,7 +134,11 @@ Task("javadocs") if (!FileExists("./externals/paramnames.xml")) DownloadFile(REF_METADATA_URL, "./externals/paramnames.xml"); - var astJar = new FilePath("./util/JavaASTParameterNames-1.0.jar"); + var javaExe = string.IsNullOrEmpty(JAVA_HOME) + ? "java" + : MakeAbsolute(new DirectoryPath(JAVA_HOME).Combine("bin/java")).FullPath; + + var astJar = MakeAbsolute(new FilePath("./util/JavaASTParameterNames-1.0.jar")).FullPath; var sourcesJars = GetFiles("./externals/**/*-sources.jar"); foreach (var srcJar in sourcesJars) { @@ -140,8 +146,8 @@ Task("javadocs") var outTxtPath = srcJarPath.Replace("-sources.jar", "-paramnames.txt"); var outXmlPath = srcJarPath.Replace("-sources.jar", "-paramnames.xml"); - StartProcess("java", "-jar \"" + MakeAbsolute(astJar).FullPath + "\" --text \"" + srcJarPath + "\" \"" + outTxtPath + "\""); - StartProcess("java", "-jar \"" + MakeAbsolute(astJar).FullPath + "\" --xml \"" + srcJarPath + "\" \"" + outXmlPath + "\""); + StartProcess(javaExe, "-jar \"" + astJar + "\" --text \"" + srcJarPath + "\" \"" + outTxtPath + "\""); + StartProcess(javaExe, "-jar \"" + astJar + "\" --xml \"" + srcJarPath + "\" \"" + outXmlPath + "\""); } }); @@ -222,9 +228,9 @@ Task("binderate-prepare-dependencies-samples-packages-config") XmlNodeList list = xml.SelectNodes("/packages/package"); foreach (XmlNode xn in list) { - string id = xn.Attributes["id"].Value; //Get attribute-id + string id = xn.Attributes["id"].Value; //Get attribute-id //string text = xn["Text"].InnerText; //Get Text Node - string v = xn.Attributes["version"].Value; //Get attribute-id + string v = xn.Attributes["version"].Value; //Get attribute-id Information($" id : {id}"); Information($" version: {v}"); @@ -244,7 +250,7 @@ Task("binderate-prepare-dependencies-samples-packages-config") } } } - + return; } ); @@ -321,9 +327,8 @@ Task("binderate-config-verify") Warning($" expected : "); Warning($" nuget_version = {nuget_version_new}"); - throw new Exception("check config.json for nuget id"); - return; + throw new Exception("check config.json for nuget id"); } } } @@ -332,10 +337,10 @@ Task("binderate-config-verify") Task("binderate-diff") .IsDependentOn("binderate") - .Does - ( - () => - { + .Does + ( + () => + { EnsureDirectoryExists("./output/"); // "git diff master:config.json config.json" > ./output/config.json.diff-from-master.txt" @@ -344,9 +349,9 @@ Task("binderate-diff") IEnumerable redirectedStandardOutput; ProcessSettings process_settings = new ProcessSettings () { - Arguments = process_args, - RedirectStandardOutput = true - }; + Arguments = process_args, + RedirectStandardOutput = true + }; int exitCodeWithoutArguments = StartProcess(process, process_settings, out redirectedStandardOutput); System.IO.File.WriteAllLines("./output/config.json.diff-from-master.txt", redirectedStandardOutput.ToArray()); Information("Exit code: {0}", exitCodeWithoutArguments); @@ -364,7 +369,7 @@ Task("binderate-fix") binderator_json_array = (JArray)JToken.ReadFrom(jtr); } - Warning("config.json fixing missing folder strucutre ..."); + Warning("config.json fixing missing folder structure ..."); foreach(JObject jo in binderator_json_array[0]["artifacts"]) { string groupId = (string) jo["groupId"]; @@ -456,11 +461,11 @@ Task("binderate-fix") $"{dir_artifact}/Additions/Additions.cs" ); } - } + } - return; - } - ); + return; + } + ); Task("mergetargets") .Does(() => @@ -544,11 +549,11 @@ Task("samples-directory-build-targets") Information($"nugetId = {jo["nugetId"]}"); } - XmlDocument doc = new XmlDocument(); - XmlElement element_p = doc.CreateElement( string.Empty, "Project", string.Empty ); - doc.AppendChild( element_p ); - XmlElement element_ig = doc.CreateElement( string.Empty, "ItemGroup", string.Empty ); - element_p.AppendChild(element_ig); + XmlDocument doc = new XmlDocument(); + XmlElement element_p = doc.CreateElement( string.Empty, "Project", string.Empty ); + doc.AppendChild( element_p ); + XmlElement element_ig = doc.CreateElement( string.Empty, "ItemGroup", string.Empty ); + element_p.AppendChild(element_ig); foreach(JObject jo in binderator_json_array[0]["artifacts"]) { @@ -561,7 +566,7 @@ Task("samples-directory-build-targets") Information($"nugetId = {jo["nugetId"]}"); XmlElement element_pr = doc.CreateElement( string.Empty, "PackageReference", string.Empty ); - element_ig.AppendChild(element_pr); + element_ig.AppendChild(element_pr); XmlAttribute attr_update = doc.CreateAttribute("Update"); attr_update.Value = (string) jo["nugetId"]; element_pr.Attributes.Append(attr_update); @@ -597,16 +602,19 @@ Task("samples") .Concat(GetFiles("./samples/com.google.firebase/**/*.sln")) ; - foreach(string config in Configs) + foreach (string config in Configs) { foreach (var sampleSln in sampleSlns) { string filename_sln = sampleSln.GetFilenameWithoutExtension().ToString(); - if ( ! filename_sln.Contains("BuildAll") ) - { - NuGetRestore(sampleSln, new NuGetRestoreSettings { }); // R8 errors - } + // Restore solution using MSBuild (see MSBuild invocation below) due to NuGet CLI + // has to be downloaded manually from https://www.nuget.org/downloads on Windows + // or be installed as Cake addin using NuGet.Versioning package. + // if ( ! filename_sln.Contains("BuildAll") ) + // { + // NuGetRestore(sampleSln, new NuGetRestoreSettings { }); // R8 errors + // } if ( sampleSln.ToString().Contains("com.google.android.gms/play-services-cast/CastingCall.sln") @@ -631,12 +639,14 @@ Task("samples") c => { c.Configuration = config; + c.MaxCpuCount = MAX_CPU_COUNT; c.Properties.Add("DesignTimeBuild", new [] { "false" }); c.BinaryLogger = new MSBuildBinaryLogSettings { Enabled = true, FileName = bl }; + c.Restore = !filename_sln.Contains("BuildAll"); // R8 errors if (! string.IsNullOrEmpty(ANDROID_HOME)) { c.Properties.Add("AndroidSdkDirectory", new [] { $"{ANDROID_HOME}" } ); @@ -673,8 +683,8 @@ Task("allbindingprojectrefs") var itemGroup = new XElement(xmlns + "ItemGroup"); foreach (var nupkg in GetFiles(pattern)) { var filename = nupkg.GetFilenameWithoutExtension(); - var match = Regex.Match(filename.ToString(), @"(.+?)\.(\d+[\.0-9\-a-zA-Z]+)"); - itemGroup.Add(new XElement(xmlns + "PackageReference", + var match = Regex.Match(filename.ToString(), @"(.+?)\.(\d+[\.0-9\-a-zA-Z]+)"); + itemGroup.Add(new XElement(xmlns + "PackageReference", new XAttribute("Include", match.Groups[1]), new XAttribute("Version", match.Groups[2]))); } @@ -706,7 +716,7 @@ Task("nuget") c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" }); c.Properties.Add("DesignTimeBuild", new [] { "false" }); c.Properties.Add("AndroidSdkBuildToolsVersion", new [] { $"{AndroidSdkBuildTools}" }); - + c.Restore = false; if (! string.IsNullOrEmpty(ANDROID_HOME)) { c.Properties.Add("AndroidSdkDirectory", new[] { $"{ANDROID_HOME}" }); @@ -747,14 +757,14 @@ Task ("ci-setup") ReplaceTextInFiles(glob, "{BUILD_TIMESTAMP}", BUILD_TIMESTAMP); }); -Task("nuget-dependecies") - .Does - ( - () => - { - string icanhasdotnet = "https://icanhasdot.net/Downloads/ICanHasDotnetCore.zip"; - } - ); +// Task("nuget-dependecies") +// .Does +// ( +// () => +// { +// string icanhasdotnet = "https://icanhasdot.net/Downloads/ICanHasDotnetCore.zip"; +// } +// ); // Task ("genapi") // .IsDependentOn ("libs") @@ -834,4 +844,4 @@ Task ("ci") //.IsDependentOn ("merge") .IsDependentOn ("samples"); -RunTarget (TARGET); \ No newline at end of file +RunTarget (TARGET); diff --git a/build/scripts/update-config.csx b/build/scripts/update-config.csx index 57d40fa5a..b3423829b 100644 --- a/build/scripts/update-config.csx +++ b/build/scripts/update-config.csx @@ -2,16 +2,17 @@ #r "nuget: MavenNet, 2.2.0" #r "nuget: Newtonsoft.Json, 12.0.3" -#r "nuget: NuGet.Versioning, 5.8.0" +#r "nuget: NuGet.Versioning, 5.8.1" // Usage: // dotnet tool install -g dotnet-script // dotnet script update-config.csx -- ../../config.json // This script compares the versions of Java packages we are currently binding to the -// stable versions available in Google's Maven repository. The specified configuration -// file can be automatically updated by including the "update" argument. A revision bump +// stable versions available in Google's Maven repository. The specified configuration +// file can be automatically updated by including the "update" argument. A revision bump // can be applied to all packages with the "bump" argument, which is mutually exclusive // with "update". + using MavenNet; using MavenNet.Models; using Newtonsoft.Json; @@ -34,8 +35,8 @@ var should_minor_bump = Args.Count > 1 && Args[1].ToLowerInvariant () == "bump"; var repo = MavenRepository.FromGoogle (); await repo.Refresh (); -Console.WriteLine ("| Package (* = Needs Update) | Currently Bound | Latest Stable |"); -Console.WriteLine ("|--------------------------------------------------------------|-----------------|-----------------|"); +Console.WriteLine ("| Package (* = Needs Update) | Currently Bound | Latest Stable |"); +Console.WriteLine ("|------------------------------------------------------------------------|-----------------|-----------------|"); // Find the Maven artifact for each package in our configuration file foreach (var art in config[0].Artifacts.Where(a => !a.DependencyOnly)) { @@ -91,7 +92,7 @@ foreach (var art in config[0].Artifacts.Where(a => !a.DependencyOnly)) { art.NugetVersion = $"{version}.{revision}{release}"; } - Console.WriteLine ($"| {package_name.PadRight (60)} | {current_version.PadRight (15)} | {(GetLatestVersion (a)?.ToString () ?? string.Empty).PadRight (15)} |"); + Console.WriteLine ($"| {package_name.PadRight (70)} | {current_version.PadRight (15)} | {(GetLatestVersion (a)?.ToString () ?? string.Empty).PadRight (15)} |"); if (should_update || should_minor_bump) { diff --git a/global.json b/global.json index 0d0701b41..469692f68 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ { - "msbuild-sdks": + "msbuild-sdks": { "MSBuild.Sdk.Extras": "3.0.23", - "Microsoft.Build.Traversal": "2.1.1", - "Microsoft.Build.NoTargets": "2.0.1" + "Microsoft.Build.Traversal": "3.0.23", + "Microsoft.Build.NoTargets": "3.0.4" } } \ No newline at end of file diff --git a/source/GooglePlayServices-Firebase.Solution.proj b/source/GooglePlayServices-Firebase.Solution.proj index 32ffefe15..6c3882b43 100644 --- a/source/GooglePlayServices-Firebase.Solution.proj +++ b/source/GooglePlayServices-Firebase.Solution.proj @@ -1,7 +1,7 @@ - + - + diff --git a/source/GooglePlayServicesProject.cshtml b/source/GooglePlayServicesProject.cshtml index 5a47da836..c0752b0ff 100644 --- a/source/GooglePlayServicesProject.cshtml +++ b/source/GooglePlayServicesProject.cshtml @@ -76,50 +76,65 @@ - - - 0618;0109;0114;0628;0108;0809 - - - - BG8A04;BG8A00 + + + + + CS0108;CS0109;CS0114;CS0618;CS0628;CS0809; + + + + + BG8A00;BG8A01;BG8A04; + + - - + + + + + BG8401;BG8604;BG8700;BG8800;BG8C00; + + @@ -241,15 +256,15 @@ } @if (@Model.NuGetPackageId == "Xamarin.GooglePlayServices.SafetyNet") { - + } @if (@Model.NuGetPackageId == "Xamarin.Firebase.Firestore") { - + } @if (@Model.NuGetPackageId == "Xamarin.Firebase.Crashlytics") { - + } @@ -1152,6 +1167,16 @@ IconUrl = "https://raw.githubusercontent.com/xamarin/GooglePlayServicesComponents/master/icons/firebase-perf_128x128.png", } }, + { + "Xamarin.Firebase.ProtoliteWellKnownTypes", + new NugetPackageCustomMetaData() + { + Description = @"", + ProjectUrl = "https://go.microsoft.com/fwlink/?linkid=865435", + LicenseUrl = "https://go.microsoft.com/fwlink/?linkid=865373", + IconUrl = "https://raw.githubusercontent.com/xamarin/GooglePlayServicesComponents/master/icons/play-services-protolitewellknowntypes_128x128.png", + } + }, { "Xamarin.Firebase.Storage", new NugetPackageCustomMetaData() @@ -1172,15 +1197,5 @@ IconUrl = "https://raw.githubusercontent.com/xamarin/GooglePlayServicesComponents/master/icons/firebase-storage-common_128x128.png", } }, - { - "Xamarin.Firebase.ProtoliteWellKnownTypes", - new NugetPackageCustomMetaData() - { - Description = @"", - ProjectUrl = "https://go.microsoft.com/fwlink/?linkid=865435", - LicenseUrl = "https://go.microsoft.com/fwlink/?linkid=865373", - IconUrl = "https://raw.githubusercontent.com/xamarin/GooglePlayServicesComponents/master/icons/play-services-protolitewellknowntypes_128x128.png", - } - }, }; } diff --git a/source/GooglePlayServicesTargets.cshtml b/source/GooglePlayServicesTargets.cshtml index 327063bbc..ea85a21b5 100644 --- a/source/GooglePlayServicesTargets.cshtml +++ b/source/GooglePlayServicesTargets.cshtml @@ -22,7 +22,7 @@ manifestmerger.jar - + @if (@Model.MavenArtifacts.Count > 0) { @foreach (var art in @Model.MavenArtifacts) { @@ -36,9 +36,6 @@ } - - manifestmerger.jar - AndroidX.Fragment.App.Fragment @@ -68,7 +65,6 @@ - @*