Skip to content
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
15 changes: 15 additions & 0 deletions Xamarin.Android.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,6 +51,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "native-nativeaot", "src\nat
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cmake-config", "src\native\cmake-config\cmake-config.csproj", "{5AA3C091-400C-40E4-A073-E093541A5B98}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AndroidBuildConfig", "src\AndroidBuildConfig\AndroidBuildConfig.csproj", "{4BD4C596-7AF4-416E-A4E6-B4739596DF08}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.ProjectTools", "src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Xamarin.ProjectTools.csproj", "{2DD1EE75-6D8D-4653-A800-0A24367F7F38}"
Expand DownExpand Up@@ -409,6 +411,18 @@ Global
{5AA3C091-400C-40E4-A073-E093541A5B98}.Release|x64.Build.0 = Release|Any CPU
{5AA3C091-400C-40E4-A073-E093541A5B98}.Release|x86.ActiveCfg = Release|Any CPU
{5AA3C091-400C-40E4-A073-E093541A5B98}.Release|x86.Build.0 = Release|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Debug|x64.ActiveCfg = Debug|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Debug|x64.Build.0 = Debug|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Debug|x86.ActiveCfg = Debug|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Debug|x86.Build.0 = Debug|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Release|Any CPU.Build.0 = Release|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Release|x64.ActiveCfg = Release|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Release|x64.Build.0 = Release|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Release|x86.ActiveCfg = Release|Any CPU
{4BD4C596-7AF4-416E-A4E6-B4739596DF08}.Release|x86.Build.0 = Release|Any CPU
{2DD1EE75-6D8D-4653-A800-0A24367F7F38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2DD1EE75-6D8D-4653-A800-0A24367F7F38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DD1EE75-6D8D-4653-A800-0A24367F7F38}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand DownExpand Up@@ -1045,6 +1059,7 @@ Global
{9B42A5BB-74CB-46E2-BCE0-AF763A792551} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{645E1718-C8C4-4C23-8A49-5A37E4ECF7ED} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{5AA3C091-400C-40E4-A073-E093541A5B98} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{4BD4C596-7AF4-416E-A4E6-B4739596DF08} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
{2DD1EE75-6D8D-4653-A800-0A24367F7F38} = {CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}
{53E4ABF0-1085-45F9-B964-DCAE4B819998} = {CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}
{F9CD012E-67AC-4A4E-B2A7-252387F91256} = {CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}
Expand Down
2 changes: 2 additions & 0 deletions build-tools/installers/create-installers.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -148,6 +148,8 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Bindings.JavaDependencyVerification.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Bindings.Maven.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Microsoft.Android.Sdk.Bindings.Gradle.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)AndroidBuildConfig.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)AndroidBuildConfig.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Build.Tasks.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Build.Tasks.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Microsoft.Android.Sdk.TrimmableTypeMap.dll" />
Expand Down
3 changes: 0 additions & 3 deletions build-tools/xaprepare/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,9 +100,6 @@ The files mentioned above are found in the [ConfigAndData](xaprepare/ConfigAndDa
Rarely modified, contains all the target ABI names as used throughout the .NET for Android source as well as a number of
helper methods used throughout the preparation utility code. **Be very careful** when modifying the names there as it may
break the build!
- [BuildAndroidPlatforms.cs](xaprepare/ConfigAndData/BuildAndroidPlatforms.cs)
Contains the NDK release/revision constants and the minimum NDK API levels used for all the Android device targets.
The Android API level list itself lives in [`/src/Mono.Android/Mono.Android.Apis.projitems`](../../src/Mono.Android/Mono.Android.Apis.projitems).
- [CommonLicenses.cs](xaprepare/ConfigAndData/CommonLicenses.cs)
A file with constants containing paths to licenses commonly used by software .NET for Android uses. The licenses are used
when generating Third Party Notices.
Expand Down
40 changes: 0 additions & 40 deletions build-tools/xaprepare/xaprepare/Application/BuildInfo.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,47 +11,7 @@ partial class BuildInfo : AppObject
{
public string CommitOfLastVersionChange { get; private set; } = String.Empty;

// NDK version info is now derived directly from BuildAndroidPlatforms.AndroidNdkPkgRevision
// (single source of truth shared with src/androidsdk/androidsdk.targets via Configuration.props).
public string NDKRevision => BuildAndroidPlatforms.AndroidNdkPkgRevision;
public string NDKVersionMajor => NDKVersion.Major.ToString ();
public string NDKVersionMinor => NDKVersion.Minor.ToString ();
public string NDKVersionMicro => NDKVersion.Build.ToString ();

Version? cachedNdkVersion;
Version NDKVersion {
get {
if (cachedNdkVersion != null)
return cachedNdkVersion;
if (!Utilities.ParseAndroidPkgRevision (BuildAndroidPlatforms.AndroidNdkPkgRevision, out Version? ver, out _) || ver == null)
throw new InvalidOperationException ($"Unable to parse NDK revision '{BuildAndroidPlatforms.AndroidNdkPkgRevision}' as a valid version string");
cachedNdkVersion = ver;
return ver;
}
}

public string VersionHash { get; private set; } = String.Empty;
public string XACommitHash { get; private set; } = String.Empty;
public string XABranch { get; private set; } = String.Empty;

public async Task GatherGitInfo (Context context)
{
if (context == null)
throw new ArgumentNullException (nameof (context));

Log.StatusLine ();
Log.StatusLine ("Determining basic build information", ConsoleColor.DarkGreen);
await DetermineLastVersionChangeCommit (context);
Log.StatusLine ();
DetermineXACommitInfo (context);
}

void DetermineXACommitInfo (Context context)
{
GitRunner git = CreateGitRunner (context);
XACommitHash = git.GetTopCommitHash (shortHash: false);
XABranch = git.GetBranchName ();
}

async Task DetermineLastVersionChangeCommit (Context context)
{
Expand Down
3 changes: 0 additions & 3 deletions build-tools/xaprepare/xaprepare/Application/Context.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -431,9 +431,6 @@ public async Task<bool> Init (string? scenarioName = null)
}

BuildInfo = new BuildInfo ();
if (SelectedScenario.NeedsGitBuildInfo) {
await BuildInfo.GatherGitInfo (this);
}

if (MakeConcurrency == 0)
MakeConcurrency = OS.CPUCount + 1;
Expand Down
1 change: 0 additions & 1 deletion build-tools/xaprepare/xaprepare/Application/Scenario.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,6 @@ abstract partial class Scenario : AppObject
public string? LogFilePath { get; protected set; }
public List<Step> Steps { get; } = new List<Step> ();
public bool NeedsGitSubmodules { get; protected set; }
public bool NeedsGitBuildInfo { get; protected set; }
public bool NeedsCompilers { get; protected set; }

protected Scenario (string name, string description)
Expand Down
23 changes: 0 additions & 23 deletions build-tools/xaprepare/xaprepare/Application/Utilities.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,29 +31,6 @@ static partial class Utilities

public static readonly Encoding UTF8NoBOM = new UTF8Encoding (false);

public static bool ParseAndroidPkgRevision (string? v, out Version? version, out string? tag)
{
string? ver = v?.Trim ();
version = null;
tag = null;
if (String.IsNullOrEmpty (ver))
return false;

if (ver!.IndexOf ('.') < 0)
ver = $"{ver}.0";

int tagIdx = ver.IndexOf ('-');
if (tagIdx >= 0) {
tag = ver.Substring (tagIdx + 1);
ver = ver.Substring (0, tagIdx - 1);
}

if (Version.TryParse (ver, out version))
return true;

return false;
}

public static string ToXamarinAndroidPropertyValue (ICollection<string> coll)
{
if (coll == null)
Expand Down

This file was deleted.

Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,6 @@ public Scenario_Required () : base ("Required", "Just the basic steps to quickly
{
NeedsGitSubmodules = true;
NeedsCompilers = true;
NeedsGitBuildInfo = true;
}

protected override void AddSteps (Context context)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,6 @@ public Scenario_Standard ()
{
NeedsGitSubmodules = true;
NeedsCompilers = true;
NeedsGitBuildInfo = true;
}

protected override void AddSteps (Context context)
Expand Down
55 changes: 0 additions & 55 deletions build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,7 +47,6 @@ protected override Task<bool> Execute (Context context)
} else {
return new List <GeneratedFile> {
Get_Configuration_OperatingSystem_props (context),
Get_XABuildConfig_cs (context),
};
}
}
Expand DownExpand Up@@ -89,59 +88,5 @@ GeneratedFile Get_Configuration_OperatingSystem_props (Context context)
Path.Combine (BuildPaths.XamarinAndroidSourceRoot, OutputFileName)
);
}

