|
21 | 21 | Do not change %(ReferenceOutputAssembly) if project contains duplicate @(ProjectReference) and
|
22 | 22 | @(OpenApiProjectReference) items.
|
23 | 23 | -->
|
24 |
| - <ProjectReference Include="@(OpenApiProjectReference)" Exclude="@(ProjectReference)" ReferenceOutputAssembly="false" /> |
25 |
| - <ProjectReference Update="@(OpenApiProjectReference)" OpenApiReference="true" /> |
| 24 | + <ProjectReference Include="@(OpenApiProjectReference)" Exclude="@(ProjectReference)"> |
| 25 | + <NoWarn>NU1702</NoWarn> |
| 26 | + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> |
| 27 | + </ProjectReference> |
| 28 | + <ProjectReference Update="@(OpenApiProjectReference)"> |
| 29 | + <OpenApiReference>true</OpenApiReference> |
| 30 | + </ProjectReference> |
26 | 31 | </ItemGroup>
|
27 | 32 |
|
28 | 33 | <Target Name="_CreateOpenApiReferenceItemsForOpenApiProjectReferences"
|
29 | 34 | AfterTargets="ResolveProjectReferences"
|
30 |
| - Condition="'%(ProjectReferenceWithConfiguration.OpenApiReference)' == 'true' AND '$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true'" |
31 |
| - Inputs="%(ProjectReferenceWithConfiguration.Identity)" |
32 |
| - Outputs="<not-a-file !>"> |
33 |
| - <PropertyGroup> |
34 |
| - <_Identity>%(ProjectReferenceWithConfiguration.Identity)</_Identity> |
35 |
| - <_Temporary /> |
36 |
| - </PropertyGroup> |
37 |
| - |
38 |
| - <MSBuild Target="OpenApiGetDocuments" |
39 |
| - Project="$(_Identity)" |
| 35 | + Condition="'$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true'"> |
| 36 | + <ItemGroup> |
| 37 | + <_Temporary Remove="@(_Temporary)" /> |
| 38 | + </ItemGroup> |
| 39 | + |
| 40 | + <MSBuild Targets="OpenApiGetDocuments" |
| 41 | + Projects="@(ProjectReferenceWithConfiguration)" |
| 42 | + Condition="'%(ProjectReferenceWithConfiguration.OpenApiReference)' == 'true'" |
40 | 43 | Properties="%(ProjectReferenceWithConfiguration.SetConfiguration); %(ProjectReferenceWithConfiguration.SetPlatform); %(ProjectReferenceWithConfiguration.SetTargetFramework)"
|
41 | 44 | RebaseOutputs="true"
|
42 | 45 | RemoveProperties="%(ProjectReferenceWithConfiguration.GlobalPropertiesToRemove);TargetFrameworks;RuntimeIdentifier">
|
43 |
| - <Output TaskParameter="TargetOutputs" PropertyName="_Temporary" /> |
| 46 | + <Output TaskParameter="TargetOutputs" ItemName="_Temporary" /> |
44 | 47 | </MSBuild>
|
45 | 48 |
|
46 | 49 | <ItemGroup>
|
47 |
| - <OpenApiProjectReference Update="$(_Identity)"> |
48 |
| - <Documents>$(_Temporary)</Documents> |
49 |
| - </OpenApiProjectReference> |
50 |
| - <OpenApiReference Include="@(OpenApiProjectReference -> '%(Documents)')" Condition="'%(Identity)' == '$(_Identity)'" /> |
| 50 | + <OpenApiReference Include="@(_Temporary)" Exclude="@(OpenApiReference)" RemoveMetadata="FullConfiguration" /> |
| 51 | + <_Temporary Remove="@(_Temporary)" /> |
51 | 52 | </ItemGroup>
|
52 |
| - <PropertyGroup> |
53 |
| - <_Identity /> |
54 |
| - <_Temporary /> |
55 |
| - </PropertyGroup> |
56 | 53 | </Target>
|
57 | 54 |
|
58 | 55 | <!-- OpenApiReference support. -->
|
|
84 | 81 |
|
85 | 82 | <Target Name="_InnerGenerateOpenApiReferenceCode" DependsOnTargets="_GetCurrentOpenApiReference;$(GeneratorTarget)" />
|
86 | 83 |
|
87 |
| - <Target Name="_GenerateOpenApiReferenceCode" Inputs="@(OpenApiReference)" Outputs="%(OutputPath)" |
88 |
| - Condition="$(OpenApiGenerateAtDesignTime) OR ('$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true') OR !Exists('%(OutputPath)')"> |
| 84 | + <Target Name="_GenerateOpenApiReferenceCode" |
| 85 | + Condition="$(OpenApiGenerateAtDesignTime) OR ('$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' == 'true')" |
| 86 | + Inputs="@(OpenApiReference)" |
| 87 | + Outputs="%(OutputPath)"> |
89 | 88 | <MSBuild BuildInParallel="$(BuildInParallel)"
|
90 | 89 | Projects="$(MSBuildProjectFullPath)"
|
91 | 90 | Properties="GeneratorTargetPath=%(OpenApiReference.OutputPath);GeneratorTarget=Generate%(CodeGenerator);GeneratorMetadata=%(SerializedMetadata)"
|
|
105 | 104 | Condition="Exists('%(OpenApiReference.OutputPath)') AND ! $([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))" />
|
106 | 105 |
|
107 | 106 | <!-- If OutputPath is a file, add it directly to relevant items. -->
|
108 |
| - <TypeScriptCompile Remove="@(_Files)" Condition="'%(_Files.OutputPathExtension)' == '.ts'" /> |
109 |
| - <TypeScriptCompile Include="@(_Files)" Condition="'%(_Files.OutputPathExtension)' == '.ts'"> |
| 107 | + <TypeScriptCompile Include="@(_Files)" |
| 108 | + Exclude="@(TypeScriptCompile)" |
| 109 | + Condition="'%(_Files.OutputPathExtension)' == '.ts' OR '%(_Files.OutputPathExtension)' == '.tsx'"> |
110 | 110 | <SourceDocument>%(_Files.FullPath)</SourceDocument>
|
111 | 111 | </TypeScriptCompile>
|
112 | 112 |
|
113 |
| - <Compile Remove="@(_Files)" |
114 |
| - Condition="'$(DefaultLanguageSourceExtension)' != '.ts' AND '%(_Files.OutputPathExtension)' == '$(DefaultLanguageSourceExtension)'" /> |
115 | 113 | <Compile Include="@(_Files)"
|
| 114 | + Exclude="@(Compile)" |
116 | 115 | Condition="'$(DefaultLanguageSourceExtension)' != '.ts' AND '%(_Files.OutputPathExtension)' == '$(DefaultLanguageSourceExtension)'">
|
117 | 116 | <SourceDocument>%(OpenApiReference.FullPath)</SourceDocument>
|
118 | 117 | </Compile>
|
119 | 118 |
|
120 | 119 | <!-- Otherwise, add all descendant files with the expected extension. -->
|
121 |
| - <TypeScriptCompile Remove="@(_Directories -> '%(Identity)/**/*.ts')" /> |
122 |
| - <TypeScriptCompile Include="@(_Directories -> '%(Identity)/**/*.ts')"> |
| 120 | + <TypeScriptCompile Include="@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx')" |
| 121 | + Exclude="@(TypeScriptCompile)"> |
123 | 122 | <SourceDocument>%(_Directories.FullPath)</SourceDocument>
|
124 | 123 | </TypeScriptCompile>
|
125 | 124 |
|
126 |
| - <Compile Remove="@(_Directories -> '%(Identity)/**/*.$(DefaultLanguageSourceExtension)')" |
127 |
| - Condition="'$(DefaultLanguageSourceExtension)' != '.ts'" /> |
128 | 125 | <Compile Include="@(_Directories -> '%(Identity)/**/*.$(DefaultLanguageSourceExtension)')"
|
| 126 | + Exclude="@(Compile)" |
129 | 127 | Condition="'$(DefaultLanguageSourceExtension)' != '.ts'">
|
130 | 128 | <SourceDocument>%(_Directories.FullPath)</SourceDocument>
|
131 | 129 | </Compile>
|
|
0 commit comments