Skip to content

Commit f970cd5

Browse files
luhenryjonpryor
authored andcommitted
[mono-runtimes] Try to download Mono archive before building mono (#2265)
Context: https://github.com/xamarin/xamarin-android/projects/10 A goal of the [Mono SDKs Integration][0] project is to allow the xamarin-android build to consume a "mono archive", which is *like* our mono bundle (fbfd676, 2956811), but different in that it *only* contains Mono-related "stuff" (there's no `libzip` in it), and (more importantly) it's maintained and updated by the mono team. * **Mono Bundle**: xamarin-android provided file which contains Mono Runtimes, BCL assemblies, unit test assemblies, and various other files which are "part of" mono, *plus* some things that aren't related to mono at all, such as `libzip` native libs. * **Mono Archive**: Mono-team provided file which contains Mono Runtimes, BCL assemblies, unit test assemblies, and various other files which are part of mono. The Mono Archive only exists for mono:master and [soon mono:2018-08][1] -- while xamarin-android is currently on mono:2018-06, so there is no current mono archive that can be used (!) -- and even if it did exist, *integration* is still "in-progress." In particular, xamarin-android currently has no code to build `libzip.dll` *on Windows*, so without the Mono Bundle, xamarin-android cannot currently build on Windows (ignoring the fact that 38100c0 would cause a Windows build to fail if the Mono Bundle didn't already exist...). Introduce some "baby steps" in using the Mono Archive as part of the xamarin-android build: 1. `build-tools/download-bundle` still exists, and will attempt to download and extract the Mono Bundle. 2. If the bundle from (1) does not exist and we build `src/mono-runtimes`, `mono-runtimes` will try to download the Mono Archive. 3. If (2) *fails* -- which *currently* will always be the case -- then "fallback" to a "from source" mono build, as we've been doing since time immemorial. 4. If (2) *succeeds* -- which hasn't been tested on a PR machine, but has been manually tested, so there may be dragons here! -- then the Mono Archive will be extracted and the contents of the Mono Archive copied to where the rest of the xamarin-android build expects those files to be. 5. "Later" in the build, the `build-tools/create-bundle` project will *still* be executed, and thus the Mono Bundle will *still* be created, and the Mono Bundle will *still* be uploaded to Jenkins when run as part of the [Jenkins job][2]. At some future point in time, we *may* stop using the Mono Bundle. That time is not nigh, and may never happen. [0]: https://github.com/xamarin/xamarin-android/projects/10 [1]: https://xamarinhq.slack.com/archives/C03CEGRUW/p1539362217000100 [2]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/
1 parent 320cb0f commit f970cd5

File tree

4 files changed

+84
-75
lines changed

4 files changed

+84
-75
lines changed

build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/GitCommitHash.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public sealed class GitCommitHash : Git
1616
[Output]
1717
public string AbbreviatedCommitHash { get; set; }
1818

19+
[Output]
20+
public string CommitHash { get; set; }
21+
1922
protected override bool LogTaskMessages {
2023
get { return false; }
2124
}
@@ -38,17 +41,18 @@ public override bool Execute ()
3841

3942
protected override string GenerateCommandLineCommands ()
4043
{
41-
return "log --no-color --first-parent -n1 --pretty=format:%h";
44+
return "rev-parse HEAD";
4245
}
4346

4447
protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance)
4548
{
4649
if (string.IsNullOrEmpty (singleLine))
4750
return;
48-
if (singleLine.Length < RequiredHashLength) {
49-
Log.LogError ("Abbreviated commit hash `{0}` is shorter than required length of {1} characters", singleLine, RequiredHashLength);
51+
if (singleLine.Length < 40) {
52+
Log.LogError ("Commit hash `{0}` is shorter than required length of {1} characters", singleLine, 40);
5053
return;
5154
}
55+
CommitHash = singleLine;
5256
AbbreviatedCommitHash = singleLine.Substring (0, RequiredHashLength);
5357
}
5458
}