GeneratedFile Get_XABuildConfig_cs (Context context)
{
const string OutputFileName = "XABuildConfig.cs";

var replacements = new Dictionary<string, string> (StringComparer.Ordinal) {
{ "@NDK_REVISION@", context.BuildInfo.NDKRevision },
{ "@NDK_RELEASE@", BuildAndroidPlatforms.AndroidNdkVersion },
{ "@NDK_VERSION_MAJOR@", context.BuildInfo.NDKVersionMajor },
{ "@NDK_VERSION_MINOR@", context.BuildInfo.NDKVersionMinor },
{ "@NDK_VERSION_MICRO@", context.BuildInfo.NDKVersionMicro },
{ "@NDK_ARMEABI_V7_API@", BuildAndroidPlatforms.NdkMinimumAPILegacy32.ToString () },
{ "@NDK_ARM64_V8A_API@", BuildAndroidPlatforms.NdkMinimumAPI.ToString () },
{ "@NDK_X86_API@", BuildAndroidPlatforms.NdkMinimumAPILegacy32.ToString ().ToString () },
{ "@NDK_X86_64_API@", BuildAndroidPlatforms.NdkMinimumAPI.ToString ().ToString () },
{ "@XA_SUPPORTED_ABIS@", context.Properties.GetRequiredValue (KnownProperties.AndroidSupportedTargetJitAbis).Replace (':', ';') },
{ "@SDK_BUILD_TOOLS_VERSION@", context.Properties.GetRequiredValue (KnownProperties.XABuildToolsFolder) },
{ "@ANDROID_DEFAULT_MINIMUM_DOTNET_API_LEVEL@", GetMajor (context.Properties.GetRequiredValue (KnownProperties.AndroidMinimumDotNetApiLevel)) },
{ "@ANDROID_DEFAULT_MINIMUM_DOTNET_API_LEVEL_MINOR@", GetMinor (context.Properties.GetRequiredValue (KnownProperties.AndroidMinimumDotNetApiLevel)) },
{ "@ANDROID_DEFAULT_TARGET_DOTNET_API_LEVEL@", GetMajor (context.Properties.GetRequiredValue (KnownProperties.AndroidDefaultTargetDotnetApiLevel)) },
{ "@ANDROID_DEFAULT_TARGET_DOTNET_API_LEVEL_MINOR@", GetMinor (context.Properties.GetRequiredValue (KnownProperties.AndroidDefaultTargetDotnetApiLevel)) },
{ "@ANDROID_LATEST_STABLE_API_LEVEL@", GetMajor (context.Properties.GetRequiredValue (KnownProperties.AndroidLatestStableApiLevel)) },
{ "@ANDROID_LATEST_STABLE_API_LEVEL_MINOR@", GetMinor (context.Properties.GetRequiredValue (KnownProperties.AndroidLatestStableApiLevel)) },
{ "@ANDROID_LATEST_UNSTABLE_API_LEVEL@", GetMajor (context.Properties.GetRequiredValue (KnownProperties.AndroidLatestUnstableApiLevel)) },
{ "@ANDROID_LATEST_UNSTABLE_API_LEVEL_MINOR@", GetMinor (context.Properties.GetRequiredValue (KnownProperties.AndroidLatestUnstableApiLevel)) },
{ "@XAMARIN_ANDROID_VERSION@", context.Properties.GetRequiredValue (KnownProperties.ProductVersion) },
{ "@XAMARIN_ANDROID_COMMIT_HASH@", context.BuildInfo.XACommitHash },
{ "@XAMARIN_ANDROID_BRANCH@", context.BuildInfo.XABranch },
};

return new GeneratedPlaceholdersFile (
replacements,
Path.Combine (Configurables.Paths.BuildToolsScriptsDir, $"{OutputFileName}.in"),
Path.Combine (Configurables.Paths.BuildBinDir, OutputFileName)
);

static string GetMajor (string value)
{
var dot = value.IndexOf ('.');
if (dot < 0) {
return value;
}
return value.Substring (0, dot);
}

static string GetMinor (string value)
{
var dot = value.IndexOf ('.');
if (dot < 0) {
return "0";
}
return value.Substring (dot + 1);
}
}
}
}
55 changes: 0 additions & 55 deletions build-tools/xaprepare/xaprepare/ToolRunners/GitRunner.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -135,61 +135,6 @@ public async Task<bool> SubmoduleUpdate (string? workingDirectory = null, bool i
return await RunGit (runner, "submodule-update");
}

