[msbuild] Fixes archiving and copying files to Windows (#11277)
* [msbuild] Fixes Windows task namespace * [msbuild] Fixes unzipping files from Windows This is the same approach we're using on the Xamarin.iOS.Tasks project, we need to replace the System.Text.Encoding.CodePages reference assembly by it's runtime implementation before ilmerging it, otherwise when trying to unzip files from Windows we'll get a null ref exception because that's what the ref assembly implemented. * [msbuild] Try to copy output to Windows before ending the XMA connection When relying on BuildDependsOn we can end up running the targets after _SayGoodBye, which ends the XMA connection. `CopyDSYMFromMac` and `CopyAppBundleFromMac` need an active connection, since both copy files from the Mac to Windows. Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
This commit is contained in:
Родитель
94ca4e7a03
Коммит
965ab98b84
|
@ -5,7 +5,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Xamarin.iOS.Tasks.Windows.Properties;
|
using Xamarin.iOS.Tasks.Windows.Properties;
|
||||||
|
|
||||||
namespace Xamarin.iOS.Tasks.Windows.Tasks {
|
namespace Xamarin.iOS.Tasks.Windows {
|
||||||
public class LocalUnzip : Task {
|
public class LocalUnzip : Task {
|
||||||
[Required]
|
[Required]
|
||||||
public string ZipFilePath { get; set; }
|
public string ZipFilePath { get; set; }
|
||||||
|
|
|
@ -53,11 +53,6 @@ Copyright (C) 2011-2013 Xamarin. All rights reserved.
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<BuildDependsOn>
|
|
||||||
$(BuildDependsOn);
|
|
||||||
CopyAppBundleFromMac;
|
|
||||||
CopyDSYMFromMac
|
|
||||||
</BuildDependsOn>
|
|
||||||
<CreateIpaDependsOn>
|
<CreateIpaDependsOn>
|
||||||
$(CreateIpaDependsOn);
|
$(CreateIpaDependsOn);
|
||||||
CopyIpaFromMac
|
CopyIpaFromMac
|
||||||
|
@ -73,7 +68,7 @@ Copyright (C) 2011-2013 Xamarin. All rights reserved.
|
||||||
</ArchiveDependsOn>
|
</ArchiveDependsOn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Target Name="CopyAppBundleFromMac" Condition="'$(OutputType)' == 'Exe' And '$(IsMacEnabled)' == 'true' And '$(CopyAppBundle)' == 'true'">
|
<Target Name="CopyAppBundleFromMac" Condition="'$(OutputType)' == 'Exe' And '$(IsMacEnabled)' == 'true' And '$(CopyAppBundle)' == 'true'" BeforeTargets="BeforeDisconnect">
|
||||||
<!-- Creates AppBundle dir on the output path -->
|
<!-- Creates AppBundle dir on the output path -->
|
||||||
<MakeDir Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true'" SessionId="$(BuildSessionId)" Directories="$(DeviceSpecificOutputPath)AppBundle" />
|
<MakeDir Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true'" SessionId="$(BuildSessionId)" Directories="$(DeviceSpecificOutputPath)AppBundle" />
|
||||||
<!--Zip AppBundle-->
|
<!--Zip AppBundle-->
|
||||||
|
@ -157,7 +152,7 @@ Copyright (C) 2011-2013 Xamarin. All rights reserved.
|
||||||
</CopyLongPaths>
|
</CopyLongPaths>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="CopyDSYMFromMac" DependsOnTargets="_SayHello" Condition="'$(IsMacEnabled)' == 'true' And '$(IsAppExtension)' == 'false' And '$(ComputedPlatform)' == 'iPhone' And '$(CopyDSYM)' == 'true' And ('$(BuildIpa)' == 'true' Or '$(CopyAppBundle)' == 'true')">
|
<Target Name="CopyDSYMFromMac" DependsOnTargets="_SayHello" Condition="'$(IsMacEnabled)' == 'true' And '$(IsAppExtension)' == 'false' And '$(ComputedPlatform)' == 'iPhone' And '$(CopyDSYM)' == 'true' And ('$(BuildIpa)' == 'true' Or '$(CopyAppBundle)' == 'true')" BeforeTargets="BeforeDisconnect">
|
||||||
<!--Copy watchOS Dsym folders from Mac-->
|
<!--Copy watchOS Dsym folders from Mac-->
|
||||||
<MSBuild Projects="@(_WatchAppReferenceWithConfigurationExistent)" Targets="CopyDSYMFromMac" Properties="%(_WatchAppReferenceWithConfigurationExistent.SetConfiguration); %(_WatchAppReferenceWithConfigurationExistent.SetPlatform); BuildIpa=true" Condition="'$(IsWatchApp)' == 'false' And '@(_WatchAppReferenceWithConfigurationExistent)' != '' And '$(_BuildReferencedExtensionProjects)' != 'true'"></MSBuild>
|
<MSBuild Projects="@(_WatchAppReferenceWithConfigurationExistent)" Targets="CopyDSYMFromMac" Properties="%(_WatchAppReferenceWithConfigurationExistent.SetConfiguration); %(_WatchAppReferenceWithConfigurationExistent.SetPlatform); BuildIpa=true" Condition="'$(IsWatchApp)' == 'false' And '@(_WatchAppReferenceWithConfigurationExistent)' != '' And '$(_BuildReferencedExtensionProjects)' != 'true'"></MSBuild>
|
||||||
<!--Look for all *.dsym folders int the output path of the main app -->
|
<!--Look for all *.dsym folders int the output path of the main app -->
|
||||||
|
|
|
@ -42,4 +42,23 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Import Project="$(MSBuildThisFileDirectory)..\ILMerge.targets" />
|
<Import Project="$(MSBuildThisFileDirectory)..\ILMerge.targets" />
|
||||||
|
|
||||||
|
<!-- Replaces the reference assemblies by the runtime implementation -->
|
||||||
|
<Target Name="CopyRuntimeAssemblies" BeforeTargets="ILRepack">
|
||||||
|
<ItemGroup>
|
||||||
|
<ReferenceCopyLocalToRemove Include="@(ReferenceCopyLocalPaths)" Condition="'%(FileName)' == 'System.Text.Encoding.CodePages'" />
|
||||||
|
|
||||||
|
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalToRemove)" />
|
||||||
|
|
||||||
|
<ReferencePathToRemove Include="@(ReferencePath)" Condition="'%(FileName)' == 'System.Text.Encoding.CodePages'" />
|
||||||
|
|
||||||
|
<ReferencePath Remove="@(ReferencePathToRemove)" />
|
||||||
|
|
||||||
|
<ReferencePathToAdd Include="@(RuntimeTargetsCopyLocalItems)" Condition="'%(RuntimeIdentifier)' == 'win' And '%(FileName)' == 'System.Text.Encoding.CodePages'" />
|
||||||
|
|
||||||
|
<ReferencePath Include="@(ReferencePathToAdd)">
|
||||||
|
<DestinationSubDirectory />
|
||||||
|
</ReferencePath>
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче