Skip to content

Commit

Permalink
Bump to mxe/xamarin/a926b16d (#919)
Browse files Browse the repository at this point in the history
Add commit SHA1 to `$(AndroidMxeInstallPrefix)`, so that we can
revert mxe to an earlier version.

Most of the current "do not rebuild DEPENDENCY" logic is
"forward-only": it only works properly if you go *forward* in time,
not backwards in time.

For example, consider the `ForceBuild` target in
`build-tools/mono-runtimes/mono-runtimes.targets`: if the HEAD commit
within `external/mono` moves "backward" so that the resulting
timestamp of `autogen.sh` is *older* than e.g.
`bin\$(Configuration)\bcl-tests\bcl-tests.zip`, re-running the
`ForceBuild` target won't do anything.

`external/mono` and `mono-runtimes` are forward-only.

Usually this is considered acceptable. If it's truly a problem, nuke
the `bin` directory and rebuild.

"Forward-only" behavior is *not* always acceptable.

Case in point: `external/mxe`. Building MXE takes a significant
amount of time -- roughly 10+ minutes -- so we *cache* the MXE
toolchain into `$(AndroidMxeInstallPrefix)` -- which defaulted to
`$HOME/android-toolchain/mxe` -- and only rebuild the cached MXE
when `external/mxe` changes.

All well and good...except when MXE *cannot* be built *at all*.

Case in point: [MXE couldn't be built with Xcode 8.3][mxe1744].
We didn't notice this for a long period of time, because our Jenkins
machines are fairly stable; they built and cached MXE under
Xcode 8.1, and never had to rebuild MXE again.

[mxe1744]: mxe/mxe#1744

The only reason we noticed is because some developers tried to build
MXE on new machines, with newer Xcode versions, and MXE didn't build.

This raises an interesting conundrum: for *cached* resources such
as MXE, it is *extremely* important to be able to *revert* to a
"known good" version. "Forward only" behavior is at odds with this;
you *can't* revert to a "known good" version, because it may have
been replaced!

Bump to mxe/xamarin/a926b16d, as this version *can* be built under
Xcode 9. (If we're lucky, it will *also* be able to build an updated
commit of `external/libzip`…)

Additionally, alter the semantics of `$(AndroidMxeInstallPrefix)` to
*require* that it *ends with* the abbreviated commit hash of the
`external/mxe` commit; in this commit, `$(AndroidMxeInstallPrefix)`
is `$HOME/android-toolchain/mxe-a926b16d`.

In particular, this allows us to *revert*: bumping `external/mxe`
will build MXE into a new, *unique*, directory, which means that any
previously built directory will not be modified. This in turn allows
us to "revert" the patch to use the previous MXE, if necessary.

The updated MXE now includes a few more "native" plugins in
`plugins/native/$(OS_SHORT_NAME)`. This caused issues on macOS where
the `patch` that MXE built ran into a problem because it relied on
newer APIs not available in older versions of macOS.

Fix this by disabling building the native plugins and instead rely on
the system ones by overriding `$(OS_SHORT_NAME)`.
[This mirrors what MXE is doing on Travis][travis].

[travis]: https://github.com/mxe/mxe/blob/16acc77a3d45425d5a7e11d8b2511fc5a28dd56f/.travis.yml#L6
  • Loading branch information
akoeplinger authored and jonpryor committed Oct 18, 2017
1 parent b529d17 commit b28856f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<AndroidPreviousFrameworkVersion Condition=" '$(AndroidPreviousFrameworkVersion)' == '' ">v1.0</AndroidPreviousFrameworkVersion>
<AndroidToolchainCacheDirectory Condition=" '$(AndroidToolchainCacheDirectory)' == '' ">$(HOME)\android-archives</AndroidToolchainCacheDirectory>
<AndroidToolchainDirectory Condition=" '$(AndroidToolchainDirectory)' == '' ">$(HOME)\android-toolchain</AndroidToolchainDirectory>
<AndroidMxeInstallPrefix Condition=" '$(AndroidMxeInstallPrefix)' == '' And '$(NeedMxe)' == 'true' ">$(AndroidToolchainDirectory)\mxe</AndroidMxeInstallPrefix>
<AndroidMxeInstallPrefix Condition=" '$(AndroidMxeInstallPrefix)' == '' And '$(NeedMxe)' == 'true' ">$(AndroidToolchainDirectory)\mxe-a926b16</AndroidMxeInstallPrefix>
<AndroidMxeInstallPrefix Condition=" '$(HostOS)' == 'Linux' ">\usr</AndroidMxeInstallPrefix>
<AndroidSdkDirectory>$(AndroidToolchainDirectory)\sdk</AndroidSdkDirectory>
<AndroidNdkDirectory>$(AndroidToolchainDirectory)\ndk</AndroidNdkDirectory>
Expand Down
15 changes: 13 additions & 2 deletions build-tools/android-toolchain/android-toolchain.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<Import Project="android-toolchain.projitems" />
<Import Project="..\scripts\RequiredPrograms.targets" />
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.AcceptAndroidSdkLicenses" />
<UsingTask AssemblyFile="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.GitCommitHash" />
<Target Name="_CopyBootstrapTasksAssembly"
Outputs="$(OutputPath)\Xamarin.Android.Tools.BootstrapTasks.dll">
<MSBuild
Expand Down Expand Up @@ -135,14 +136,24 @@
Condition=" '$(NeedMxe)' == 'true' And ($(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win32:')) Or $(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win64:')))"
Inputs="..\..\external\mxe\Makefile"
Outputs="@(_AndroidMxeOutput)">
<GitCommitHash
WorkingDirectory="..\..\external\mxe"
ToolPath="$(GitToolPath)"
ToolExe="$(GitToolExe)">
<Output TaskParameter="AbbreviatedCommitHash" PropertyName="_MxeHash" />
</GitCommitHash>
<Error
Condition=" !$(AndroidMxeFullPath.EndsWith ($(_MxeHash))) "
Text="%24(AndroidMxeFullPath) value of `$(AndroidMxeFullPath)` MUST end with `$(_MxeHash)`!"
/>
<Exec
Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win32:'))"
Command="make MXE_TARGETS=&quot;$(MingwCommandPrefix32)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot;"
Command="make MXE_TARGETS=&quot;$(MingwCommandPrefix32)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot; OS_SHORT_NAME=&quot;disable-native-plugins&quot;"
WorkingDirectory="..\..\external\mxe"
/>
<Exec
Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win64:'))"
Command="make MXE_TARGETS=&quot;$(MingwCommandPrefix64)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot;"
Command="make MXE_TARGETS=&quot;$(MingwCommandPrefix64)&quot; gcc cmake zlib pthreads dlfcn-win32 mman-win32 PREFIX=&quot;$(AndroidMxeFullPath)&quot; OS_SHORT_NAME=&quot;disable-native-plugins&quot;"
WorkingDirectory="..\..\external\mxe"
/>
<Touch Files="@(_AndroidMxeOutput)" />
Expand Down
2 changes: 1 addition & 1 deletion external/mxe
Submodule mxe updated 1059 files
2 changes: 1 addition & 1 deletion src/monodroid/monodroid.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<_HostUnixCFlags>$(_CommonCFlags) -Wa,--noexecstack</_HostUnixCFlags>
<_HostUnixLdFlags>-Wall -lstdc++ -lz -shared -fpic</_HostUnixLdFlags>
<_HostCommonWinCFlags>$(_CommonCFlags) -DWINDOWS -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA -fomit-frame-pointer</_HostCommonWinCFlags>
<_HostCommonWinLdFlags>-Wall -lstdc++ -lz -shared -fpic -ldl -lmman -pthread -lwsock32 -lole32 -luuid -lshlwapi</_HostCommonWinLdFlags>
<_HostCommonWinLdFlags>-Wall -lstdc++ -lz -shared -fpic -ldl -lmman -pthread -lwsock32 -lole32 -luuid -lshlwapi -lpsapi</_HostCommonWinLdFlags>
<_UnixAdditionalSourceFiles>$(MonoSourceFullPath)\support\nl.c jni\debug.c jni\monodroid-networkinfo.c jni\xamarin_getifaddrs.c</_UnixAdditionalSourceFiles>
<_LinuxFlatPakBuild Condition="Exists('/.flatpak-info')" >-DLINUX_FLATPAK</_LinuxFlatPakBuild>
</PropertyGroup>
Expand Down

0 comments on commit b28856f

Please sign in to comment.