Skip to content

Conversation

@dougbu
Copy link
Contributor

@dougbu dougbu commented Dec 22, 2021

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

- #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
@dougbu dougbu requested a review from Pilchie as a code owner December 22, 2021 01:16
@ghost ghost added the area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI label Dec 22, 2021
@dougbu
Copy link
Contributor Author

dougbu commented Dec 22, 2021

@dotnet/aspnet-build mainly including you to double-check my msbuild changes.


<Target Name="_InnerGenerateOpenApiCode" DependsOnTargets="_GetCurrentOpenApiReference;$(GeneratorTarget)" />

<!-- Note target will **always** execute when generator uses the OutputPath as a directory. -->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed while testing other changes. After an email conversation w/ msbuild team, I doubt this will change because directory timestamps aren't updated when files in them are added or changed but docs might be improved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<_Metadata>$(_Metadata) Options: '%(CurrentOpenApiReference.Options)'</_Metadata>
<_Metadata>$(_Metadata) OutputPath: '%(CurrentOpenApiReference.OutputPath)'</_Metadata>
<_Message>@(_Metadata, ' ')</_Message>
<_Lines>@(_HeaderMetadata -> '// %(Identity)', '%0A')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated C# files contain just enough content to compile.

return WithCSharpProject(project);
}

public TemporaryCSharpProject WithCSharpProject(string name, out TemporaryCSharpProject project, string sdk = "Microsoft.NET.Sdk")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overload was fairly silly and completely unused

- e.g. on macOS /var/folders resolves to /private/var/folders
@dougbu dougbu merged commit e2707e1 into dotnet:main Dec 30, 2021
@dougbu dougbu deleted the dougbu/api.description.client.38547 branch December 30, 2021 00:05
@ghost ghost added this to the 7.0-preview1 milestone Dec 30, 2021
@dougbu
Copy link
Contributor Author

dougbu commented Dec 30, 2021

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/aspnetcore/actions/runs/1635791981

@github-actions
Copy link
Contributor

@dougbu backporting to release/6.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: 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()`
Using index info to reconstruct a base tree...
M	src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/Program.cs
M	src/Tools/Shared/TestHelpers/TemporaryCSharpProject.cs
M	src/Tools/Shared/TestHelpers/TemporaryDirectory.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Tools/Shared/TestHelpers/TemporaryDirectory.cs
CONFLICT (content): Merge conflict in src/Tools/Shared/TestHelpers/TemporaryDirectory.cs
Auto-merging src/Tools/Shared/TestHelpers/TemporaryCSharpProject.cs
CONFLICT (content): Merge conflict in src/Tools/Shared/TestHelpers/TemporaryCSharpProject.cs
CONFLICT (modify/delete): src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/Program.cs deleted in 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()` and modified in HEAD. Version HEAD of src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/Program.cs left in tree.
Removing src/Tools/Extensions.ApiDescription.Client/test/TestProjects/ConsoleClient/ConsoleClient.csproj
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 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()`
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAPIReference does not work for SDK generators that create C# output in a folder

2 participants