Skip to content

Commit aaba219

Browse files
authored
Merge pull request #396 from jlaanstra/user/jlaans/395
Fix case where dependent target, needed to evaluate condition, is skipped because condition is false.
2 parents 6a44537 + 785285c commit aaba219

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

nuget/Microsoft.Windows.CppWinRT.targets

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
2929
<CppWinRTEnableComponentProjection Condition="'$(CppWinRTEnableComponentProjection)' == ''">true</CppWinRTEnableComponentProjection>
3030
<CppWinRTEnablePlatformProjection Condition="'$(CppWinRTEnablePlatformProjection)' == ''">true</CppWinRTEnablePlatformProjection>
3131
<CppWinRTEnableReferenceProjection Condition="'$(CppWinRTEnableReferenceProjection)' == ''">true</CppWinRTEnableReferenceProjection>
32-
32+
3333
<GeneratedFilesDir Condition="'$(GeneratedFilesDir)' == ''">$(IntDir)Generated Files\</GeneratedFilesDir>
3434
<!--Override SDK's uap.props setting to ensure version-matched headers-->
3535
<CppWinRT_IncludePath>$(GeneratedFilesDir)</CppWinRT_IncludePath>
@@ -219,9 +219,11 @@ Copyright (C) Microsoft Corporation. All rights reserved.
219219
<Message Text="CppWinRTDynamicProjectWinMDReferences: @(CppWinRTDynamicProjectWinMDReferences->'%(WinMDPath)')" Importance="$(CppWinRTVerbosity)"/>
220220
</Target>
221221

222+
<Target Name="CppWinRTResolveReferences" DependsOnTargets="GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTProjectWinMDReferences;$(CppWinRTResolveReferencesDependsOn)" />
223+
222224
<!-- Calculates the input files and metadata directories to be passed to MdMerge -->
223225
<Target Name="GetCppWinRTMdMergeInputs"
224-
DependsOnTargets="CppWinRTComputeXamlGeneratedMidlInputs;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTProjectWinMDReferences;"
226+
DependsOnTargets="CppWinRTComputeXamlGeneratedMidlInputs;CppWinRTResolveReferences;"
225227
Returns="@(CppWinRTMdMergeMetadataDirectories);@(CppWinRTMdMergeInputs)">
226228
<ItemGroup>
227229
<_MdMergeInputs Remove="@(_MdMergeInputs)"/>
@@ -248,6 +250,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
248250
</Target>
249251

250252
<!-- Adds the XamlMetadataProvider idl to the Midl itemgroup, if building any xaml content -->
253+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
251254
<Target Name="CppWinRTComputeXamlGeneratedMidlInputs"
252255
DependsOnTargets="$(CppWinRTComputeXamlGeneratedMidlInputsDependsOn)"
253256
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT' and '$(CppWinRTAddXamlMetaDataProviderIdl)' == 'true'">
@@ -265,6 +268,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
265268
</Target>
266269

267270
<!-- Adds the XamlMetadataProvider cpp to the ClCompile itemgroup, if building any xaml content -->
271+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
268272
<Target Name="CppWinRTComputeXamlGeneratedCompileInputs"
269273
DependsOnTargets="$(CppWinRTComputeXamlGeneratedCompileInputsDependsOn)"
270274
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT' and '$(CppWinRTAddXamlMetaDataProviderIdl)' == 'true'">
@@ -402,6 +406,7 @@ $(XamlMetaDataProviderPch)
402406
</Target>
403407

404408
<!-- Build the platform projection from the winmds that sip with the platform in the Windows SDK -->
409+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
405410
<Target Name="CppWinRTMakePlatformProjection"
406411
Condition="'$(CppWinRTEnablePlatformProjection)' == 'true' AND '$(CppWinRTOverrideSDKReferences)' != 'true'"
407412
DependsOnTargets="GetCppWinRTPlatformWinMDInputs;$(CppWinRTMakePlatformProjectionDependsOn)"
@@ -431,9 +436,10 @@ $(XamlMetaDataProviderPch)
431436
</Target>
432437

