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
Original file line numberDiff line numberDiff line change
Expand Up@@ -459,7 +459,7 @@ public override bool Execute ()
new XElement ("AdditionalNativeLibraryReferences",
AdditionalNativeLibraryReferences.Select(e => new XElement ("AdditionalNativeLibraryReference", e)))
));
document.Save (CacheFile);
document.SaveIfChanged (CacheFile);

LogDebugTaskItems (" AdditionalAndroidResourcePaths: ", AdditionalAndroidResourcePaths);
LogDebugTaskItems (" AdditionalJavaLibraryReferences: ", AdditionalJavaLibraryReferences);
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,7 +54,7 @@ public override bool Execute ()
new XElement ("NativeLibraries", NativeLibraries.Select(e => new XElement ("NativeLibrary", e.ItemSpec))),
new XElement ("Jars", Jars.Select(e => new XElement ("Jar", e.ItemSpec)))
));
document.Save (CacheFile);
document.SaveIfChanged (CacheFile);
}

return true;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,7 +122,7 @@ public override bool Execute ()
new XElement ("ResolvedResourceDirectoryStamps",
ResolvedResourceDirectoryStamps.Select(e => new XElement ("ResolvedResourceDirectoryStamp", e)))
));
document.Save (CacheFile);
document.SaveIfChanged (CacheFile);
}

assemblyMap.Save (AssemblyIdentityMapFile);
Expand Down
12 changes: 12 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Utilities/XDocumentExtensions.cs
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Build.Framework;
Expand DownExpand Up@@ -27,6 +28,17 @@ public static string ToFullString (this XElement element)
{
return element.ToString (SaveOptions.DisableFormatting);
}

public static void SaveIfChanged (this XDocument document, string fileName)
{
var tempFile = System.IO.Path.GetTempFileName ();
try {
document.Save (tempFile);
MonoAndroidHelper.CopyIfChanged (tempFile, fileName);
} finally {
File.Delete (tempFile);
}
}
}
}

22 changes: 19 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
Original file line numberDiff line numberDiff line change
Expand Up@@ -1107,9 +1107,21 @@ because xbuild doesn't support framework reference assemblies.
Overwrite="true"/>
</Target>

<PropertyGroup>
<_ManagedUpdateAndroidResgenInputs>
$(MSBuildAllProjects);
@(AndroidResource);
@(ReferencePath);
@(_LibraryResourceDirectoryStamps);
@(_AdditonalAndroidResourceCachePaths->'%(Identity)\cache.stamp');
$(_AndroidBuildPropertiesCache);
$(ProjectAssetsFile);
</_ManagedUpdateAndroidResgenInputs>
</PropertyGroup>

<!-- Managed DesignTime Resource Generation -->
<Target Name="_ManagedUpdateAndroidResgen" Condition=" '$(ManagedDesignTimeBuild)' == 'True' "
Inputs="@(AndroidResource);@(ReferencePath)"
Inputs="$(_ManagedUpdateAndroidResgenInputs);$(_AndroidResourcePathsCache);$(_AndroidLibraryProjectImportsCache);$(_AndroidLibraryImportsCache);"
Outputs="$(_AndroidManagedResourceDesignerFile)"
DependsOnTargets="_CreatePropertiesCache;_ExtractLibraryProjectImports;_CreateAdditionalResourceCache">
<MakeDir Directories="$(_AndroidDesignTimeResDirIntermediate)" />
Expand DownExpand Up@@ -1188,7 +1200,7 @@ because xbuild doesn't support framework reference assemblies.
</Target>

<Target Name="_ResolveLibraryProjectImports"
Inputs="$(MSBuildProjectFullPath);@(ReferencePath);@(ReferenceDependencyPaths);$(_AndroidBuildPropertiesCache)"
Inputs="$(ProjectAssetsFile);$(MSBuildProjectFullPath);@(ReferencePath);@(ReferenceDependencyPaths);$(_AndroidBuildPropertiesCache)"
Outputs="$(_AndroidLibraryProjectImportsCache)">
<ResolveLibraryProjectImports
ContinueOnError="$(DesignTimeBuild)"
Expand DownExpand Up@@ -1393,7 +1405,11 @@ because xbuild doesn't support framework reference assemblies.
@(_AndroidResourceDest);
@(_LibraryResourceDirectoryStamps);
@(_AdditonalAndroidResourceCachePaths->'%(Identity)\cache.stamp');
$(_AndroidBuildPropertiesCache)
$(_AndroidBuildPropertiesCache);
$(ProjectAssetsFile);
$(_AndroidResourcePathsCache);
$(_AndroidLibraryProjectImportsCache);
$(_AndroidLibraryImportsCache);
</_UpdateAndroidResgenInputs>
</PropertyGroup>

Expand Down