From 0d7ff034c7c08aa2b00c91412aeb875065010245 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Thu, 10 Aug 2017 11:34:38 -0500 Subject: [PATCH] [xa-prep-tasks] implemented GitCommitTime task Context: #181 (in comments) In several places throughout the build, we are running a command such as ``, which will not work on Windows. The solution is to create an MSBuild task in xa-prep-tasks named `GitCommitTime` that will work cross-platform. `GitCommitTime` returns a string value that can be passed to the `Touch` MSBuild task. --- .../android-toolchain.targets | 9 ++-- build-tools/libzip/libzip.targets | 9 ++-- .../mono-runtimes/mono-runtimes.targets | 19 +++++--- build-tools/scripts/RequiredPrograms.targets | 1 + build-tools/scripts/XAVersionInfo.targets | 1 + .../GitCommitTime.cs | 46 +++++++++++++++++++ .../xa-prep-tasks/xa-prep-tasks.csproj | 3 +- src/sqlite-xamarin/sqlite-xamarin.targets | 9 ++-- 8 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/GitCommitTime.cs diff --git a/build-tools/android-toolchain/android-toolchain.targets b/build-tools/android-toolchain/android-toolchain.targets index d323c7dafbb..71940cbfcab 100644 --- a/build-tools/android-toolchain/android-toolchain.targets +++ b/build-tools/android-toolchain/android-toolchain.targets @@ -106,10 +106,13 @@ - + ToolPath="$(GitToolPath)" + ToolExe="$(GitToolExe)"> + + + <_AndroidMxeToolchain Include="$(MingwCommandPrefix32)" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win32:'))" /> diff --git a/build-tools/libzip/libzip.targets b/build-tools/libzip/libzip.targets index 4553ac369c2..d9326b13af2 100644 --- a/build-tools/libzip/libzip.targets +++ b/build-tools/libzip/libzip.targets @@ -13,10 +13,13 @@ - + ToolPath="$(GitToolPath)" + ToolExe="$(GitToolExe)"> + + + + <_SourceTopDir>..\.. @@ -116,14 +117,20 @@ /> - - + + + + + ToolPath="$(GitToolPath)" + ToolExe="$(GitToolExe)"> + + + diff --git a/build-tools/scripts/RequiredPrograms.targets b/build-tools/scripts/RequiredPrograms.targets index 9b419f56ba8..b248d4c806f 100644 --- a/build-tools/scripts/RequiredPrograms.targets +++ b/build-tools/scripts/RequiredPrograms.targets @@ -3,6 +3,7 @@ + + MSBuild task requires this: https://docs.microsoft.com/en-us/visualstudio/msbuild/touch-task + return "log -1 --format=%cd --date=format-local:\"%Y/%m/%d %H:%M:%S\""; + } + + protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance) + { + if (string.IsNullOrEmpty (singleLine)) + return; + Time = singleLine; + } + } +} diff --git a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj index 36b7b2ccc9c..4a6560831ed 100644 --- a/build-tools/xa-prep-tasks/xa-prep-tasks.csproj +++ b/build-tools/xa-prep-tasks/xa-prep-tasks.csproj @@ -1,4 +1,4 @@ - + Debug @@ -41,6 +41,7 @@ + diff --git a/src/sqlite-xamarin/sqlite-xamarin.targets b/src/sqlite-xamarin/sqlite-xamarin.targets index c31fdfbf90a..2e0a4c7246c 100644 --- a/src/sqlite-xamarin/sqlite-xamarin.targets +++ b/src/sqlite-xamarin/sqlite-xamarin.targets @@ -1,9 +1,12 @@ - + ToolPath="$(GitToolPath)" + ToolExe="$(GitToolExe)"> + + +