forked from xamarin/xamarin-android
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into tune-runtime-cpp
* main: [xaprepare] Support Gentoo Linux for OS detection (xamarin#7442) [Xamarin.Android.Build.Tasks] Avoid XA5207 for design-time builds (xamarin#7434)
- Loading branch information
Showing
8 changed files
with
141 additions
and
10 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
build-tools/xaprepare/xaprepare/Application/Program.GentooLinux.cs
This file contains 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,63 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Xamarin.Android.Prepare | ||
{ | ||
class GentooLinuxProgram : LinuxProgram | ||
{ | ||
public GentooLinuxProgram (string packageName, string? executableName = null) | ||
: base (packageName, executableName) | ||
{} | ||
|
||
protected override bool CheckWhetherInstalled () | ||
{ | ||
var output = Utilities.GetStringFromStdout ("equery", "--quiet", "list", PackageName).Replace ($"{PackageName.Split (':') [0]}-", "").Split ('-', '_'); | ||
if (output.Length >= 1 && !String.IsNullOrEmpty (output [0])) { | ||
CurrentVersion = output [0]; | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
#pragma warning disable CS1998 | ||
public override async Task<bool> Install () | ||
{ | ||
ProcessRunner runner; | ||
if (NeedsSudoToInstall) { | ||
runner = new ProcessRunner ("sudo", "emerge", "--oneshot", PackageName) { | ||
EchoStandardOutput = true, | ||
EchoStandardError = true, | ||
ProcessTimeout = TimeSpan.FromMinutes (60), // gcc most probably will not compile in 60 minutes... | ||
}; | ||
} | ||
else | ||
{ | ||
runner = new ProcessRunner ("emerge", "--oneshot", PackageName) { | ||
EchoStandardOutput = true, | ||
EchoStandardError = true, | ||
ProcessTimeout = TimeSpan.FromMinutes (60), // gcc most probably will not compile in 60 minutes... | ||
}; | ||
} | ||
|
||
bool failed = await Task.Run (() => !runner.Run ()); | ||
if (failed) { | ||
Log.Error ($"Installation of {PackageName} timed out"); | ||
failed = true; | ||
} | ||
|
||
if (runner.ExitCode != 0) { | ||
Log.Error ($"Installation failed with error code {runner.ExitCode}"); | ||
failed = true; | ||
} | ||
|
||
return !failed; | ||
} | ||
#pragma warning restore CS1998 | ||
|
||
protected override bool DeterminePackageVersion() | ||
{ | ||
return true; | ||
} | ||
} | ||
} |
This file contains 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
59 changes: 59 additions & 0 deletions
59
build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Gentoo.cs
This file contains 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,59 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Xamarin.Android.Prepare | ||
{ | ||
class LinuxGentoo : Linux | ||
{ | ||
static readonly List<GentooLinuxProgram> packages = new List<GentooLinuxProgram> { | ||
new GentooLinuxProgram ("sys-devel/autoconf"), | ||
new GentooLinuxProgram ("sys-devel/automake"), | ||
new GentooLinuxProgram ("sys-devel/binutils"), | ||
new GentooLinuxProgram ("sys-devel/bison"), | ||
new GentooLinuxProgram ("net-misc/curl"), | ||
new GentooLinuxProgram ("sys-apps/fakeroot"), | ||
new GentooLinuxProgram ("sys-apps/file"), | ||
new GentooLinuxProgram ("sys-apps/findutils"), | ||
new GentooLinuxProgram ("sys-devel/flex"), | ||
new GentooLinuxProgram ("sys-apps/gawk"), | ||
new GentooLinuxProgram ("sys-devel/gcc"), | ||
new GentooLinuxProgram ("sys-devel/gettext"), | ||
new GentooLinuxProgram ("dev-vcs/git"), | ||
new GentooLinuxProgram ("sys-apps/grep"), | ||
new GentooLinuxProgram ("sys-apps/groff"), | ||
//new GentooLinuxProgram ("gtk-sharp-2"), | ||
new GentooLinuxProgram ("app-arch/gzip"), | ||
new GentooLinuxProgram ("dev-java/openjdk-bin:8"), | ||
new GentooLinuxProgram ("sys-devel/libtool"), | ||
new GentooLinuxProgram ("dev-libs/libzip"), | ||
new GentooLinuxProgram ("sys-devel/m4"), | ||
new GentooLinuxProgram ("sys-devel/make"), | ||
//new GentooLinuxProgram ("nuget"), | ||
new GentooLinuxProgram ("sys-devel/patch"), | ||
new GentooLinuxProgram ("dev-util/pkgconf"), | ||
//new GentooLinuxProgram ("referenceassemblies-pcl"), | ||
new GentooLinuxProgram ("sys-apps/sed"), | ||
new GentooLinuxProgram ("sys-apps/texinfo"), | ||
new GentooLinuxProgram ("app-arch/unzip"), | ||
new GentooLinuxProgram ("sys-apps/which"), | ||
new GentooLinuxProgram ("app-arch/zip"), | ||
new GentooLinuxProgram ("app-arch/p7zip"), | ||
}; | ||
|
||
public LinuxGentoo (Context context) | ||
: base (context) | ||
{ | ||
Dependencies.AddRange (packages); | ||
} | ||
|
||
protected override void InitializeDependencies () | ||
{} | ||
|
||
protected override bool InitOS () | ||
{ | ||
if (!base.InitOS ()) | ||
return false; | ||
|
||
return true; | ||
} | ||
}; | ||
} |
This file contains 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 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 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 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 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