Skip to content

Bump to xamarin/xamarin-android-tools/main@76c076fc #7685

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

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 1 addition & 1 deletion external/xamarin-android-tools
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ string FindDotnet ()

string FindMono ()
{
string mono = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<string> (MonoKey, Lifetime);
string mono = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<string> (MonoKey, Lifetime, flags: RegisterTaskObjectKeyFlags.None);
if (!string.IsNullOrEmpty (mono)) {
Log.LogDebugMessage ($"Found cached mono via {nameof (BuildEngine4.RegisterTaskObject)}");
return mono;
Expand All @@ -116,7 +116,7 @@ string FindMono ()
foreach (var path in env.Split (Path.PathSeparator)) {
if (File.Exists (mono = Path.Combine (path, "mono"))) {
Log.LogDebugMessage ("Found mono in $PATH");
BuildEngine4.RegisterTaskObjectAssemblyLocal (MonoKey, mono, Lifetime);
BuildEngine4.RegisterTaskObjectAssemblyLocal (MonoKey, mono, Lifetime, flags: RegisterTaskObjectKeyFlags.None);
return mono;
}
}
Expand All @@ -125,13 +125,13 @@ string FindMono ()
foreach (var path in KnownMonoPaths) {
if (File.Exists (mono = path)) {
Log.LogDebugMessage ($"Found mono in {nameof (KnownMonoPaths)}");
BuildEngine4.RegisterTaskObjectAssemblyLocal (MonoKey, mono, Lifetime);
BuildEngine4.RegisterTaskObjectAssemblyLocal (MonoKey, mono, Lifetime, flags: RegisterTaskObjectKeyFlags.None);
return mono;
}
}

// Last resort
BuildEngine4.RegisterTaskObjectAssemblyLocal (MonoKey, mono = "mono", Lifetime);
BuildEngine4.RegisterTaskObjectAssemblyLocal (MonoKey, mono = "mono", Lifetime, flags: RegisterTaskObjectKeyFlags.None);
return mono;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,30 @@ public void AllProjectsHaveSameOutputDirectory()
sb.Dispose ();
}

[Test]
public void BuildSolutionWithMultipleProjectsInParallel ()
{
var testPath = Path.Combine ("temp", "BuildSolutionWithMultipleProjects");
var sb = new SolutionBuilder("BuildSolutionWithMultipleProjects.sln") {
SolutionPath = Path.Combine (Root, testPath),
MaxCpuCount = 4,
};
for (int i=1; i <= 4; i++) {
var app1 = new XamarinAndroidApplicationProject () {
ProjectName = $"App{i}",
PackageName = $"com.companyname.App{i}",
AotAssemblies = true,
IsRelease = true,
};
app1.SetProperty ("AndroidEnableMarshalMethods", "True");
sb.Projects.Add (app1);
}
sb.BuildingInsideVisualStudio = false;
Assert.IsTrue (sb.Build (), "Build of solution should have succeeded");
Assert.IsTrue (sb.ReBuild (), "ReBuild of solution should have succeeded");
sb.Dispose ();
}

[Test]
public void JavacTaskDoesNotRunOnSecondBuild ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void Aapt2DaemonInstances (int maxInstances, int expectedMax, int expecte
DaemonKeepInDomain = false,
};
Assert.True (task.Execute (), $"task should have succeeded. {string.Join (";", errors.Select (x => x.Message))}");
var daemon = engine.GetRegisteredTaskObjectAssemblyLocal<Aapt2Daemon> (Aapt2Daemon.RegisterTaskObjectKey, RegisteredTaskObjectLifetime.Build);
var daemon = engine.GetRegisteredTaskObjectAssemblyLocal<Aapt2Daemon> (Aapt2Daemon.RegisterTaskObjectKey, RegisteredTaskObjectLifetime.Build, flags: RegisterTaskObjectKeyFlags.None);
Assert.IsNotNull (daemon, "Should have got a Daemon");
Assert.AreEqual (expectedMax, daemon.MaxInstances, $"Expected {expectedMax} but was {daemon.MaxInstances}");
Assert.AreEqual (expectedInstances, daemon.CurrentInstances, $"Expected {expectedInstances} but was {daemon.CurrentInstances}");
Expand Down
4 changes: 2 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Utilities/Aapt2Daemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ internal class Aapt2Daemon : IDisposable
public static Aapt2Daemon GetInstance (IBuildEngine4 engine, string aapt2, int numberOfInstances, int initalNumberOfDaemons, bool registerInDomain = false)
{
var area = registerInDomain ? RegisteredTaskObjectLifetime.AppDomain : RegisteredTaskObjectLifetime.Build;
var daemon = engine.GetRegisteredTaskObjectAssemblyLocal<Aapt2Daemon> (RegisterTaskObjectKey, area);
var daemon = engine.GetRegisteredTaskObjectAssemblyLocal<Aapt2Daemon> (RegisterTaskObjectKey, area, flags: RegisterTaskObjectKeyFlags.None);
if (daemon == null)
{
daemon = new Aapt2Daemon (aapt2, numberOfInstances, initalNumberOfDaemons);
engine.RegisterTaskObjectAssemblyLocal (RegisterTaskObjectKey, daemon, area, allowEarlyCollection: false);
engine.RegisterTaskObjectAssemblyLocal (RegisterTaskObjectKey, daemon, area, allowEarlyCollection: false, flags: RegisterTaskObjectKeyFlags.None);
}
return daemon;
}
Expand Down