433438
<!--Build reference projection from WinMD project references and dynamic library project references-->
439+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
434440
<Target Name="CppWinRTMakeReferenceProjection"
435441
Condition="'@(CppWinRTDirectWinMDReferences)@(CppWinRTDynamicProjectWinMDReferences)' != '' AND '$(CppWinRTEnableReferenceProjection)' == 'true'"
436-
DependsOnTargets="GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;$(CppWinRTMakeReferenceProjectionDependsOn)"
442+
DependsOnTargets="$(CppWinRTMakeReferenceProjectionDependsOn)"
437443
Inputs="@(CppWinRTDirectWinMDReferences);@(CppWinRTDynamicProjectWinMDReferences);@(CppWinRTPlatformWinMDReferences)"
438444
Outputs="$(IntDir)cppwinrt_ref.rsp">
439445
<PropertyGroup>
@@ -464,9 +470,10 @@ $(XamlMetaDataProviderPch)
464470
</Target>
465471

466472
<!--Build component projection from project WinMD file and static library project references-->
473+
<!-- Note that Condition is evaluated before DependsOnTargets are run -->
467474
<Target Name="CppWinRTMakeComponentProjection"
468475
Condition="'$(CppWinRTEnableComponentProjection)' == 'true'"
469-
DependsOnTargets="GetCppWinRTProjectWinMDReferences;GetCppWinRTPlatformWinMDReferences;GetCppWinRTDirectWinMDReferences;GetCppWinRTMdMergeInputs;$(CppWinRTMakeComponentProjectionDependsOn)"
476+
DependsOnTargets="GetCppWinRTMdMergeInputs;$(CppWinRTMakeComponentProjectionDependsOn)"
470477
Inputs="@(CppWinRTMdMergeInputs);@(CppWinRTStaticProjectWinMDReferences)"
471478
Outputs="$(IntDir)cppwinrt_comp.rsp">
472479
<PropertyGroup>
@@ -520,7 +527,7 @@ $(XamlMetaDataProviderPch)
520527
<Exec Command="$(CppWinRTCommand)" Condition="'@(_CppwinrtCompInputs)' != ''"/>
521528
</Target>
522529

523-
<Target Name="CppWinRTMakeProjections" DependsOnTargets="CppWinRTMakePlatformProjection;CppWinRTMakeReferenceProjection;CppWinRTMakeComponentProjection;$(CppWinRTMakeProjectionsDependsOn)" />
530+
<Target Name="CppWinRTMakeProjections" DependsOnTargets="CppWinRTResolveReferences;CppWinRTMakePlatformProjection;CppWinRTMakeReferenceProjection;CppWinRTMakeComponentProjection;$(CppWinRTMakeProjectionsDependsOn)" />
524531

525532
<!--Add references to all merged project WinMD files for Xaml Compiler-->
526533
<Target Name="CppWinRTAddXamlReferences"
@@ -530,10 +537,10 @@ $(XamlMetaDataProviderPch)
530537
<XamlReferencesToCompile Include="$(OutDir)*.winmd" />
531538
</ItemGroup>
532539
</Target>
533-
540+
534541
<!--Clear merged assembly and set local assembly for Xaml Compiler.
535542
(Note: this can be removed when CppWinRT references are removed from the Xaml targets file.)-->
536-
<Target Name="CppWinRTSetXamlLocalAssembly"
543+
<Target Name="CppWinRTSetXamlLocalAssembly"
537544
Condition="'@(Page)@(ApplicationDefinition)' != '' and '$(XamlLanguage)' == 'CppWinRT'"
538545
DependsOnTargets="$(CppWinRTSetXamlLocalAssemblyDependsOn)">
539546
<PropertyGroup>

0 commit comments

Comments
 (0)