-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[release/6.0] Work around dotnet/msbuild#3274 #39293
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
[release/6.0] Work around dotnet/msbuild#3274 #39293
Conversation
- `cherry-pick` of e2707e1 Work around dotnet/msbuild#3274 - #38547 - handle a ApiDescription.Client code generator that uses `%(OutputPath)` as a directory - see also <https://stackoverflow.com/questions/48868060/can-a-task-itemgroup-glob-files> - add tests for Microsoft.Extensions.ApiDescription.Client.targets - make `TemporaryCSharpProject` slightly extensible - allow project additions to `TemporaryDirectory` after `Create()` nits: - add comment about batching w/ a code generator that uses `%(OutputPath)` as a directory - fix `%(SourceDocument)` metadata - primarily for back-tracing in detailed / binary logs - remove useless `%(OutputPathExtension)` metadata; use `%(Extension)` - remove useless `ConsoleClient` test asset project Handle symbolic links in `TemporaryDirectory` - e.g. on macOS /var/folders resolves to /private/var/folders
|
Hi @dougbu. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document. |
| <!-- Otherwise, add all descendant files with the expected extension. --> | ||
| <TypeScriptCompile Include="@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx')" | ||
| Exclude="@(TypeScriptCompile)"> | ||
| <SourceDocument>%(_Directories.FullPath)</SourceDocument> | ||
| </TypeScriptCompile> | ||
| <!-- | ||
| Otherwise, add all descendant files with the expected extension. Glob into _Directories before updating | ||
| TypeScriptCompile or Compile items. See <https://github.com/dotnet/msbuild/issues/3274> and workaround in | ||
| <https://stackoverflow.com/questions/48868060/can-a-task-itemgroup-glob-files>. Unfortunately, this workaround | ||
| loses SourceDocument and other metadata. | ||
| --> | ||
| <PropertyGroup> | ||
| <_TypeScriptCompileItemsFromDirectories>@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx')</_TypeScriptCompileItemsFromDirectories> | ||
| <_CompileItemsFromDirectories>@(_Directories -> '%(Identity)/**/*$(DefaultLanguageSourceExtension)')</_CompileItemsFromDirectories> | ||
| </PropertyGroup> | ||
|
|
||
| <Compile Include="@(_Directories -> '%(Identity)/**/*.$(DefaultLanguageSourceExtension)')" | ||
| <ItemGroup> | ||
| <TypeScriptCompile Include="$(_TypeScriptCompileItemsFromDirectories)" Exclude="@(TypeScriptCompile)" /> | ||
|
|
||
| <Compile Include="$(_CompileItemsFromDirectories)" | ||
| Exclude="@(Compile)" | ||
| Condition="'$(DefaultLanguageSourceExtension)' != '.ts'"> | ||
| <SourceDocument>%(_Directories.FullPath)</SourceDocument> | ||
| </Compile> | ||
| Condition="'$(DefaultLanguageSourceExtension)' != '.ts'" /> | ||
|
|
||
| <FileWrites Exclude="@(FileWrites)" | ||
| Include="@(_Files);@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx;%(Identity)/**/*.$(DefaultLanguageSourceExtension)')" /> | ||
| <FileWrites Include="@(_Files);$(_TypeScriptCompileItemsFromDirectories);$(_CompileItemsFromDirectories)" | ||
| Exclude="@(FileWrites)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines contain the core fix. Is it necessary to remove fixes for "nits" mentioned in PR description❔ I was hoping to avoid that extra work and lean toward keeping the branches consistent, especially in cases where the changes to src files remain narrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm cooling with keeping the nits. I think they make this code a little clearer.
|
Hi @dougbu. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge. To learn more about how to prepare a servicing PR click here. |
|
@rafikiassumani-msft could you please review or have someone review this PR❔ |
...xtensions.ApiDescription.Client/test/Microsoft.Extensions.ApiDescription.Client.Tests.csproj
Show resolved
Hide resolved
| Condition="$([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))"> | ||
| <OutputPathExtension>$([System.IO.Path]::GetExtension('%(OpenApiReference.OutputPath)'))</OutputPathExtension> | ||
| </_Files> | ||
| Condition="$([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great cleanup here!
...xtensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets
Show resolved
Hide resolved
| <!-- Otherwise, add all descendant files with the expected extension. --> | ||
| <TypeScriptCompile Include="@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx')" | ||
| Exclude="@(TypeScriptCompile)"> | ||
| <SourceDocument>%(_Directories.FullPath)</SourceDocument> | ||
| </TypeScriptCompile> | ||
| <!-- | ||
| Otherwise, add all descendant files with the expected extension. Glob into _Directories before updating | ||
| TypeScriptCompile or Compile items. See <https://github.com/dotnet/msbuild/issues/3274> and workaround in | ||
| <https://stackoverflow.com/questions/48868060/can-a-task-itemgroup-glob-files>. Unfortunately, this workaround | ||
| loses SourceDocument and other metadata. | ||
| --> | ||
| <PropertyGroup> | ||
| <_TypeScriptCompileItemsFromDirectories>@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx')</_TypeScriptCompileItemsFromDirectories> | ||
| <_CompileItemsFromDirectories>@(_Directories -> '%(Identity)/**/*$(DefaultLanguageSourceExtension)')</_CompileItemsFromDirectories> | ||
| </PropertyGroup> | ||
|
|
||
| <Compile Include="@(_Directories -> '%(Identity)/**/*.$(DefaultLanguageSourceExtension)')" | ||
| <ItemGroup> | ||
| <TypeScriptCompile Include="$(_TypeScriptCompileItemsFromDirectories)" Exclude="@(TypeScriptCompile)" /> | ||
|
|
||
| <Compile Include="$(_CompileItemsFromDirectories)" | ||
| Exclude="@(Compile)" | ||
| Condition="'$(DefaultLanguageSourceExtension)' != '.ts'"> | ||
| <SourceDocument>%(_Directories.FullPath)</SourceDocument> | ||
| </Compile> | ||
| Condition="'$(DefaultLanguageSourceExtension)' != '.ts'" /> | ||
|
|
||
| <FileWrites Exclude="@(FileWrites)" | ||
| Include="@(_Files);@(_Directories -> '%(Identity)/**/*.ts;%(Identity)/**/*.tsx;%(Identity)/**/*.$(DefaultLanguageSourceExtension)')" /> | ||
| <FileWrites Include="@(_Files);$(_TypeScriptCompileItemsFromDirectories);$(_CompileItemsFromDirectories)" | ||
| Exclude="@(FileWrites)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm cooling with keeping the nits. I think they make this code a little clearer.
[release/6.0] Work around dotnet/msbuild#3274
Description
cherry-pickof e2707e1%(OutputPath)as a directoryTemporaryCSharpProjectslightly extensibleTemporaryDirectoryafterCreate()nits:
%(OutputPath)as a directory%(SourceDocument)metadata%(OutputPathExtension)metadata; use%(Extension)ConsoleClienttest asset projectHandle symbolic links in
TemporaryDirectoryCustomer impact
Without this change, customers cannot use OpenAPI code generators that generate multiple files. @darrelmiller reported #38547 for once such code generator but others exist or could exist soon-ish.
Regression
No, this problem wasn't noticed in the past due to inadequate testing i.e. we mainly focused on the NSwag code generator which generates a single file per OpenAPI document.
Risk
Very low. Using the recommended workaround for a known
msbuildproblem.Verification
Both manual and automated testing. In fact, added a lot of missing integration tests covering many scenarios that were previously missed. (Previous automated tests mostly ignored our .targets files.)
Packaging changes reviewed?
N/A