public string GetBranchName (string? workingDirectory = null)
{
string runnerWorkingDirectory = DetermineRunnerWorkingDirectory (workingDirectory);
var runner = CreateGitRunner (runnerWorkingDirectory);
runner
.AddArgument ("name-rev")
.AddArgument ("--name-only")
.AddArgument ("--exclude=tags/*")
.AddArgument ("HEAD");

string branchName = String.Empty;
using (var outputSink = (OutputSink)SetupOutputSink (runner)) {
outputSink.LineCallback = (string? line) => {
if (!String.IsNullOrEmpty (branchName)) {
return;
}
branchName = line?.Trim () ?? String.Empty;
};

if (!runner.Run ()) {
return String.Empty;
}

return branchName;
}
}

public string GetTopCommitHash (string? workingDirectory = null, bool shortHash = true)
{
string runnerWorkingDirectory = DetermineRunnerWorkingDirectory (workingDirectory);

var runner = CreateGitRunner (runnerWorkingDirectory);
runner.AddArgument ("rev-parse");
runner.AddArgument ("HEAD");

Log.StatusLine (GetLogMessage (runner), CommandMessageColor);

string hash = String.Empty;
using (var outputSink = (OutputSink)SetupOutputSink (runner)) {
outputSink.LineCallback = (string? line) => {
if (!String.IsNullOrEmpty (hash))
return;
hash = line?.Trim () ?? String.Empty;
};

if (!runner.Run ())
return String.Empty;

if (shortHash)
return Utilities.ShortenGitHash (hash);

return hash;
}
}

public async Task<IList<BlamePorcelainEntry>?> Blame (string filePath)
{
return await Blame (filePath, gitArguments: null, blameArguments: null, workingDirectory: null);
Expand Down
Loading