Skip to content

Commit

Permalink
Clean up single task/target implementation, disable Arcade NuGet work…
Browse files Browse the repository at this point in the history
…around, and make implicit SDK imports explicit.
  • Loading branch information
ryalanms committed Dec 10, 2020
1 parent bde2905 commit ee91876
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 795 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
<UsingTask TaskName="Microsoft.Build.Tasks.Windows.FileClassifier" AssemblyFile="$(_PresentationBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.Build.Tasks.Windows.MarkupCompilePass2" AssemblyFile="$(_PresentationBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.Build.Tasks.Windows.GenerateTemporaryTargetAssembly" AssemblyFile="$(_PresentationBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.Build.Tasks.Windows.CompileTemporaryTargetAssembly" AssemblyFile="$(_PresentationBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.Build.Tasks.Windows.CreateTemporaryTargetAssemblyProject" AssemblyFile="$(_PresentationBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.Build.Tasks.Windows.MergeLocalizationDirectives" AssemblyFile="$(_PresentationBuildTasksAssembly)" />

<PropertyGroup>
Expand Down Expand Up @@ -387,6 +385,9 @@

<_CompileTargetNameForLocalType Condition="'$(_CompileTargetNameForLocalType)' == ''">_CompileTemporaryAssembly</_CompileTargetNameForLocalType>

<!-- TODO: Change this to false after test -->
<!-- The updated .NET 5.0.2 GenerateTemporaryTargetAssembly behavior that supports source generators is off by default -->
<IncludePackageReferencesDuringMarkupCompilation Condition="'$(IncludePackageReferencesDuringMarkupCompilation)' != ''">true</IncludePackageReferencesDuringMarkupCompilation>
<_ResolveProjectReferencesTargetName Condition="'$(IncludePackageReferencesDuringMarkupCompilation)' != 'false'">ResolveProjectReferences</_ResolveProjectReferencesTargetName>
<_CompileTemporaryAssemblyDependsOn>BuildOnlySettings;ResolveKeySource;$(_ResolveProjectReferencesTargetName);CoreCompile</_CompileTemporaryAssemblyDependsOn>

Expand Down Expand Up @@ -414,28 +415,24 @@

<Message Text="MSBuildProjectFile is $(MSBuildProjectFile)" Condition="'$(MSBuildTargetsVerbose)' == 'true'" />

<!-- Create the temporary target assembly project name -->
<!-- Create a temporary target assembly project name with a random component. -->
<PropertyGroup Condition="'$(IncludePackageReferencesDuringMarkupCompilation)' != 'false'">
<_ParentProjectName>$([System.IO.Path]::GetFileNameWithoutExtension('$(MSBuildProjectFullPath)'))</_ParentProjectName>
<_ParentProjectExtension>$([System.IO.Path]::GetExtension($(MSBuildProjectFullPath)))</_ParentProjectExtension>
<_TemporaryTargetAssemblyProjectNameNoExtension>$([System.String]::Join("_", "$(_ParentProjectName)", "$([System.IO.Path]::GetFileNameWithoutExtension($([System.IO.Path]::GetRandomFileName())))", "wpftmp"))</_TemporaryTargetAssemblyProjectNameNoExtension>
<_TemporaryTargetAssemblyProjectName>$(_TemporaryTargetAssemblyProjectNameNoExtension)$(_ParentProjectExtension)</_TemporaryTargetAssemblyProjectName>
<_TempProjectNuGetExtensionsPath>$([System.Text.RegularExpressions.Regex]::Replace($(MSBuildProjectExtensionsPath), $(_ParentProjectName), $(_TemporaryTargetAssemblyProjectNameNoExtension), System.Text.RegularExpressions.RegexOptions.IgnoreCase))</_TempProjectNuGetExtensionsPath>
</PropertyGroup>

<!-- Collect the generated NuGet files from the parent project required to support PackageReferences. -->
<ItemGroup Condition="'$(IncludePackageReferencesDuringMarkupCompilation)' != 'false'">
<SourceGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)$(_ParentProjectName)$(_ParentProjectExtension).nuget.g.props"/>
<SourceGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)$(_ParentProjectName)$(_ParentProjectExtension).nuget.g.targets"/>
<SourceGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)$(_ParentProjectName)$(_ParentProjectExtension).nuget.dgspec.json"/>
<SourceGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)project.assets.json"/>
<SourceGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)project.nuget.cache"/>

