From e4d9895365bb0ed93733642b1e3eb7b640e0ffb8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Oct 2017 15:01:15 +0200 Subject: [PATCH] [mtouch] Protect against touchy files that don't like to be touched. Fixes #60149. (#2894) Catch any exceptions that occur when touching files, and show a warning instead of failing the build. https://bugzilla.xamarin.com/show_bug.cgi?id=60149 --- docs/website/mtouch-errors.md | 6 ++++++ tools/mtouch/mtouch.cs | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/website/mtouch-errors.md b/docs/website/mtouch-errors.md index 1f1bce9b53..9ef636a801 100644 --- a/docs/website/mtouch-errors.md +++ b/docs/website/mtouch-errors.md @@ -623,6 +623,12 @@ No action is required, this message is purely informational. For further information see bug #[52727](https://bugzilla.xamarin.com/show_bug.cgi?id=52727). +### MT0128: Could not touch the file '*': * + +A failure occurred when touching a file (which is done to ensure partial builds are done correctly). + +This warning can most likely be ignored; in case of any problems file a bug (https://bugzilla.xamarin.com](https://bugzilla.xamarin.com/enter_bug.cgi?product=iOS)) and it will be investigated. + # MT1xxx: Project related error messages ### MT10xx: Installer / mtouch diff --git a/tools/mtouch/mtouch.cs b/tools/mtouch/mtouch.cs index 1b1d5e812d..7dd96a2b85 100644 --- a/tools/mtouch/mtouch.cs +++ b/tools/mtouch/mtouch.cs @@ -802,8 +802,13 @@ namespace Xamarin.Bundler { if (timestamp == null) timestamp = DateTime.Now; - foreach (var filename in filenames) - new FileInfo (filename).LastWriteTime = timestamp.Value; + foreach (var filename in filenames) { + try { + new FileInfo (filename).LastWriteTime = timestamp.Value; + } catch (Exception e) { + ErrorHelper.Warning (128, "Could not touch the file '{0}': {1}", filename, e.Message); + } + } } public static void Touch (params string [] filenames)