[msbuild/dotnet] Rework Hot Restart builds.

Rework Hot Restart builds to use as much as possible of the normal build logic, because
this is the easiest way to make sure the Hot Restart build is as close as possible
to normal builds (and we don't end up missing features).

This is done by executing selected parts of a normal build, and a the end we have
a new task that computes where each file goes in the various output directories Hot
Restart uses (HotRestartAppBundlePath, HotRestartContentDir, HotRestartAppContentDir,
etc.)
This commit is contained in:
Rolf Bjarne Kvinge 2023-02-16 14:30:19 +01:00
Родитель 8e6104c497
Коммит f17bc64d1b
5 изменённых файлов: 252 добавлений и 180 удалений

Просмотреть файл

@ -1495,9 +1495,10 @@
<ResolvedFileToPublish Remove="$(ProjectRuntimeConfigFilePath)" Condition="'$(GenerateRuntimeConfigurationFiles)' == 'true'" />
</ItemGroup>
<!-- This task is executed on Windows as well, for hotrestart builds -->
<ComputeBundleLocation
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Condition="'$(IsMacEnabled)' == 'true' Or '$(IsHotRestartBuild)' == 'true'"
AssemblyDirectory="$(_AppContentsRelativePath)"
BundleResource="@(BundleResource)"
BundlerDebug="$(_BundlerDebug)"
@ -1572,10 +1573,11 @@
<ResolvedFileToPublish RelativePath="$(_RelativeAppBundlePath)\%(RelativePath)" />
</ItemGroup>
<!-- This task is executed on Windows as well, for hotrestart builds -->
<!-- resolve any .xcframeworks and binding resource packages -->
<ResolveNativeReferences
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Condition="'$(IsMacEnabled)' == 'true' Or '$(IsHotRestartBuild)' == 'true'"
Architectures="$(TargetArchitectures)"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
NativeReferences="@(_UnresolvedXCFrameworks);@(_AppleBindingResourcePackage);@(_CompressedAppleFrameworks);@(_CompressedAppleBindingResourcePackage)"
@ -1636,9 +1638,10 @@
</_CompressedPlugIns>
</ItemGroup>
<!-- This task is executed from Windows as well when using HotRestart -->
<Unzip
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Condition="'$(IsMacEnabled)' == 'true' Or '$(IsHotRestartBuild)' == 'true'"
ZipFilePath="%(_CompressedPlugIns.Identity)"
ExtractionPath="%(_CompressedPlugIns.ExtractionPath)"
>

Просмотреть файл

@ -450,9 +450,10 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<Content Remove="@(_ProcessedContent)" />
</ItemGroup>
<!-- This task may be executed locally on Windows (for Hot Restart) -->
<CollectBundleResources
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Condition="'$(IsMacEnabled)' == 'true' Or '$(IsHotRestartBuild)' == 'true'"
OptimizePropertyLists="$(OptimizePropertyLists)"
OptimizePNGs="$(OptimizePNGs)"
BundleResources="@(Content);@(BundleResource)"
@ -1806,9 +1807,10 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<Target Name="_UnpackLibraryResources" Condition="'$(_CanOutputAppBundle)' == 'true'" DependsOnTargets="ResolveReferences;_CollectBundleResources;_PrepareUnpackLibraryResources"
Inputs="@(_UnpackLibraryResourceItems)"
Outputs="@(_UnpackLibraryResourceItems->'$(_StampDirectory)%(StampFile)')">
<MakeDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="$(_StampDirectory)" />
<MakeDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true' Or '$(IsHotRestartBuild)' == 'true'" Directories="$(_StampDirectory)" />
<!-- This task may be executed locally on Windows (for Hot Restart) -->
<UnpackLibraryResources
Condition="'$(IsMacEnabled)' == 'true'"
Condition="'$(IsMacEnabled)' == 'true' Or '$(IsHotRestartBuild)' == 'true'"
SessionId="$(BuildSessionId)"
Prefix="$(_EmbeddedResourcePrefix)"
NoOverwrite="@(_BundleResourceWithLogicalName)"
@ -1819,7 +1821,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
</UnpackLibraryResources>
<Touch
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Condition="'$(IsMacEnabled)' == 'true' Or '$(IsHotRestartBuild)' == 'true'"
Files="@(_UnpackLibraryResourceItems->'$(_StampDirectory)%(StampFile)')"
AlwaysCreate="True"
>

Просмотреть файл

@ -0,0 +1,164 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.MacDev.Tasks;
#nullable enable
namespace Xamarin.iOS.HotRestart.Tasks {
public class ComputeHotRestartBundleContents : Task {
#region Inputs
[Required]
public string HotRestartAppContentDir { get; set; } = string.Empty;
[Required]
public string HotRestartContentDir { get; set; } = string.Empty;
[Required]
public string HotRestartContentStampDir { get; set; } = string.Empty;
[Required]
public string HotRestartSignedAppDir { get; set; } = string.Empty;
[Required]
public string RelativeAppBundlePath { get; set; } = string.Empty;
[Required]
public string TargetFrameworkMoniker { get; set; } = string.Empty;
[Required]
public ITaskItem [] ResolvedFileToPublish { get; set; } = Array.Empty<ITaskItem> ();
#endregion
#region Outputs
[Output]
public ITaskItem [] HotRestartAppContentDirContents { get; set; } = Array.Empty<ITaskItem> ();
[Output]
public ITaskItem [] HotRestartContentDirContents { get; set; } = Array.Empty<ITaskItem> ();
[Output]
public ITaskItem [] HotRestartSignedAppDirContents { get; set; } = Array.Empty<ITaskItem> ();
#endregion
ITaskItem CopyWithDestinationAndStamp (ITaskItem item, string destinationDirectory, string? stampDirectory = null)
{
var rv = new TaskItem (item);
// The RelativePath metadata specifies the path of the item inside the app bundle relative to the output directory.
// We need to convert this to a path relative to the root of the app bundle, since we copy files to a different
// directory than the normal app bundle output path.
var relativePath = item.GetMetadata ("RelativePath");
if (relativePath.StartsWith (RelativeAppBundlePath, StringComparison.OrdinalIgnoreCase))
relativePath = relativePath.Substring (RelativeAppBundlePath.Length).TrimStart ('\\', '/');
relativePath = relativePath.Replace ('/', Path.DirectorySeparatorChar);
// And here we compute the final absolute path of the item, into our own output directory.
rv.SetMetadata ("DestinationFile", Path.Combine (destinationDirectory, relativePath));
// Also set a stamp file metadata if we're supposed to write a stamp file.
if (!string.IsNullOrEmpty (stampDirectory))
rv.SetMetadata ("StampFile", Path.Combine (stampDirectory, relativePath));
return rv;
}
// The Copy task can't copy directories, so expand directories to their individual files
List<ITaskItem> ExpandDirectories (List<ITaskItem> items)
{
var rv = new List<ITaskItem> ();
foreach (var item in items) {
if (File.Exists (item.ItemSpec)) {
rv.Add (item);
} else if (Directory.Exists (item.ItemSpec)) {
var entries = Directory.GetFileSystemEntries (item.ItemSpec).ToArray ();
Log.LogMessage (MessageImportance.Low, $"Expanding {item.ItemSpec} with {entries.Length} items:");
foreach (var entry in entries) {
if (Directory.Exists (entry)) {
Log.LogMessage (MessageImportance.Low, $" Skipped directory: {entry}");
continue;
}
var relativePathSuffix = entry.Substring (item.ItemSpec.Length).TrimStart ('\\', '/');
var relativePath = Path.Combine (item.GetMetadata ("RelativePath"), relativePathSuffix);
var destinationFile = Path.Combine (item.GetMetadata ("DestinationFile"), relativePathSuffix);
var file = new TaskItem (item);
file.ItemSpec = entry;
file.SetMetadata ("RelativePath", relativePath);
file.SetMetadata ("DestinationFile", destinationFile);
rv.Add (file);
Log.LogMessage (MessageImportance.Low, $" Added {file.ItemSpec} with relative path: {relativePath} and destination file: {destinationFile}");
}
} else {
// Trust that this will just somehow work.
rv.Add (item);
}
}
return rv;
}
public override bool Execute ()
{
var appContentDirContents = new List<ITaskItem> ();
var contentDirContents = new List<ITaskItem> ();
var signedAppDirContents = new List<ITaskItem> ();
foreach (var item in ResolvedFileToPublish) {
var publishFolderType = item.GetPublishFolderType ();
switch (publishFolderType) {
case PublishFolderType.RootDirectory:
case PublishFolderType.Assembly:
case PublishFolderType.Resource:
appContentDirContents.Add (CopyWithDestinationAndStamp (item, HotRestartAppContentDir));
contentDirContents.Add (CopyWithDestinationAndStamp (item, HotRestartContentDir, HotRestartContentStampDir));
break;
case PublishFolderType.AppleFramework:
var filename = Path.GetFileName (item.ItemSpec);
var dirname = Path.GetFileName (Path.GetDirectoryName (item.ItemSpec));
if (string.Equals (filename + ".framework", dirname, StringComparison.OrdinalIgnoreCase))
item.ItemSpec = Path.GetDirectoryName (item.ItemSpec);
// These have to be signed
signedAppDirContents.Add (CopyWithDestinationAndStamp (item, HotRestartSignedAppDir));
break;
case PublishFolderType.PlugIns:
case PublishFolderType.DynamicLibrary:
case PublishFolderType.PluginLibrary:
// These have to be signed
signedAppDirContents.Add (CopyWithDestinationAndStamp (item, HotRestartSignedAppDir));
break;
case PublishFolderType.Unset: // Don't copy unknown stuff anywhere
case PublishFolderType.None: // Don't copy unknown stuff anywhere
case PublishFolderType.Unknown: // Don't copy unknown stuff anywhere
case PublishFolderType.AppleBindingResourcePackage: // These aren't copied to the bundle
case PublishFolderType.CompressedAppleBindingResourcePackage: // These aren't copied to the bundle
case PublishFolderType.StaticLibrary: // These aren't copied to the bundle
case PublishFolderType.CompressedAppleFramework: // Shouldn't really happen? Should be uncompresed by the time we get here.
case PublishFolderType.CompressedPlugIns: // Shouldn't really happen? Should be uncompresed by the time we get here.
Log.LogMessage (MessageImportance.Low, $" Skipped {item.ItemSpec} because PublishFolderType={publishFolderType} items aren't copied to the app bundle.");
continue;
default:
Log.LogMessage (MessageImportance.Low, $" Skipped {item.ItemSpec} because of unknown PublishFolderType={publishFolderType}.");
continue;
}
}
appContentDirContents = ExpandDirectories (appContentDirContents);
contentDirContents = ExpandDirectories (contentDirContents);
signedAppDirContents = ExpandDirectories (signedAppDirContents);
HotRestartAppContentDirContents = appContentDirContents.ToArray ();
HotRestartContentDirContents = contentDirContents.ToArray ();
HotRestartSignedAppDirContents = signedAppDirContents.ToArray ();
return !Log.HasLoggedErrors;
}
}
}

Просмотреть файл

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Xamarin.MacDev.Tasks.CompileEntitlements" AssemblyFile="Xamarin.iOS.Tasks.dll" />
<UsingTask TaskName="Xamarin.iOS.Tasks.UnpackLibraryResources" AssemblyFile="Xamarin.iOS.Tasks.dll" />
<UsingTask TaskName="Xamarin.iOS.HotRestart.Tasks.CodesignHotRestartApp" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.HotRestart.Tasks.CollectDynamicFrameworks" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.HotRestart.Tasks.CompileHotRestartAppManifest" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.HotRestart.Tasks.ComputeHotRestartBundleContents" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.HotRestart.Tasks.DetectHotRestartSigningIdentity" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.HotRestart.Tasks.PrepareAppBundle" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.HotRestart.Tasks.UnpackFrameworks" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
@ -52,97 +52,21 @@
</Target>
<Target Name="_CollectHotRestartBundleResources" Condition="'$(IsHotRestartBuild)' == 'true'">
<CollectBundleResources
OptimizePropertyLists="$(OptimizePropertyLists)"
OptimizePNGs="$(OptimizePNGs)"
BundleResources="@(Content);@(BundleResource);@(MauiAsset)"
ProjectDir="$(MSBuildProjectDirectory)"
ResourcePrefix="$(IPhoneResourcePrefix)">
<Output TaskParameter="BundleResourcesWithLogicalNames" ItemName="_HotRestartBundleResourceWithLogicalName"/>
</CollectBundleResources>
</Target>
<Target Name="_UnpackHotRestartLibraryResources" DependsOnTargets="_CollectHotRestartBundleResources"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsHotRestartBuild)' == 'true'" >
<UnpackLibraryResources
Prefix="monotouch"
NoOverwrite="@(_HotRestartBundleResourceWithLogicalName)"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
TargetFrameworkDirectory="$(TargetFrameworkDirectory)"
ReferencedLibraries="@(ReferencePath);@(ReferenceDependencyPaths);@(_ReferencesFromNuGetPackages)">
<Output TaskParameter="BundleResourcesWithLogicalNames" ItemName="_HotRestartBundleResourceWithLogicalName" />
</UnpackLibraryResources>
</Target>
<!-- Gets the list of assemblies that may contain frameworks -->
<Target Name="_CollectHotRestartFrameworkAssemblies" Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsHotRestartBuild)' == 'true'">
<ItemGroup>
<AssembliesWithFrameworks Condition="'%(Extension)' == '.dll'" Include="@(ReferenceCopyLocalPaths)" Exclude="@(ReferenceSatellitePaths)"/>
</ItemGroup>
</Target>
<Target Name="_UnpackHotRestartFrameworkAssemblies"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsHotRestartBuild)' == 'true' And '$(UnpackHotRestartFrameworks)' == 'true'"
Inputs="@(AssembliesWithFrameworks)"
Outputs="@(AssembliesWithFrameworks -> '$(DeviceSpecificIntermediateOutputPath)UnpackedFrameworks\%(Filename)%(Extension).stamp')" >
<UnpackFrameworks
ReferencedAssemblies="@(AssembliesWithFrameworks)"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)">
<Output TaskParameter="Frameworks" ItemName="_UnpackedFramework" />
</UnpackFrameworks>
<MakeDir Directories="$(DeviceSpecificIntermediateOutputPath)UnpackedFrameworks"/>
<Touch AlwaysCreate="true" Files="@(AssembliesWithFrameworks -> '$(DeviceSpecificIntermediateOutputPath)UnpackedFrameworks\%(Filename)%(Extension).stamp')" >
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<Target Name="_CollectHotRestartFrameworks" >
<ItemGroup>
<_HotRestartFrameworks Include="@(None -> '%(RootDir)%(Directory)')" Condition="$([System.String]::new('%(Directory)').EndsWith('.framework\'))" KeepDuplicates="false" />
<_HotRestartFrameworks Include="@(_UnpackedFramework);@(NativeReference)" KeepDuplicates="false" />
<_HotRestartFrameworkExecutables Include="@(_HotRestartFrameworks -> '%(FullPath)\%(Filename)')"
Outputs="$(DeviceSpecificIntermediateOutputPath)DynamicFrameworks\%(Filename)%(Extension).stamp" KeepDuplicates="false" />
</ItemGroup>
</Target>
<PropertyGroup>
<_CollectHotRestartDynamicFrameworksDependsOn>
_CollectHotRestartFrameworkAssemblies;
_UnpackHotRestartFrameworkAssemblies;
_CollectHotRestartFrameworks;
</_CollectHotRestartDynamicFrameworksDependsOn>
</PropertyGroup>
<Target Name="_CollectHotRestartDynamicFrameworks" DependsOnTargets="$(_CollectHotRestartDynamicFrameworksDependsOn)"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsHotRestartBuild)' == 'true'"
Inputs="@(_HotRestartFrameworkExecutables)"
Outputs="@(_HotRestartFrameworkExecutables -> '%(Outputs)')" >
<CollectDynamicFrameworks
Frameworks="@(_HotRestartFrameworks)" >
<Output TaskParameter="DynamicFrameworks" ItemName="_DynamicFrameworks" />
</CollectDynamicFrameworks>
<MakeDir Directories="$(DeviceSpecificIntermediateOutputPath)DynamicFrameworks"/>
<Touch AlwaysCreate="true" Files="@(_HotRestartFrameworks -> '$(DeviceSpecificIntermediateOutputPath)DynamicFrameworks\%(Filename)%(Extension).stamp')" >
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
<ItemGroup>
<_HotRestartFrameworkFiles Include="%(_DynamicFrameworks.FullPath)\**\*.*" Condition="'%(_DynamicFrameworks.FullPath)' != ''" KeepDuplicates="false" >
<FrameworkDir>%(FrameworkDir)</FrameworkDir>
</_HotRestartFrameworkFiles>
</ItemGroup>
<!-- Collect everything that goes in the app bundle, and figure out where to put it all -->
<Target Name="_ComputeHotRestartBundleContents" DependsOnTargets="_GenerateBundleName;_ParseBundlerArguments;_ComputeTargetArchitectures;_ComputeVariables;_CollectDecompressedPlugIns">
<ComputeHotRestartBundleContents
HotRestartAppContentDir="$(HotRestartAppContentDir)"
HotRestartContentDir="$(HotRestartContentDir)"
HotRestartContentStampDir="$(HotRestartContentStampDir)"
HotRestartSignedAppDir="$(HotRestartSignedAppDir)"
RelativeAppBundlePath="$(_RelativeAppBundlePath)"
ResolvedFileToPublish="@(ResolvedFileToPublish);@(_FileNativeReference);@(_FrameworkNativeReference);@(_DecompressedPlugIns);@(_PlugIns)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
<Output TaskParameter="HotRestartAppContentDirContents" ItemName="_HotRestartAppContentDirContents" />
<Output TaskParameter="HotRestartContentDirContents" ItemName="_HotRestartContentDirContents" />
<Output TaskParameter="HotRestartSignedAppDirContents" ItemName="_HotRestartSignedAppDirContents" />
</ComputeHotRestartBundleContents>
</Target>
<PropertyGroup>
@ -155,7 +79,7 @@
<Target Name="_CreateHotRestartCachedBundle" DependsOnTargets="$(_CreateHotRestartCachedBundleDependsOn)" />
<!-- Creates HotRestart app bundle and collects files to copy -->
<!-- Creates HotRestart app bundle -->
<Target Name="_PrepareHotRestartAppBundle" DependsOnTargets="_GenerateHotRestartBuildSessionId"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsAppExtension)' == 'false' And '$(IsHotRestartBuild)' == 'true'">
@ -171,20 +95,6 @@
<!-- Delete the build signature to force XMA do a full build next time -->
<Delete Files="$(BuildSignatureFile)" Condition="Exists('$(BuildSignatureFile)')" />
<ItemGroup>
<_FilesToHotRestartBundle Include="$(HotRestartAppBundlePath)\Extracted" />
<_FilesToHotRestartContent Include="@(MainAssembly);" >
<DestinationSubDirectory></DestinationSubDirectory>
</_FilesToHotRestartContent>
<_FilesToHotRestartContent Include="@(_FilesToHotRestartContent -> '%(RootDir)%(Directory)%(Filename).pdb')"
Condition="Exists('%(RootDir)%(Directory)%(Filename).pdb')" />
<_FilesToHotRestartContent Include="@(ReferenceCopyLocalPaths -> Distinct())"
Condition="Exists('$(HotRestartAppBundlePath)\%(Filename)%(Extension)') == 'false' And '%(Extension)' != '.a' And '%(Extension)' != '.dylib' And '%(Extension)' != '.dat'"/>
</ItemGroup>
</Target>
<Target Name="_CompileHotRestartAppManifest"
@ -223,82 +133,67 @@
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)" />
</Target>
<Target Name="_CopyFilesToHotRestartBundle"
<!-- Copy Bundle resources -->
<Target Name="_CopyHotRestartBundleResources"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsAppExtension)' == 'false' And '$(IsHotRestartBuild)' == 'true'"
DependsOnTargets="_CreateHotRestartCachedBundle;_UnpackHotRestartLibraryResources"
Inputs="@(_HotRestartBundleResourceWithLogicalName);@(_FilesToHotRestartBundle)"
Outputs="@(_HotRestartBundleResourceWithLogicalName -> '$(HotRestartSignedAppDir)%(LogicalName)');
@(_FilesToHotRestartBundle -> '$(HotRestartSignedAppDir)%(Filename)%(Extension)')">
<!-- Copy Bundle resources -->
<Copy SourceFiles="@(_HotRestartBundleResourceWithLogicalName)"
DestinationFiles="@(_HotRestartBundleResourceWithLogicalName -> '$(HotRestartSignedAppDir)\%(LogicalName)')"
SkipUnchangedFiles="true"
Condition="'@(_HotRestartBundleResourceWithLogicalName)' != ''">
DependsOnTargets="_CreateHotRestartCachedBundle;_UnpackLibraryResources"
Inputs="@(_BundleResourceWithLogicalName)"
Outputs="@(_BundleResourceWithLogicalName -> '$(HotRestartSignedAppDir)%(LogicalName)')">
<Copy
SourceFiles="@(_BundleResourceWithLogicalName)"
DestinationFiles="@(_BundleResourceWithLogicalName -> '$(HotRestartSignedAppDir)%(LogicalName)')"
SkipUnchangedFiles="true"
>
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
<Copy SourceFiles="@(_FilesToHotRestartBundle)"
DestinationFiles="@(_FilesToHotRestartBundle -> '$(HotRestartSignedAppDir)\%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Condition="'@(_FilesToHotRestartBundle)' != ''">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
<MakeDir Directories="$(HotRestartContentStampDir)"/>
<Touch AlwaysCreate="true" Files="$(HotRestartContentStampDir)$(_AppBundleName).stamp" />
</Target>
<Target Name="_CopyFilesToHotRestartContent"
<!-- Copy the items in _HotRestartSignedAppDirContents to their destination directory -->
<Target Name="_CopyFilesToHotRestartSignedAppDirContents"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsAppExtension)' == 'false' And '$(IsHotRestartBuild)' == 'true'"
DependsOnTargets="_CreateHotRestartCachedBundle"
Inputs="@(_FilesToHotRestartContent)"
Outputs="@(_FilesToHotRestartContent -> '$(HotRestartContentDir)%(DestinationSubDirectory)%(FileName)%(Extension)');
@(_FilesToHotRestartContent -> '$(HotRestartAppContentDir)%(DestinationSubDirectory)%(FileName)%(Extension)')">
<MakeDir Directories="$(HotRestartContentDir)"/>
<MakeDir Directories="$(HotRestartAppContentDir)"/>
<!-- Copy assemblies and debug symbols into incremental Content folder -->
<Copy SourceFiles="@(_FilesToHotRestartContent)"
DestinationFiles="@(_FilesToHotRestartContent -> '$(HotRestartContentDir)%(DestinationSubDirectory)%(FileName)%(Extension)')"
SkipUnchangedFiles="true"
Condition="'@(_FilesToHotRestartContent)' != ''">
DependsOnTargets="_CreateHotRestartCachedBundle;_ComputeHotRestartBundleContents"
Inputs="@(_HotRestartSignedAppDirContents)"
Outputs="@(_HotRestartSignedAppDirContents -> '%(DestinationFile)')">
<Copy
SourceFiles="@(_HotRestartSignedAppDirContents)"
DestinationFiles="@(_HotRestartSignedAppDirContents -> '%(DestinationFile)')"
SkipUnchangedFiles="true"
>
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
<!-- Copy assemblies and debug symbols into app bundle's content folder -->
<Copy SourceFiles="@(_FilesToHotRestartContent)"
DestinationFiles="@(_FilesToHotRestartContent -> '$(HotRestartAppContentDir)%(DestinationSubDirectory)%(FileName)%(Extension)')"
SkipUnchangedFiles="true"
Condition="'@(_FilesToHotRestartContent)' != ''">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
<MakeDir Directories="$(HotRestartContentStampDir)"/>
<MakeDir Directories="@(_FilesToHotRestartContent -> '$(HotRestartContentStampDir)%(DestinationSubDirectory)')"/>
<Touch AlwaysCreate="true" Files="@(_FilesToHotRestartContent -> '$(HotRestartContentStampDir)%(DestinationSubDirectory)%(FileName)%(Extension).stamp')" />
<Touch AlwaysCreate="true" Files="$(HotRestartContentStampDir)$(AssemblyName).hotrestartapp.stamp" />
<Touch AlwaysCreate="true" Files="$(HotRestartContentDir)$(AssemblyName).hotrestartapp" />
<Touch AlwaysCreate="true" Files="$(HotRestartAppContentDir)$(AssemblyName).hotrestartapp" />
</Target>
<Target Name="_CopyFrameworksToHotRestartBundle"
<!-- Copy the items in _HotRestartContentDirContents to their destination directory -->
<Target Name="_CopyFilesToHotRestartContentDir"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsAppExtension)' == 'false' And '$(IsHotRestartBuild)' == 'true'"
DependsOnTargets="_CreateHotRestartCachedBundle;_CollectHotRestartDynamicFrameworks"
Inputs="@(_HotRestartFrameworkFiles)"
Outputs="@(_HotRestartFrameworkFiles -> '$(HotRestartSignedAppDir)Frameworks\%(FrameworkDir)%(RecursiveDir)%(Filename)%(Extension)')">
DependsOnTargets="_CreateHotRestartCachedBundle;_ComputeHotRestartBundleContents"
Inputs="@(_HotRestartContentDirContents)"
Outputs="@(_HotRestartContentDirContents -> '%(DestinationFile)')">
<!-- Copy frameworks -->
<Copy SourceFiles="@(_HotRestartFrameworkFiles)"
DestinationFiles="@(_HotRestartFrameworkFiles -> '$(HotRestartAppBundlePath)\Frameworks\%(FrameworkDir)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Condition="'@(_HotRestartFrameworkFiles)' != ''">
<Copy
SourceFiles="@(_HotRestartContentDirContents)"
DestinationFiles="@(_HotRestartContentDirContents -> '%(DestinationFile)')"
SkipUnchangedFiles="true"
>
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
<!-- Copy the items in _HotRestartAppContentDirContents to their destination directory -->
<Target Name="_CopyFilesToHotRestartAppContentDir"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsAppExtension)' == 'false' And '$(IsHotRestartBuild)' == 'true'"
DependsOnTargets="_CreateHotRestartCachedBundle;_ComputeHotRestartBundleContents"
Inputs="@(_HotRestartAppContentDirContents)"
Outputs="@(_HotRestartAppContentDirContents -> '%(DestinationFile)')">
<Copy
SourceFiles="@(_HotRestartAppContentDirContents)"
DestinationFiles="@(_HotRestartAppContentDirContents -> '%(DestinationFile)')"
SkipUnchangedFiles="true"
>
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
@ -309,16 +204,21 @@
<_CodeSignHotRestartInputs Include="$(AppBundleManifest)" Outputs="$(HotRestartSignedAppDir)$([System.IO.Path]::GetFileName('$(AppBundleManifest)'))" />
<_CodeSignHotRestartInputs Include="$(CodesignEntitlements)" Outputs="$(HotRestartSignedAppDir)$(CodesignEntitlements)" />
<_CodeSignHotRestartInputs Include="$(_ProvisioningProfilePath)" Outputs="$(HotRestartSignedAppDir)embedded.mobileprovision" />
<_CodeSignHotRestartInputs Include="@(_HotRestartFrameworkFiles)" Outputs="$(HotRestartAppBundlePath)\Frameworks\%(_HotRestartFrameworkFiles.FrameworkDir)%(RecursiveDir)%(Filename)%(Extension)" />
<_CodeSignHotRestartInputs Include="@(_HotRestartSignedAppDirContents)" Outputs="%(_HotRestartSignedAppDirContents.DestinationFile)" />
<_CodeSignHotRestartInputs Include="$(HotRestartAppBundlePath)\Extracted" Outputs="$(HotRestartSignedAppDir)Extracted" />
</ItemGroup>
</Target>
<PropertyGroup>
<_CreateHotRestartOutputBundleDependsOn>
_CreateHotRestartCachedBundle;
_UnpackLibraryResources;
_ComputeHotRestartBundleContents;
_CopyHotRestartBundleResources;
_CopyFilesToHotRestartSignedAppDirContents;
_CopyFilesToHotRestartContentDir;
_CopyFilesToHotRestartAppContentDir;
_CodesignHotRestartAppBundle;
_CopyFilesToHotRestartBundle;
_CopyFilesToHotRestartContent;
</_CreateHotRestartOutputBundleDependsOn>
</PropertyGroup>
@ -327,7 +227,7 @@
<Target Name="_CodesignHotRestartAppBundle"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsAppExtension)' == 'false' And '$(IsHotRestartBuild)' == 'true' And '$(EnableCodeSigning)' != 'false'"
DependsOnTargets="_CreateHotRestartCachedBundle;_CopyFrameworksToHotRestartBundle;_CollectCodeSignHotRestartInputs"
DependsOnTargets="_CreateHotRestartCachedBundle;_CollectCodeSignHotRestartInputs"
Inputs="@(_CodeSignHotRestartInputs)"
Outputs="@(_CodeSignHotRestartInputs -> '%(Outputs)')">

Просмотреть файл

@ -43,6 +43,9 @@
<None Include="$(PkgXamarin_iOS_HotRestart_Client)\lib\netstandard2.0\Xamarin.iOS.Windows.Client.pdb" CopyToOutputDirectory="PreserveNewest" />
<None Include="$(PkgSystem_Diagnostics_Tracer)\lib\netstandard1.3\System.Diagnostics.Tracer.pdb" CopyToOutputDirectory="PreserveNewest" />
<Compile Include="../Versions.ios.g.cs" />
<Compile Include="..\Xamarin.MacDev.Tasks\PublishFolderType.cs">
<Link>PublishFolderType.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Tasks\" />