|
69 | 69 | <Output ItemName="_StrideGraphicsApisItems" TaskParameter="TargetOutputs" /> |
70 | 70 | </MSBuild> |
71 | 71 |
|
72 | | - <!-- Create one inner build per TFM x API combination --> |
| 72 | + <!-- Create one inner build per TFM (single-API) or per TFMxAPI (multi-API). |
| 73 | + StrideGraphicsApi is only added to AdditionalProperties in multi-API mode; in single-API |
| 74 | + mode the inner evaluates it from StrideGraphicsApis locally, keeping the cache key |
| 75 | + identical to transitive dispatches (which can't reliably propagate it via SetTargetFramework). --> |
73 | 76 | <ItemGroup Condition="'$(StrideGraphicsApiDependent)' == 'true'"> |
74 | 77 | <_TargetFrameworkWithStrideGraphicsApi Include="@(_StrideGraphicsApisItems->'%(OriginalItemSpec)')" StrideGraphicsApi="%(_StrideGraphicsApisItems.Identity)" /> |
75 | 78 | <_InnerBuildProjects Include="$(MSBuildProjectFile)"> |
76 | 79 | <AdditionalProperties Condition="'%(_TargetFrameworkWithStrideGraphicsApi.StrideGraphicsApiDependent)' != 'true'">TargetFramework=%(_TargetFrameworkWithStrideGraphicsApi.TargetFramework)</AdditionalProperties> |
77 | | - <AdditionalProperties Condition="'%(_TargetFrameworkWithStrideGraphicsApi.StrideGraphicsApiDependent)' == 'true'">TargetFramework=%(_TargetFrameworkWithStrideGraphicsApi.TargetFramework);StrideGraphicsApi=%(_TargetFrameworkWithStrideGraphicsApi.StrideGraphicsApi)</AdditionalProperties> |
| 80 | + <AdditionalProperties Condition="'%(_TargetFrameworkWithStrideGraphicsApi.StrideGraphicsApiDependent)' == 'true' And '$(StrideGraphicsApiDependentBuildAll)' != 'true'">TargetFramework=%(_TargetFrameworkWithStrideGraphicsApi.TargetFramework)</AdditionalProperties> |
| 81 | + <AdditionalProperties Condition="'%(_TargetFrameworkWithStrideGraphicsApi.StrideGraphicsApiDependent)' == 'true' And '$(StrideGraphicsApiDependentBuildAll)' == 'true'">TargetFramework=%(_TargetFrameworkWithStrideGraphicsApi.TargetFramework);StrideGraphicsApi=%(_TargetFrameworkWithStrideGraphicsApi.StrideGraphicsApi)</AdditionalProperties> |
78 | 82 | </_InnerBuildProjects> |
79 | 83 | </ItemGroup> |
80 | 84 | </Target> |
81 | 85 |
|
82 | 86 | <!-- ================================================================ --> |
83 | 87 | <!-- Project reference Graphics API propagation --> |
84 | 88 | <!-- ================================================================ --> |
85 | | - <!-- Detects if referenced projects are StrideGraphicsApiDependent |
86 | | - and injects StrideGraphicsApi into their SetTargetFramework. |
87 | | - For non-dependent references, removes StrideGraphicsApi to |
88 | | - prevent unnecessary rebuilds. --> |
| 89 | + <!-- Detects which referenced projects are StrideGraphicsApiDependent and stamps that |
| 90 | + metadata. Also strips StrideGraphicsApi from all ProjectReferences at evaluation time |
| 91 | + so the singular property never flows through as a global, keeping slnf-direct and |
| 92 | + transitive dispatches on the same project-instance cache key. --> |
89 | 93 | <Target Name="_StrideQueryGraphicsApiDependent" Returns="@(_StrideGraphicsApiDependentItemsInternal)" Condition="'$(StrideProjectType)' != 'Cpp'"> |
90 | 94 | <ItemGroup> |
91 | 95 | <_StrideGraphicsApiDependentItemsInternal Include="stride_fake_graphics_api" StrideGraphicsApiDependent="$(StrideGraphicsApiDependent)" /> |
92 | 96 | </ItemGroup> |
93 | 97 | </Target> |
94 | 98 |
|
95 | | - <!-- Evaluation-time strip so both _GetProjectReferenceTargetFrameworkProperties (the TFM |
96 | | - query) and the main Build dispatch honour it — target-time metadata set in |
97 | | - _StrideProjectReferenceGraphicsApiDependent runs too late for the TFM query. Stripped |
98 | | - unconditionally; API-dependent references re-add StrideGraphicsApi via SetTargetFramework |
99 | | - at target time (see lines below), which is applied as Properties by the dispatcher. --> |
100 | | - <ItemDefinitionGroup> |
| 99 | + <ItemDefinitionGroup Condition="'$(StrideGraphicsApiDependentBuildAll)' != 'true'"> |
101 | 100 | <ProjectReference> |
102 | | - <GlobalPropertiesToRemove>%(ProjectReference.GlobalPropertiesToRemove);StrideGraphicsApi;StrideGraphicsApis;StrideGraphicsApiDependent;StrideGraphicsApiDependentBuildAll;StridePlatform;StridePlatforms;StrideNativeBuildMode;StrideTestRuntimeIdentifier;StrideSkipAutoPack</GlobalPropertiesToRemove> |
| 101 | + <GlobalPropertiesToRemove>%(ProjectReference.GlobalPropertiesToRemove);StrideGraphicsApi</GlobalPropertiesToRemove> |
103 | 102 | </ProjectReference> |
104 | 103 | </ItemDefinitionGroup> |
105 | 104 |
|
|
123 | 122 | <_StrideGraphicsApiCurrent Condition="'$(_StrideGraphicsApiCurrent)' == ''">Direct3D11</_StrideGraphicsApiCurrent> |
124 | 123 | </PropertyGroup> |
125 | 124 | <ItemGroup> |
126 | | - <_MSBuildProjectReferenceExistent Remove="@(_StrideGraphicsApiDependentItems->'%(OriginalItemSpec)')" /> |
127 | | - <_MSBuildProjectReferenceExistent Include="@(_StrideGraphicsApiDependentItems->'%(OriginalItemSpec)')" Condition="'%(_StrideGraphicsApiDependentItems.StrideGraphicsApiDependent)' != 'true'" /> |
128 | | - <_MSBuildProjectReferenceExistent Include="@(_StrideGraphicsApiDependentItems->'%(OriginalItemSpec)')" Condition="'%(_StrideGraphicsApiDependentItems.StrideGraphicsApiDependent)' == 'true'"> |
| 125 | + <!-- Stamp StrideGraphicsApiDependent per ref, then (in multi-API mode only) augment |
| 126 | + API-dep refs so inner-build dispatches match the slnf-direct cache key. In single-API |
| 127 | + mode the singular StrideGraphicsApi is computed locally by the inner from the plural. --> |
| 128 | + <_MSBuildProjectReferenceExistent Update="@(_StrideGraphicsApiDependentItems->'%(OriginalItemSpec)')"> |
129 | 129 | <StrideGraphicsApiDependent>%(_StrideGraphicsApiDependentItems.StrideGraphicsApiDependent)</StrideGraphicsApiDependent> |
| 130 | + </_MSBuildProjectReferenceExistent> |
| 131 | + </ItemGroup> |
| 132 | + <ItemGroup Condition="'$(StrideGraphicsApiDependentBuildAll)' == 'true'"> |
| 133 | + <_MSBuildProjectReferenceExistent Update="@(_MSBuildProjectReferenceExistent)" Condition="'%(_MSBuildProjectReferenceExistent.StrideGraphicsApiDependent)' == 'true'"> |
130 | 134 | <StrideGraphicsApi>$(_StrideGraphicsApiCurrent)</StrideGraphicsApi> |
131 | | - <SetTargetFramework>%(_StrideGraphicsApiDependentItems.SetTargetFramework);StrideGraphicsApi=$(_StrideGraphicsApiCurrent)</SetTargetFramework> |
| 135 | + <SetTargetFramework>%(_MSBuildProjectReferenceExistent.SetTargetFramework);StrideGraphicsApi=$(_StrideGraphicsApiCurrent)</SetTargetFramework> |
132 | 136 | </_MSBuildProjectReferenceExistent> |
133 | 137 | </ItemGroup> |
134 | 138 | </Target> |
|
0 commit comments