Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msbuild] Share the _*Metal tasks between Xamarin.iOS and Xamarin.Mac. #9786

Merged
merged 1 commit into from
Oct 6, 2020
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
52 changes: 0 additions & 52 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -187,58 +187,6 @@ Copyright (C) 2014 Xamarin. All rights reserved.
</CodesignVerify>
</Target>

<Target Name="_SmeltMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(Metal)' != ''" DependsOnTargets="_DetectSdkLocations;_ComputeTargetFrameworkMoniker;_GetMinimumOSVersion">
<Metal
Condition="'$(IsMacEnabled)' == 'true' and '%(Metal.Identity)' != ''"
SessionId="$(BuildSessionId)"
IntermediateOutputPath="$(IntermediateOutputPath)"
MinimumOSVersion="$(_MinimumOSVersion)"
ProjectDir="$(MSBuildProjectDirectory)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
ResourcePrefix="$(_ResourcePrefix)"
SdkDevPath="$(_SdkDevPath)"
SdkIsSimulator="false"
SdkRoot="$(_SdkRoot)"
SdkVersion="$(_SdkVersion)"
SourceFile="@(Metal)">
<Output TaskParameter="OutputFile" ItemName="_SmeltedMetal" />
</Metal>
</Target>

<Target Name="_ForgeMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(_SmeltedMetal)' != ''" DependsOnTargets="_SmeltMetal"
Inputs="@(_SmeltedMetal)" Outputs="$(IntermediateOutputPath)metal\default.metal-ar">
<ArTool
Condition="'$(IsMacEnabled)' == 'true' and '$(_IsXcode8)' == 'false'"
SessionId="$(BuildSessionId)"
Items="@(_SmeltedMetal)"
Archive="$(IntermediateOutputPath)metal\default.metal-ar">
</ArTool>

<!-- If !Xcode8 -->
<CreateItem Include="$(IntermediateOutputPath)metal\default.metal-ar"
Condition="'$(_IsXcode8)' == 'false'">
<Output TaskParameter="Include" ItemName="_ForgedMetal" />
</CreateItem>

<!-- Else -->
<CreateItem Include="@(_SmeltedMetal)"
Condition="'$(_IsXcode8)' == 'true'">
<Output TaskParameter="Include" ItemName="_ForgedMetal" />
</CreateItem>
</Target>

<Target Name="_TemperMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(_ForgedMetal)' != ''" DependsOnTargets="_ForgeMetal"
Inputs="@(_ForgedMetal)" Outputs="$(_AppBundlePath)default.metallib">
<MetalLib
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
Items="@(_ForgedMetal)"
SdkDevPath="$(_SdkDevPath)"
SdkRoot="$(_SdkRoot)"
OutputLibrary="$(_AppBundlePath)Contents\Resources\default.metallib">
</MetalLib>
</Target>

<Target Name="_CompileTextureAtlases" DependsOnTargets="_DetectAppManifest;_DetectSdkLocations;_CoreCompileTextureAtlases" />

<Target Name="_CoreCompileTextureAtlases">
Expand Down
45 changes: 45 additions & 0 deletions msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,51 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<CreatePkgInfo SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" OutputPath="$(_PkgInfoPath)" />
</Target>

<Target Name="_SmeltMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(Metal)' != ''" DependsOnTargets="_DetectSdkLocations;_ComputeTargetFrameworkMoniker;_GetMinimumOSVersion">
<Metal
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' and '%(Metal.Identity)' != ''"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
MinimumOSVersion="$(_MinimumOSVersion)"
ProjectDir="$(MSBuildProjectDirectory)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
ResourcePrefix="$(_ResourcePrefix)"
SdkDevPath="$(_SdkDevPath)"
SdkIsSimulator="$(_SdkIsSimulator)"
SdkRoot="$(_SdkRoot)"
SdkVersion="$(_SdkVersion)"
SourceFile="@(Metal)">
<Output TaskParameter="OutputFile" ItemName="_SmeltedMetal" />
</Metal>
</Target>

