Skip to content
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

[msbuild] Merge the MergeAppBundles[TaskBase] classes. #19751

Merged
merged 1 commit into from
Jan 9, 2024
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
19 changes: 0 additions & 19 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/MergeAppBundles.cs

This file was deleted.

18 changes: 14 additions & 4 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/MergeAppBundlesTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

using Xamarin.Bundler;
using Xamarin.Localization.MSBuild;
using Xamarin.Messaging.Build.Client;
using Xamarin.Utils;

// Disable until we get around to enable + fix any issues.
Expand All @@ -27,7 +28,7 @@ namespace Xamarin.MacDev.Tasks {
// 4) Directories are copied as is, since they can't have different content.
// 5) If symlinks point to different files, an error is raised.
// 6) Any other files will cause errors to be raised.
public abstract partial class MergeAppBundlesTaskBase : XamarinTask {
public partial class MergeAppBundles : XamarinTask {

#region Inputs
// This is a list of files (filename only, no path, will match any file with the given name in the app bundle)
Expand Down Expand Up @@ -66,7 +67,7 @@ class Entries : List<Entry> {
}

class Entry {
public MergeAppBundlesTaskBase Task;
public MergeAppBundles Task;
public Entries AppBundle;
public string RelativePath;
public FileType Type;
Expand Down Expand Up @@ -231,6 +232,9 @@ public void CopyTo (string outputDirectory, string subDirectory = null)

public override bool Execute ()
{
if (ShouldExecuteRemotely ())
return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result;

if (InputAppBundles.Length == 0) {
Log.LogError (MSBStrings.E7073 /* At least one app bundle must be specified. */);
return false;
Expand All @@ -250,13 +254,13 @@ public override bool Execute ()
return !Log.HasLoggedErrors;
}

if (!MergeAppBundles ())
if (!Merge ())
return false;

return !Log.HasLoggedErrors;
}

bool MergeAppBundles ()
bool Merge ()
{
// Some validation
foreach (var input in InputAppBundles) {
Expand Down Expand Up @@ -474,5 +478,11 @@ FileType GetFileType (string path)

return FileType.Other;
}

public void Cancel ()
{
if (ShouldExecuteRemotely ())
BuildConnection.CancelAsync (BuildEngine4).Wait ();
}
}
}
Loading