src/mono-runtimes/mono-runtimes.projitems

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<_MonoBcl Include="bcl" />
5+
</ItemGroup>
6+
37
<ItemGroup>
48
<_MonoRuntime Include="armeabi-v7a" Condition=" $(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':armeabi-v7a:')) ">
59
<Strip>$(AndroidToolchainDirectory)\toolchains\armeabi-v7a-clang\bin\arm-linux-androideabi-strip</Strip>
@@ -60,27 +64,16 @@
6064
<OutputMonoBtlsFilename></OutputMonoBtlsFilename>
6165
<OutputMonoPosixHelperFilename>libMonoPosixHelper</OutputMonoPosixHelperFilename>
6266
</_MonoRuntime>
63-
<_MonoRuntime Include="host-Darwin" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Darwin:'))">
64-
<Strip>strip</Strip>
65-
<StripFlags>-S</StripFlags>
66-
<OutputRuntimeFilename>libmonosgen-2.0</OutputRuntimeFilename>
67-
<NativeLibraryExtension>dylib</NativeLibraryExtension>
68-
<OutputProfilerFilename>libmono-profiler-log</OutputProfilerFilename>
69-
<OutputAotProfilerFilename>libmono-profiler-aot</OutputAotProfilerFilename>
70-
<OutputMonoBtlsFilename></OutputMonoBtlsFilename>
71-
<OutputMonoPosixHelperFilename>libMonoPosixHelper</OutputMonoPosixHelperFilename>
72-
<BuildTests>True</BuildTests>
73-
</_MonoRuntime>
74-
<_MonoRuntime Include="host-Linux" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Linux:'))">
67+
<_MonoRuntime Include="host-$(HostOS)" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':$(HostOS):')) And ( '$(HostOS)' == 'Darwin' Or '$(HostOS)' == 'Linux' )">
7568
<Strip>strip</Strip>
7669
<StripFlags>-S</StripFlags>
7770
<OutputRuntimeFilename>libmonosgen-2.0</OutputRuntimeFilename>
78-
<NativeLibraryExtension>so</NativeLibraryExtension>
71+
<NativeLibraryExtension Condition=" '$(HostOS)' == 'Darwin' ">dylib</NativeLibraryExtension>
72+
<NativeLibraryExtension Condition=" '$(HostOS)' == 'Linux' ">so</NativeLibraryExtension>
7973
<OutputProfilerFilename>libmono-profiler-log</OutputProfilerFilename>
8074
<OutputAotProfilerFilename>libmono-profiler-aot</OutputAotProfilerFilename>
8175
<OutputMonoBtlsFilename></OutputMonoBtlsFilename>
8276
<OutputMonoPosixHelperFilename>libMonoPosixHelper</OutputMonoPosixHelperFilename>
83-
<BuildTests>True</BuildTests>
8477
</_MonoRuntime>
8578
</ItemGroup>
8679

@@ -91,15 +84,13 @@
9184
<InstallBinaries>true</InstallBinaries>
9285
<InstallPath Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Darwin:'))">Darwin/</InstallPath>
9386
<InstallPath Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Linux:'))">Linux/</InstallPath>
94-
<PackageOptions>llvm-llvm32_CC="$(HostCc32)" llvm-llvm32_CXX="$(HostCxx32)"</PackageOptions>
9587
</_LlvmRuntime>
9688

9789
<_LlvmRuntime Include="llvm64" Condition=" ($(AndroidSupportedTargetAotAbisForConditionalChecks.Contains (':arm64:')) Or $(AndroidSupportedTargetAotAbisForConditionalChecks.Contains (':x86_64:'))) And '$(HostBits)' == '64' ">
9890
<ExeSuffix></ExeSuffix>
9991
<InstallBinaries>true</InstallBinaries>
10092
<InstallPath Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Darwin:'))">Darwin/</InstallPath>
10193
<InstallPath Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Linux:'))">Linux/</InstallPath>
102-
<PackageOptions>llvm-llvm64_CC="$(HostCc64)" llvm-llvm64_CXX="$(HostCxx64)"</PackageOptions>
10394
</_LlvmRuntime>
10495

10596
<_LlvmRuntime Include="llvmwin32" Condition=" ($(AndroidSupportedTargetAotAbisForConditionalChecks.Contains (':win-armeabi-v7a:')) Or $(AndroidSupportedTargetAotAbisForConditionalChecks.Contains (':win-x86:'))) ">

0 commit comments

Comments
 (0)