-
Notifications
You must be signed in to change notification settings - Fork 565
[build] Add support for commercial builds #2845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bc0361d
[build] Add support for commercial builds
pjcollins c237846
Address feedback
pjcollins 7d4ab29
[build] Create commercial installers
pjcollins e911c33
[build] Remove external refs from xa-prep-tasks
pjcollins 22c6222
[build] Conditionally import commercial make rules
pjcollins 6620299
Address feedback and update docs
pjcollins a9c0fa9
Update external monodroid reference
pjcollins cb7407c
Merge remote-tracking branch 'origin/master' into pjcollins/make-comm…
pjcollins 35d85ec
Update external monodroid reference
pjcollins a4539a7
Merge remote-tracking branch 'origin/master' into pjcollins/make-comm…
pjcollins 4ba2f21
Update external monodroid reference
pjcollins ce3ac77
Update external monodroid reference
pjcollins 63524d2
Merge remote-tracking branch 'origin/master' into pjcollins/make-comm…
pjcollins 067454b
Update external monodroid reference
pjcollins bcb2838
Update external monodroid reference
pjcollins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| xamarin/monodroid:master@97e4c3035f953076bd07f7737810810804d996db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,3 +21,4 @@ apk-sizes-*.txt | |
| *.binlog | ||
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props | ||
| *~ | ||
| external/monodroid/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/CheckoutExternalGitDependency.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| using System; | ||
| using System.IO; | ||
| using Microsoft.Build.Framework; | ||
|
|
||
| namespace Xamarin.Android.BuildTools.PrepTasks | ||
| { | ||
| public class CheckoutExternalGitDependency : Git | ||
| { | ||
| [Required] | ||
| public ITaskItem ExternalGitDependency { get; set; } | ||
|
|
||
| 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 (destination); | ||
| } | ||
|
|
||
| WorkingDirectory.ItemSpec = destination; | ||
| Fetch (); | ||
| CheckoutCommit (); | ||
|
|
||
| return !Log.HasLoggedErrors; | ||
| } | ||
|
|
||
| void Clone (string destination) | ||
| { | ||
| string ghToken = Environment.GetEnvironmentVariable("GH_AUTH_SECRET"); | ||
pjcollins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (!string.IsNullOrEmpty (ghToken)) { | ||
| Arguments = $"clone https://{ghToken}@github.com/{owner}/{name} --progress \"{destination}\""; | ||
| } else { | ||
| // Fallback to SSH URI | ||
| Arguments = $"clone git@github.com:{owner}/{name} --progress \"{destination}\""; | ||
| } | ||
|
|
||
pjcollins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| base.Execute (); | ||
| } | ||
|
|
||
| void Fetch () | ||
| { | ||
| Arguments = $"fetch --all --no-recurse-submodules --progress"; | ||
| base.Execute (); | ||
| } | ||
|
|
||
| void CheckoutCommit () | ||
| { | ||
| Arguments = $"checkout {commit} --force --progress"; | ||
| base.Execute (); | ||
| } | ||
|
|
||
| protected override void LogToolCommand(string message) | ||
| { | ||
| // Do nothing | ||
| } | ||
| } | ||
| } | ||
70 changes: 70 additions & 0 deletions
70
...-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ParseExternalGitDependencies.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| | ||
| 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* | ||
| (?<comment>\#.*) | ||
| | | ||
| ( | ||
| \s* | ||
| (?<owner>[^/]+) | ||
| / | ||
| (?<repo>[^:]+) | ||
| : | ||
| (?<branch>[^@]+) | ||
| @ | ||
| (?<commit>.*) | ||
| ) | ||
| $ | ||
| ", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace); | ||
|
|
||
| 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<TaskItem> (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); | ||
pjcollins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| ExternalGitDependencies = externals.ToArray (); | ||
| return !Log.HasLoggedErrors; | ||
| } | ||
| } | ||
| } | ||
22 changes: 22 additions & 0 deletions
22
build-tools/xa-prep-tasks/external-git-dependencies.targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.Git" /> | ||
| <UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.ParseExternalGitDependencies" /> | ||
| <UsingTask AssemblyFile="..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.CheckoutExternalGitDependency" /> | ||
| <PropertyGroup> | ||
| <ExternalSourceDependencyDirectory>$(XamarinAndroidSourcePath)\external</ExternalSourceDependencyDirectory> | ||
| </PropertyGroup> | ||
| <Target Name="ParseExternalFile"> | ||
| <ParseExternalGitDependencies | ||
| ExternalFilePath="$(XamarinAndroidSourcePath)\.external" > | ||
| <Output TaskParameter="ExternalGitDependencies" ItemName="Externals" /> | ||
| </ParseExternalGitDependencies> | ||
| </Target> | ||
| <Target Name="CheckoutExternalGitSources" | ||
| DependsOnTargets="ParseExternalFile"> | ||
| <CheckoutExternalGitDependency | ||
| WorkingDirectory="$(ExternalSourceDependencyDirectory)" | ||
| ExternalGitDependency="@(Externals)" | ||
| /> | ||
| </Target> | ||
| </Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.