<DestGeneratedNuGetPropsAndTargets Include="$(_TempProjectNuGetExtensionsPath)$(_TemporaryTargetAssemblyProjectName).nuget.g.props"/>
<DestGeneratedNuGetPropsAndTargets Include="$(_TempProjectNuGetExtensionsPath)$(_TemporaryTargetAssemblyProjectName).nuget.g.targets"/>
<DestGeneratedNuGetPropsAndTargets Include="$(_TempProjectNuGetExtensionsPath)$(_TemporaryTargetAssemblyProjectName).nuget.dgspec.json"/>
<DestGeneratedNuGetPropsAndTargets Include="$(_TempProjectNuGetExtensionsPath)project.assets.json"/>
<DestGeneratedNuGetPropsAndTargets Include="$(_TempProjectNuGetExtensionsPath)project.nuget.cache"/>

<DestGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)$(_TemporaryTargetAssemblyProjectName).nuget.g.props"/>
<DestGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)$(_TemporaryTargetAssemblyProjectName).nuget.g.targets"/>
<DestGeneratedNuGetPropsAndTargets Include="$(MSBuildProjectExtensionsPath)$(_TemporaryTargetAssemblyProjectName).nuget.dgspec.json"/>

</ItemGroup>

<!-- Copy the renamed outer project NuGet props/targets files to the MSBuildProjectExtensionsPath used by NuGet. -->
Expand All @@ -444,22 +441,33 @@
DestinationFiles="@(DestGeneratedNuGetPropsAndTargets)"
/>

<!-- If 'IncludePackageReferencesDuringMarkupCompilation' is 'false', use the legacy .NET Framework/.NET Core 3.1
GenerateTemporaryTargetAssembly path. Otherwise, use new behavior: include and resolve PackageReferences. -->
<!--
Undo TargetFramework append set in Microsoft.NET.RuntimeIdentifierInference.targets to prevent
a duplicate target framework in the IntermediateOutputPath when the new BuildEngine instance runs.
'Append $(TargetFramework) directory to output and intermediate paths to prevent bin clashes between
targets.'
-->

<PropertyGroup Condition="'$(AppendTargetFrameworkToOutputPath)' == 'true' and '$(TargetFramework)' != '' and '$(_UnsupportedTargetFrameworkError)' != 'true'">
<IntermediateOutputPathNoTargetFramework>$([System.Text.RegularExpressions.Regex]::Replace($(IntermediateOutputPath), "$(TargetFramework)\\$",, System.Text.RegularExpressions.RegexOptions.IgnoreCase))</IntermediateOutputPathNoTargetFramework>
</PropertyGroup>

<!-- Use the legacy .NET Framework/.NET Core 3.0 GenerateTemporaryTargetAssembly path if 'IncludePackageReferencesDuringMarkupCompilation' is 'false',. -->
<GenerateTemporaryTargetAssembly
CurrentProject="$(MSBuildProjectFullPath)"
MSBuildBinPath="$(MSBuildBinPath)"
ReferencePathTypeName="ReferencePath"
CompileTypeName="Compile"
GeneratedCodeFiles="@(_GeneratedCodeFiles)"
ReferencePath="@(ReferencePath)"
IntermediateOutputPath="$(IntermediateOutputPath)"
BaseIntermediateOutputPath="$(BaseIntermediateOutputPath)"
IntermediateOutputPath="$(IntermediateOutputPathNoTargetFramework)"
AssemblyName="$(AssemblyName)"
CompileTargetName="$(_CompileTargetNameForLocalType)"
GenerateTemporaryTargetAssemblyDebuggingInformation="$(GenerateTemporaryTargetAssemblyDebuggingInformation)"
IncludePackageReferencesDuringMarkupCompilation="$(IncludePackageReferencesDuringMarkupCompilation)"
Analyzers="$(Analyzers)"
MSBuildProjectExtensionsPath="$(MSBuildProjectExtensionsPath)"
TemporaryTargetAssemblyProjectName="$(_TemporaryTargetAssemblyProjectName)"
>

Expand All @@ -469,7 +477,13 @@
<Output TaskParameter="Include" ItemName="AssemblyForLocalTypeReference" />
</CreateItem>

</Target>
<!-- Remove generated NuGet props/targets files. -->
<Delete
Condition="'$(IncludePackageReferencesDuringMarkupCompilation)' != 'false'
and '$(GenerateTemporaryTargetAssemblyDebuggingInformation)' != 'true'"
Files="@(DestGeneratedNuGetPropsAndTargets)" />

</Target>

<!--
Expand Down
Loading

0 comments on commit ee91876

Please sign in to comment.