<Target Name="_ForgeMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(_SmeltedMetal)' != ''" DependsOnTargets="_SmeltMetal"
Inputs="@(_SmeltedMetal)" Outputs="$(DeviceSpeficicIntermediateOutputPath)metal\default.metal-ar">
<ArTool
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' and '$(_IsXcode8)' == 'false'"
Items="@(_SmeltedMetal)"
Archive="$(DeviceSpecificIntermediateOutputPath)metal\default.metal-ar">
</ArTool>

<ItemGroup>
<_ForgedMetal Condition="'$(_IsXcode8)' == 'false'" Include="$(DeviceSpecificIntermediateOutputPath)metal\default.metal-ar" />
<_ForgedMetal Condition="'$(_IsXcode8)' == 'true'" Include="@(_SmeltedMetal)" />
</ItemGroup>
</Target>

<Target Name="_TemperMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(_ForgedMetal)' != ''" DependsOnTargets="_ForgeMetal;_GenerateBundleName"
Inputs="@(_ForgedMetal)" Outputs="$(_AppResourcesPath)default.metallib">
<MetalLib
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Items="@(_ForgedMetal)"
SdkDevPath="$(_SdkDevPath)"
SdkRoot="$(_SdkRoot)"
OutputLibrary="$(_AppResourcesPath)default.metallib">
</MetalLib>
</Target>

<Target Name="_DetectAppManifest">
<!--
This targets runs for Library projects as well, so that Library
Expand Down
52 changes: 0 additions & 52 deletions msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -307,58 +307,6 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
/>
</Target>

<Target Name="_SmeltMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(Metal)' != ''" DependsOnTargets="_DetectSdkLocations;_ComputeTargetFrameworkMoniker;_GetMinimumOSVersion">
<Metal
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' and '%(Metal.Identity)' != ''"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
MinimumOSVersion="$(_MinimumOSVersion)"
ProjectDir="$(MSBuildProjectDirectory)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
ResourcePrefix="$(_ResourcePrefix)"
SdkDevPath="$(_SdkDevPath)"
SdkIsSimulator="$(_SdkIsSimulator)"
SdkRoot="$(_SdkRoot)"
SdkVersion="$(_SdkVersion)"
SourceFile="@(Metal)">
<Output TaskParameter="OutputFile" ItemName="_SmeltedMetal" />
</Metal>
</Target>

<Target Name="_ForgeMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(_SmeltedMetal)' != ''" DependsOnTargets="_SmeltMetal"
Inputs="@(_SmeltedMetal)" Outputs="$(DeviceSpeficicIntermediateOutputPath)metal\default.metal-ar">
<ArTool
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' and '$(_IsXcode8)' == 'false'"
Items="@(_SmeltedMetal)"
Archive="$(DeviceSpecificIntermediateOutputPath)metal\default.metal-ar">
</ArTool>

<!-- If !Xcode8 -->
<CreateItem Include="$(DeviceSpecificIntermediateOutputPath)metal\default.metal-ar"
Condition="'$(_IsXcode8)' == 'false'">
<Output TaskParameter="Include" ItemName="_ForgedMetal" />
</CreateItem>

<!-- Else -->
<CreateItem Include="@(_SmeltedMetal)"
Condition="'$(_IsXcode8)' == 'true'">
<Output TaskParameter="Include" ItemName="_ForgedMetal" />
</CreateItem>
</Target>

<Target Name="_TemperMetal" Condition="'$(_CanOutputAppBundle)' == 'true' And '@(_ForgedMetal)' != ''" DependsOnTargets="_ForgeMetal"
Inputs="@(_ForgedMetal)" Outputs="$(_AppBundlePath)default.metallib">
<MetalLib
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Items="@(_ForgedMetal)"
SdkDevPath="$(_SdkDevPath)"
SdkRoot="$(_SdkRoot)"
OutputLibrary="$(_AppBundlePath)default.metallib">
</MetalLib>
</Target>

<Target Name="_GenerateBundleName" Condition="'$(_CanOutputAppBundle)' == 'true'" DependsOnTargets="_ComputeTargetArchitectures;_GenerateAppBundleName;_GenerateAppExBundleName">
<PropertyGroup>
<_AppResourcesPath>$(_AppBundlePath)</_AppResourcesPath>
Expand Down