From bc0361d9d75b90b5aab644154bb1a4a94edb11e4 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Mon, 18 Mar 2019 13:52:24 -0400 Subject: [PATCH 01/12] [build] Add support for commercial builds Introduces an '.external' file at the root of the repository that can be used to track external git dependencies without requiring that they be added as a submodule. Entries in this file which start with a '#' will be ignored. Entries which do not match the specific format will also be ignored. Valid formats are as follows: $(RepoOwner)/$(RepoName):$(BranchName)@$(CommitHash) This file currently only contains one reference to commercial source, which is used by the new 'prepare-external-git-dependencies' and 'commercial' make rules. In the future however we may want to extend this file to reference other dependencies tied to a git repo/branch/hash (such as a mono bundle). A 'ParseExternalGitDependencies' task has been added to parse each line of this file into individual items that can be used by other tasks and targets. A 'CheckoutExternalGitDependency' task has been added to clone or update a local checkout of a source dependency. The Output items from the 'ParseExternalGitDependencies' task should be used as an input to this task. The 'external-git-dependencies.targets' file has been added to expose these common '.external' file processing tasks in MSBuild targets. A reference to this file has been added to 'xa-prep-tasks.csproj' to allow us to easily checkout, download or otherwise process the external git dependencies specified in the '.external' file. Currently only source dependencenies named 'monodroid' are supported by these targets. The 'prepare-external-git-dependencies' make rule is used to ensure our '.external' dependencies are initialized. The new 'commercial' make rule has been added to manage the build of commercial components. Finally, OpenTK.dll and it's related files have been removed from the installers, as they are no longer going to be built as part of this new "minimal" commercial build. --- .external | 1 + .gitignore | 1 + Makefile | 11 +++ .../installers/create-installers.targets | 3 - .../CheckoutExternalGitDependency.cs | 79 +++++++++++++++++++ .../ParseExternalGitDependencies.cs | 56 +++++++++++++ .../external-git-dependencies.targets | 23 ++++++ .../xa-prep-tasks/xa-prep-tasks.csproj | 7 +- 8 files changed, 176 insertions(+), 5 deletions(-) create mode 100644 .external create mode 100644 build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs create mode 100644 build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs create mode 100644 build-tools/xa-prep-tasks/external-git-dependencies.targets diff --git a/.external b/.external new file mode 100644 index 00000000000..a5c96d83d43 --- /dev/null +++ b/.external @@ -0,0 +1 @@ +pjcollins/monodroid:min-build-poc@d2c9d0051152d5ee8955e7152932a21f35761bc3 diff --git a/.gitignore b/.gitignore index 2dfd2713367..28f27ccfba5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ apk-sizes-*.txt *.binlog src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props *~ +monodroid/ diff --git a/Makefile b/Makefile index e440de2f5c5..914a4ef44f0 100644 --- a/Makefile +++ b/Makefile @@ -202,6 +202,17 @@ THIRD_PARTY_NOTICE_LICENSE_TYPE = microsoft-oss $(eval $(call CREATE_THIRD_PARTY_NOTICES_RULE,ThirdPartyNotices.txt,foundation,False,False)) $(eval $(call CREATE_THIRD_PARTY_NOTICES_RULE,bin/$(CONFIGURATION)/lib/xamarin.android/ThirdPartyNotices.txt,$(THIRD_PARTY_NOTICE_LICENSE_TYPE),True,False)) +EXTERNAL_GIT_PATH=$(topdir)/external +XA_PATH=$(topdir) +prepare-external-git-dependencies: + $(call MSBUILD_BINLOG,prep-tasks) build-tools/xa-prep-tasks/xa-prep-tasks.csproj + $(call MSBUILD_BINLOG,external-checkout) build-tools/xa-prep-tasks/xa-prep-tasks.csproj \ + /t:CheckoutExternalGitSources /p:ExternalSourceDependencyDirectory='$(EXTERNAL_GIT_PATH)' + cd $(MONODROID_PATH) && ./configure --with-xamarin-android='$(XA_PATH)' + +commercial: + make -C $(MONODROID_PATH) commercial-minimal XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) + run-all-tests: @echo "PRINTING MONO VERSION" mono --version diff --git a/build-tools/installers/create-installers.targets b/build-tools/installers/create-installers.targets index fc2d13a2dbc..e5810269e66 100644 --- a/build-tools/installers/create-installers.targets +++ b/build-tools/installers/create-installers.targets @@ -236,9 +236,6 @@ - <_FrameworkFiles Include="$(FrameworkSrcDir)\$(FirstInstallerFrameworkVersion)\OpenTK.dll" /> - <_FrameworkFiles Include="$(FrameworkSrcDir)\$(FirstInstallerFrameworkVersion)\OpenTK.pdb" /> - <_FrameworkFilesWin Include="$(FrameworkSrcDir)\$(FirstInstallerFrameworkVersion)\OpenTK.xml" /> <_FrameworkFilesWin Include="$(FrameworkSrcDir)\$(FirstInstallerFrameworkVersion)\Mono.Android.xml" /> <_FrameworkFilesWin Include="$(FrameworkSrcDir)\v4.4.87\Mono.Android.xml" /> <_FrameworkFilesWin Include="$(FrameworkSrcDir)\v5.0\Mono.Android.xml" /> diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs new file mode 100644 index 00000000000..37fd13985e0 --- /dev/null +++ b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs @@ -0,0 +1,79 @@ +using System; +using System.IO; +using Microsoft.Build.Framework; + +namespace Xamarin.Android.BuildTools.PrepTasks +{ + public class CheckoutExternalGitDependency : Git + { + [Required] + public ITaskItem ExternalGitDependency { get; set; } + + public bool ShouldCleanDependency { get; set; } = true; + + protected override bool LogTaskMessages { + get { return false; } + } + + string commit; + string owner; + string name; + + public override bool Execute () + { + commit = ExternalGitDependency.ItemSpec; + owner = ExternalGitDependency.GetMetadata ("Owner"); + name = ExternalGitDependency.GetMetadata ("Name"); + string destination = Path.Combine (GetWorkingDirectory (), name); + + if (!Directory.Exists (destination)) { + Clone (); + } + + WorkingDirectory.ItemSpec = destination; + if (ShouldCleanDependency) { + Clean (); + } + Fetch (); + CheckoutCommit (); + + return !Log.HasLoggedErrors; + } + + void Clone () + { + string ghToken = Environment.GetEnvironmentVariable("GH_AUTH_SECRET"); + if (!string.IsNullOrEmpty (ghToken)) { + Arguments = $"clone https://{ghToken}@github.com/{owner}/{name} --progress"; + } else { + // Fallback to SSH URI + Arguments = $"clone git@github.com:{owner}/{name} --progress"; + } + + base.Execute (); + } + + void Fetch () + { + Arguments = $"fetch --all --no-recurse-submodules --progress"; + base.Execute (); + } + + void Clean () + { + Arguments = $"clean -xfd"; + base.Execute (); + } + + void CheckoutCommit () + { + Arguments = $"checkout {commit} --force --progress"; + base.Execute (); + } + + protected override void LogToolCommand(string message) + { + // Do nothing + } + } +} diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs new file mode 100644 index 00000000000..1c1b9dc0392 --- /dev/null +++ b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs @@ -0,0 +1,56 @@ + +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace Xamarin.Android.BuildTools.PrepTasks +{ + public class ParseExternalGitDependencies : Task + { + [Required] + public string ExternalFilePath { get; set; } + + /* %(ExternalGitDependencies.Owner) - Repo owner + * %(ExternalGitDependencies.Name) - Repo name + * %(ExternalGitDependencies.Branch) - Branch name + * %(ExternalGitDependencies.Identity) - Commit hash + */ + [Output] + public ITaskItem[] ExternalGitDependencies { get; set; } + + static readonly Regex externalRegex = new Regex ( + @"^(?\#\s*)?(?.*)\/(?.*):(?.*)@(?.*)$", + RegexOptions.Compiled); + + public override bool Execute () + { + if (!File.Exists (ExternalFilePath)) { + Log.LogError($"Unable to find dependency file at: {ExternalFilePath}"); + return false; + } + + string[] unparsedExternals = File.ReadAllLines (ExternalFilePath); + var externals = new List (unparsedExternals.Length); + + foreach (string external in unparsedExternals) { + Match match = externalRegex.Match (external); + if (match != null && match.Success) { + if (match.Groups["comment"].Success) { + // Ignore matching lines which start with '#'. + continue; + } + var e = new TaskItem (match.Groups["commit"].Value); + e.SetMetadata ("Owner", match.Groups["owner"].Value); + e.SetMetadata ("Name", match.Groups["repo"].Value); + e.SetMetadata ("Branch", match.Groups["branch"].Value); + externals.Add (e); + } + } + + ExternalGitDependencies = externals.ToArray (); + return !Log.HasLoggedErrors; + } + } +} diff --git a/build-tools/xa-prep-tasks/external-git-dependencies.targets b/build-tools/xa-prep-tasks/external-git-dependencies.targets new file mode 100644 index 00000000000..df038939678 --- /dev/null +++ b/build-tools/xa-prep-tasks/external-git-dependencies.targets @@ -0,0 +1,23 @@ + + + + + + + $(XamarinAndroidSourcePath)\external + + + + + + + + + + diff --git a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj index a80a2f1adab..413ba7b0b3f 100644 --- a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj +++ b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj @@ -1,4 +1,4 @@ - + Debug @@ -45,6 +45,7 @@ + @@ -61,6 +62,7 @@ + @@ -70,4 +72,5 @@ - + + \ No newline at end of file From c237846236fd5cea070a06fb5b07a2e46ea49057 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 21 Mar 2019 14:21:39 -0400 Subject: [PATCH 02/12] Address feedback --- .gitignore | 2 +- Makefile | 6 ++++-- .../CheckoutExternalGitDependency.cs | 11 ---------- .../ParseExternalGitDependencies.cs | 20 ++++++++++++++++--- .../xa-prep-tasks/xa-prep-tasks.csproj | 2 +- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 28f27ccfba5..e6b730ef72c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,4 @@ apk-sizes-*.txt *.binlog src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props *~ -monodroid/ +external/monodroid/ diff --git a/Makefile b/Makefile index 914a4ef44f0..69315b2d066 100644 --- a/Makefile +++ b/Makefile @@ -208,10 +208,12 @@ prepare-external-git-dependencies: $(call MSBUILD_BINLOG,prep-tasks) build-tools/xa-prep-tasks/xa-prep-tasks.csproj $(call MSBUILD_BINLOG,external-checkout) build-tools/xa-prep-tasks/xa-prep-tasks.csproj \ /t:CheckoutExternalGitSources /p:ExternalSourceDependencyDirectory='$(EXTERNAL_GIT_PATH)' - cd $(MONODROID_PATH) && ./configure --with-xamarin-android='$(XA_PATH)' + +prepare-commercial: prepare-external-git-dependencies + cd $(EXTERNAL_GIT_PATH)/monodroid && ./configure --with-xamarin-android='$(XA_PATH)' commercial: - make -C $(MONODROID_PATH) commercial-minimal XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) + make -C $(EXTERNAL_GIT_PATH)/monodroid commercial-minimal XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) run-all-tests: @echo "PRINTING MONO VERSION" diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs index 37fd13985e0..76246c0eefc 100644 --- a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs +++ b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs @@ -9,8 +9,6 @@ public class CheckoutExternalGitDependency : Git [Required] public ITaskItem ExternalGitDependency { get; set; } - public bool ShouldCleanDependency { get; set; } = true; - protected override bool LogTaskMessages { get { return false; } } @@ -31,9 +29,6 @@ public override bool Execute () } WorkingDirectory.ItemSpec = destination; - if (ShouldCleanDependency) { - Clean (); - } Fetch (); CheckoutCommit (); @@ -59,12 +54,6 @@ void Fetch () base.Execute (); } - void Clean () - { - Arguments = $"clean -xfd"; - base.Execute (); - } - void CheckoutCommit () { Arguments = $"checkout {commit} --force --progress"; diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs index 1c1b9dc0392..71a89b40252 100644 --- a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs +++ b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs @@ -20,9 +20,23 @@ public class ParseExternalGitDependencies : Task [Output] public ITaskItem[] ExternalGitDependencies { get; set; } - static readonly Regex externalRegex = new Regex ( - @"^(?\#\s*)?(?.*)\/(?.*):(?.*)@(?.*)$", - RegexOptions.Compiled); + static readonly Regex externalRegex = new Regex (@" +^ +\s* +(?\#.*) +| +( + \s* + (?[^/]+) + / + (?[^:]+) + : + (?[^@]+) + @ + (?.*) +) +$ +", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace); public override bool Execute () { diff --git a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj index 413ba7b0b3f..fbf9cb37fdf 100644 --- a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj +++ b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj @@ -73,4 +73,4 @@ - \ No newline at end of file + From 7d4ab2928a0cac18426e674076e0642313d0205d Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 21 Mar 2019 16:29:15 -0400 Subject: [PATCH 03/12] [build] Create commercial installers Introduces a way to override a portion of our installer names, while still using version information from xamarin-android. --- .external | 2 +- Makefile | 5 ++++- build-tools/create-pkg/create-pkg.csproj | 3 +-- build-tools/create-pkg/create-pkg.targets | 2 ++ build-tools/create-vsix/create-vsix.targets | 1 + build-tools/installers/create-installers.targets | 1 + build-tools/scripts/Packaging.mk | 2 ++ 7 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.external b/.external index a5c96d83d43..ea1aee0cdab 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -pjcollins/monodroid:min-build-poc@d2c9d0051152d5ee8955e7152932a21f35761bc3 +pjcollins/monodroid:min-build-poc@de5cbb89f6a7736e483147d73446f82e1ffdbd1e diff --git a/Makefile b/Makefile index 69315b2d066..feed670e429 100644 --- a/Makefile +++ b/Makefile @@ -213,7 +213,10 @@ prepare-commercial: prepare-external-git-dependencies cd $(EXTERNAL_GIT_PATH)/monodroid && ./configure --with-xamarin-android='$(XA_PATH)' commercial: - make -C $(EXTERNAL_GIT_PATH)/monodroid commercial-minimal XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) + make -C $(EXTERNAL_GIT_PATH)/monodroid commercial-xa XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) + +commercial-installers: + make -C $(EXTERNAL_GIT_PATH)/monodroid commercial-xa-installers XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) run-all-tests: @echo "PRINTING MONO VERSION" diff --git a/build-tools/create-pkg/create-pkg.csproj b/build-tools/create-pkg/create-pkg.csproj index a1bfb659dd2..9cf036cb250 100644 --- a/build-tools/create-pkg/create-pkg.csproj +++ b/build-tools/create-pkg/create-pkg.csproj @@ -9,7 +9,7 @@ create-pkg ..\..\bin\Build$(Configuration) - + true full @@ -29,5 +29,4 @@ - \ No newline at end of file diff --git a/build-tools/create-pkg/create-pkg.targets b/build-tools/create-pkg/create-pkg.targets index 44ec2b4320a..049bce0ff6d 100644 --- a/build-tools/create-pkg/create-pkg.targets +++ b/build-tools/create-pkg/create-pkg.targets @@ -115,6 +115,7 @@ DependsOnTargets="_FinalizePayload"> + $(OutputPath)xamarin.android-$(XAVersion).pkg $(OutputPath)Xamarin.Android.Sdk-$(XAOSSInstallerSuffix).pkg @@ -133,5 +134,6 @@ + diff --git a/build-tools/create-vsix/create-vsix.targets b/build-tools/create-vsix/create-vsix.targets index f056d7e7cb7..d7353b4991a 100644 --- a/build-tools/create-vsix/create-vsix.targets +++ b/build-tools/create-vsix/create-vsix.targets @@ -86,6 +86,7 @@ + ..\..\bin\Build$(Configuration)\$(AssemblyName)-$(XAVersion).vsix ..\..\bin\Build$(Configuration)\$(AssemblyName)-$(XAOSSInstallerSuffix).vsix <_VsixDir>$([System.IO.Path]::GetDirectoryName ($(VsixPath))) diff --git a/build-tools/installers/create-installers.targets b/build-tools/installers/create-installers.targets index e5810269e66..78b78edec3b 100644 --- a/build-tools/installers/create-installers.targets +++ b/build-tools/installers/create-installers.targets @@ -16,6 +16,7 @@ so dll True + False <_FrameworkFiles Include="$(FrameworkSrcDir)\$(FirstInstallerFrameworkVersion)\AndroidApiInfo.xml" /> diff --git a/build-tools/scripts/Packaging.mk b/build-tools/scripts/Packaging.mk index 7bd95f2692f..e738215941e 100644 --- a/build-tools/scripts/Packaging.mk +++ b/build-tools/scripts/Packaging.mk @@ -15,6 +15,7 @@ create-pkg: $(if $(PACKAGE_VERSION_REV),/p:XAVersionCommitCount="$(PACKAGE_VERSION_REV)") \ $(if $(PKG_LICENSE_EN),/p:PkgLicenseSrcEn="$(PKG_LICENSE_EN)") \ $(if $(PKG_OUTPUT_PATH),/p:PkgProductOutputPath="$(PKG_OUTPUT_PATH)") \ + $(if $(USE_COMMERCIAL_NAME),/p:UseCommercialInstallerName="$(USE_COMMERCIAL_NAME)") \ $(if $(_MSBUILD_ARGS),"$(_MSBUILD_ARGS)") create-vsix: @@ -28,6 +29,7 @@ create-vsix: $(if $(PACKAGE_HEAD_BRANCH),/p:XAVersionBranch="$(PACKAGE_HEAD_BRANCH)") \ $(if $(PACKAGE_VERSION_REV),/p:XAVersionCommitCount="$(PACKAGE_VERSION_REV)") \ $(if $(COMMIT),/p:XAVersionHash="$(COMMIT)") \ + $(if $(USE_COMMERCIAL_NAME),/p:UseCommercialInstallerName="$(USE_COMMERCIAL_NAME)") \ $(if $(_MSBUILD_ARGS),"$(_MSBUILD_ARGS)") package-oss-name: From e911c3384a7e04cec583014360dc22a49ce14193 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Thu, 21 Mar 2019 17:11:25 -0400 Subject: [PATCH 04/12] [build] Remove external refs from xa-prep-tasks We'd like to have an msbuild task project that can be used for preparing our build environment and providing other general functionality without taking any external dependencies. In order to accomplish this, the `JdkInfo` task has been moved into Xamarin.Android.Tools.BootstrapTasks, which is likely a more fitting home for this task. --- .../Xamarin.Android.Tools.BootstrapTasks.csproj | 5 +++++ .../Xamarin.Android.Tools.BootstrapTasks}/JdkInfo.cs | 5 ++--- build-tools/scripts/PrepareWindows.targets | 3 ++- build-tools/xa-prep-tasks/xa-prep-tasks.csproj | 7 ------- 4 files changed, 9 insertions(+), 11 deletions(-) rename build-tools/{xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks => Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks}/JdkInfo.cs (97%) diff --git a/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj index 95bbc244890..d8ef8041013 100644 --- a/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj +++ b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj @@ -55,12 +55,17 @@ + {7CE69551-BD73-4726-ACAA-AAF89C84BAF8} xa-prep-tasks + + {E34BCFA0-CAA4-412C-AA1C-75DB8D67D157} + Xamarin.Android.Tools.AndroidSdk + diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/JdkInfo.cs b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/JdkInfo.cs similarity index 97% rename from build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/JdkInfo.cs rename to build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/JdkInfo.cs index 775c11bf5ff..2095f5b21c4 100644 --- a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/JdkInfo.cs +++ b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/JdkInfo.cs @@ -7,9 +7,8 @@ using System.IO; using System.Linq; using System.Text; -using Xamarin.Android.Tools; -namespace Xamarin.Android.BuildTools.PrepTasks +namespace Xamarin.Android.Tools.BootstrapTasks { public class JdkInfo : Task { @@ -40,7 +39,7 @@ public override bool Execute () } else { maxVersion = new Version (MaxJdkVersion); } - + var defaultJdk = new [] { new Tools.JdkInfo (androidSdk.JavaSdkPath) }; var jdk = defaultJdk.Concat (Tools.JdkInfo.GetKnownSystemJdkInfos (logger)) .Where (j => maxVersion != null ? j.Version <= maxVersion : true) diff --git a/build-tools/scripts/PrepareWindows.targets b/build-tools/scripts/PrepareWindows.targets index 5e08ca0c512..92385323e5e 100644 --- a/build-tools/scripts/PrepareWindows.targets +++ b/build-tools/scripts/PrepareWindows.targets @@ -6,7 +6,7 @@ <_NuGet>.nuget\NuGet.exe - + + diff --git a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj index fbf9cb37fdf..74fc1a92966 100644 --- a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj +++ b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj @@ -44,7 +44,6 @@ - @@ -64,12 +63,6 @@ - - - {E34BCFA0-CAA4-412C-AA1C-75DB8D67D157} - Xamarin.Android.Tools.AndroidSdk - - From 22c6222bc0ac1f78e98e162c64397c6809baf137 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Fri, 22 Mar 2019 11:54:34 -0400 Subject: [PATCH 05/12] [build] Conditionally import commercial make rules Conditionally imports extensions to 'make prepare' and 'make jenkins' to enable a commercial build when external monodroid sources are present. --- .external | 2 +- Makefile | 17 ++++++----------- build-tools/scripts/BuildEverything.mk | 2 +- build-tools/scripts/Packaging.mk | 4 ++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.external b/.external index ea1aee0cdab..07778035b3c 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -pjcollins/monodroid:min-build-poc@de5cbb89f6a7736e483147d73446f82e1ffdbd1e +pjcollins/monodroid:min-build-poc@648f22ee0fc4c22ec15fca35461b494ab3585d15 diff --git a/Makefile b/Makefile index feed670e429..4e6b0276ffe 100644 --- a/Makefile +++ b/Makefile @@ -202,21 +202,16 @@ THIRD_PARTY_NOTICE_LICENSE_TYPE = microsoft-oss $(eval $(call CREATE_THIRD_PARTY_NOTICES_RULE,ThirdPartyNotices.txt,foundation,False,False)) $(eval $(call CREATE_THIRD_PARTY_NOTICES_RULE,bin/$(CONFIGURATION)/lib/xamarin.android/ThirdPartyNotices.txt,$(THIRD_PARTY_NOTICE_LICENSE_TYPE),True,False)) +# Used by External XA Build +EXTERNAL_XA_PATH=$(topdir) EXTERNAL_GIT_PATH=$(topdir)/external -XA_PATH=$(topdir) + prepare-external-git-dependencies: - $(call MSBUILD_BINLOG,prep-tasks) build-tools/xa-prep-tasks/xa-prep-tasks.csproj - $(call MSBUILD_BINLOG,external-checkout) build-tools/xa-prep-tasks/xa-prep-tasks.csproj \ + $(call MSBUILD_BINLOG,prep-external-tasks) build-tools/xa-prep-tasks/xa-prep-tasks.csproj + $(call MSBUILD_BINLOG,prep-external-checkout) build-tools/xa-prep-tasks/xa-prep-tasks.csproj \ /t:CheckoutExternalGitSources /p:ExternalSourceDependencyDirectory='$(EXTERNAL_GIT_PATH)' -prepare-commercial: prepare-external-git-dependencies - cd $(EXTERNAL_GIT_PATH)/monodroid && ./configure --with-xamarin-android='$(XA_PATH)' - -commercial: - make -C $(EXTERNAL_GIT_PATH)/monodroid commercial-xa XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) - -commercial-installers: - make -C $(EXTERNAL_GIT_PATH)/monodroid commercial-xa-installers XA_TOP_SOURCE_DIRECTORY='$(XA_PATH)' CONFIGURATION=$(CONFIGURATION) +-include $(EXTERNAL_GIT_PATH)/monodroid/xa-integration.mk run-all-tests: @echo "PRINTING MONO VERSION" diff --git a/build-tools/scripts/BuildEverything.mk b/build-tools/scripts/BuildEverything.mk index 29485461a5c..5501222f0c2 100644 --- a/build-tools/scripts/BuildEverything.mk +++ b/build-tools/scripts/BuildEverything.mk @@ -83,7 +83,7 @@ _MSBUILD_ARGS = \ .PHONY: leeroy jenkins leeroy-all opentk-jcw framework-assemblies .PHONY: create-vsix -jenkins: prepare leeroy $(ZIP_OUTPUT) +jenkins:: prepare leeroy $(ZIP_OUTPUT) leeroy: leeroy-all framework-assemblies opentk-jcw diff --git a/build-tools/scripts/Packaging.mk b/build-tools/scripts/Packaging.mk index e738215941e..7a0d94f4299 100644 --- a/build-tools/scripts/Packaging.mk +++ b/build-tools/scripts/Packaging.mk @@ -15,7 +15,7 @@ create-pkg: $(if $(PACKAGE_VERSION_REV),/p:XAVersionCommitCount="$(PACKAGE_VERSION_REV)") \ $(if $(PKG_LICENSE_EN),/p:PkgLicenseSrcEn="$(PKG_LICENSE_EN)") \ $(if $(PKG_OUTPUT_PATH),/p:PkgProductOutputPath="$(PKG_OUTPUT_PATH)") \ - $(if $(USE_COMMERCIAL_NAME),/p:UseCommercialInstallerName="$(USE_COMMERCIAL_NAME)") \ + $(if $(USE_COMMERCIAL_INSTALLER_NAME),/p:UseCommercialInstallerName="$(USE_COMMERCIAL_INSTALLER_NAME)") \ $(if $(_MSBUILD_ARGS),"$(_MSBUILD_ARGS)") create-vsix: @@ -29,7 +29,7 @@ create-vsix: $(if $(PACKAGE_HEAD_BRANCH),/p:XAVersionBranch="$(PACKAGE_HEAD_BRANCH)") \ $(if $(PACKAGE_VERSION_REV),/p:XAVersionCommitCount="$(PACKAGE_VERSION_REV)") \ $(if $(COMMIT),/p:XAVersionHash="$(COMMIT)") \ - $(if $(USE_COMMERCIAL_NAME),/p:UseCommercialInstallerName="$(USE_COMMERCIAL_NAME)") \ + $(if $(USE_COMMERCIAL_INSTALLER_NAME),/p:UseCommercialInstallerName="$(USE_COMMERCIAL_INSTALLER_NAME)") \ $(if $(_MSBUILD_ARGS),"$(_MSBUILD_ARGS)") package-oss-name: From 6620299c4f8ef22619bd59e200dc1bee04748e32 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Wed, 27 Mar 2019 21:04:10 -0400 Subject: [PATCH 06/12] Address feedback and update docs --- .external | 2 +- Documentation/building/unix/instructions.md | 23 +++++++++++++++++-- .../building/windows/instructions.md | 10 ++++++-- build-tools/scripts/PrepareWindows.targets | 4 ++++ .../CheckoutExternalGitDependency.cs | 8 +++---- .../external-git-dependencies.targets | 1 - 6 files changed, 38 insertions(+), 10 deletions(-) diff --git a/.external b/.external index 07778035b3c..5170f4442db 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -pjcollins/monodroid:min-build-poc@648f22ee0fc4c22ec15fca35461b494ab3585d15 +pjcollins/monodroid:min-build-poc@4c8dd92681063438b952680926b8071b41b6abcc diff --git a/Documentation/building/unix/instructions.md b/Documentation/building/unix/instructions.md index eec93dd9b82..26066120e3c 100644 --- a/Documentation/building/unix/instructions.md +++ b/Documentation/building/unix/instructions.md @@ -16,7 +16,15 @@ can also be used by setting the `$(MSBUILD)` make variable to `xbuild`. 4. (Optional) [Configure the build](../configuration.md). - 5. Prepare the project: + 5. (Optional) Prepare external/proprietary git dependencies + + make prepare-external-git-dependencies + + This will clone or update a monodroid checkout in `external` and + ensure that subsequent `prepare` and `make` invocations will build + proprietary components. + + 6. Prepare the project: make prepare # -or- @@ -26,7 +34,7 @@ can also be used by setting the `$(MSBUILD)` make variable to `xbuild`. `git submodule update`, download NuGet dependencies, and other "preparatory" and pre-build tasks that need to be performed. - 6. Build the project: + 7. Build the project: make # -or- @@ -46,6 +54,17 @@ can also be used by setting the `$(MSBUILD)` make variable to `xbuild`. make jenkins MSBUILD=msbuild +# Creating installers + +Once `make all` or `make jenkins` have completed, macOS (.pkg) +and Windows (.vsix) installer files can be built with: + + make create-installers + +Commercial installers will be created by this command if the +`make prepare-external-git-dependencies` command was ran before building. + + # Building Unit Tests Once `make all` or `make jenkins` have completed, the unit tests may diff --git a/Documentation/building/windows/instructions.md b/Documentation/building/windows/instructions.md index ea9ef8f8b86..a4cb9a8bbc5 100644 --- a/Documentation/building/windows/instructions.md +++ b/Documentation/building/windows/instructions.md @@ -18,7 +18,13 @@ MSBuild version 15 or later is required. 4. (Optional) [Configure the build](../configuration.md). - 5. In a [Developer Command Prompt][developer-prompt], prepare the project: + 5. (Optional) In a [Developer Command Prompt][developer-prompt], prepare external git dependencies: + + msbuild Xamarin.Android.sln /t:PrepareExternal + + This will configure external proprietary components such as monodroid. + + 6. In a [Developer Command Prompt][developer-prompt], prepare the project: msbuild Xamarin.Android.sln /t:Prepare @@ -26,7 +32,7 @@ MSBuild version 15 or later is required. `git submodule update`, download NuGet dependencies, and other "preparatory" and pre-build tasks that need to be performed. - 6. Build the project: + 7. Build the project: msbuild Xamarin.Android.sln diff --git a/build-tools/scripts/PrepareWindows.targets b/build-tools/scripts/PrepareWindows.targets index 92385323e5e..6a39784e00b 100644 --- a/build-tools/scripts/PrepareWindows.targets +++ b/build-tools/scripts/PrepareWindows.targets @@ -8,6 +8,10 @@ + + + + From a9c0fa90065be85749f020c2b41a263ed29617e4 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Tue, 2 Apr 2019 09:27:38 -0400 Subject: [PATCH 07/12] Update external monodroid reference --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index 5170f4442db..0eed8bb1bfc 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -pjcollins/monodroid:min-build-poc@4c8dd92681063438b952680926b8071b41b6abcc +pjcollins/monodroid:min-build-poc@04d43a6dae498857239174a93b328d7b7c08c9d3 From 35d85ec122c19303f0c7e175d091ed0386e3aa59 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Tue, 2 Apr 2019 11:04:22 -0400 Subject: [PATCH 08/12] Update external monodroid reference --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index 0eed8bb1bfc..24d5400b381 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -pjcollins/monodroid:min-build-poc@04d43a6dae498857239174a93b328d7b7c08c9d3 +pjcollins/monodroid:min-build-poc@df2218c04f0c124823f41feddfde5ae4f5b8cd66 From 4ba2f21171089f2a0657b830e94fd62342f5b56e Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Sun, 7 Apr 2019 14:08:25 -0400 Subject: [PATCH 09/12] Update external monodroid reference --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index 24d5400b381..606afed7516 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -pjcollins/monodroid:min-build-poc@df2218c04f0c124823f41feddfde5ae4f5b8cd66 +xamarin/monodroid:master@bee5f69a0b41aaeb88fad86ce4d65960a959def9 From ce3ac773cca3b6f26f163b85659b5d12fe919fab Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Tue, 9 Apr 2019 14:20:50 -0400 Subject: [PATCH 10/12] Update external monodroid reference --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index 606afed7516..08d29e1c070 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -xamarin/monodroid:master@bee5f69a0b41aaeb88fad86ce4d65960a959def9 +xamarin/monodroid:master@4a8b52dd7cc78b3491d95fbcf8f7f5b7bfe43282 From 067454b4ec15500b8d6198a74dfc9f853f702fde Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Tue, 9 Apr 2019 19:46:30 -0400 Subject: [PATCH 11/12] Update external monodroid reference --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index 08d29e1c070..d36ca5f49e9 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -xamarin/monodroid:master@4a8b52dd7cc78b3491d95fbcf8f7f5b7bfe43282 +xamarin/monodroid:pjcollins/fix-xa-integration@410072b9a7806c04ee0b7e41d6fadc2950e4187e From bcb2838db29321d3b43125c0f8ae94fe6731a4d2 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Tue, 9 Apr 2019 19:52:32 -0400 Subject: [PATCH 12/12] Update external monodroid reference --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index d36ca5f49e9..1e22997d78d 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -xamarin/monodroid:pjcollins/fix-xa-integration@410072b9a7806c04ee0b7e41d6fadc2950e4187e +xamarin/monodroid:master@97e4c3035f953076bd07f7737810810804d996db