-
Notifications
You must be signed in to change notification settings - Fork 340
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
Migrate GenerateFileFromTemplate to Microsoft.DotNet.Build.Tasks.Templating #7403
Conversation
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.
My comments are all nits but I would like to hear from @alexperovich and / or @markwilkie before we merge.
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/MSBuildListSplitter.cs
Outdated
Show resolved
Hide resolved
/fyi @rainersigwald (re dotnet/msbuild#4018) @ericstj (re #204) @ilyas1974 and @ViktorHofer (re tail end of #135) |
@rainersigwald this migrationf from aspnet/BuildTools reminds me of a rather unrelated question: Why is the |
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
It was needed there first. I am not opposed in principle to "promoting" it. |
Great to see progress on this 👍 Does one task justify an additional assembly and with it package? Why not add it to the Arcade.Sdk project instead? |
src/Microsoft.DotNet.Build.Tasks.Templating/build/Microsoft.DotNet.Build.Tasks.Templating.props
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/build/Microsoft.DotNet.Build.Tasks.Templating.props
Outdated
Show resolved
Hide resolved
That's the implementation that we use in dotnet/runtime: https://github.com/dotnet/runtime/blob/main/src/tasks/installer.tasks/GenerateRunScript.cs which looks simpler. Wouldn't that suffice? |
@ViktorHofer it was mentioned that this task shouldn't be included in the SDK: #204 (comment) so we decided to create a task package instead. As for comparison between GenerateRunScript.cs, this task is more general and can be used to substitute a user specified set of properties instead of just the specific |
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
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.
LGTM. What about tests? :)
There were no tests in the original implementation, maybe we should not block on that in this PR and file followup to add tests? |
Sure, works for me. |
src/Microsoft.DotNet.Build.Tasks.Templating/Microsoft.DotNet.Build.Tasks.Templating.csproj
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Build.Tasks.Templating/Microsoft.DotNet.Build.Tasks.Templating.csproj
Outdated
Show resolved
Hide resolved
…tNet.Build.Tasks.Templating.props Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com> Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
76b2505
to
ceaa936
Compare
Hey all, I've addressed the style guidelines and other feedback. |
src/Microsoft.DotNet.Build.Tasks.Templating/MSBuildListSplitter.cs
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,29 @@ | |||
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. --> |
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.
/fyi @markwilkie four projects in this repo use a different header:
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
They should probably be made consistent.
This PR has been reviewed though I don't see any s from Core-Eng folks. Unless I hear different before later tonight, I'll merge. Please sing out w/ objections if you have any. |
While I have no context on the code itself, the intent is good with me. Assuming the right testing has happened, I'm find w/ merging. |
/// The destination for the generated file. | ||
/// </summary> | ||
[Required] | ||
[Output] |
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.
This "Output" is not correct, it's an input parameter. It's not returned by this task.
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.
Looks like we use it as output here: https://github.com/dotnet/aspnetcore/blob/52eff90fbcfca39b7eb58baad597df6a99a542b0/src/ProjectTemplates/GenerateContent.targets#L45-L52.
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.
Though I think it may be more correct to set the value to the value escaped by https://github.com/aspnet/BuildTools/blame/main/src/Internal.AspNetCore.BuildTasks/GenerateFileFromTemplate.cs#L55.
We could probably also separate it out into a separate out parameter like ResolvedOutputPath
or EscapedOutputPath
but so far we haven't run into any issues in our builds due to this being an Output
parameter so I would prefer if we don't block on this change and file followup issues to address.
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.
This path is never set by this code. Marking it output is incorrect, since it doesn't actually output anything. We should not be checking in new, incorrect, code.
src/Microsoft.DotNet.Build.Tasks.Templating/GenerateFileFromTemplate.cs
Outdated
Show resolved
Hide resolved
🎉🎉🎉 |
…lating (#7403) Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com>
…lating (#7403) Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com>
…s.Templating (#7503) * Migrate GenerateFileFromTemplate to Microsoft.DotNet.Build.Tasks.Templating (#7403) Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com> * Cherry-pick fixes * TFM update * Fix syntax for older SDKs * More syntax fixes Co-authored-by: John Luo <johluo@microsoft.com> Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com>
…s.Templating (#7502) * Migrate GenerateFileFromTemplate to Microsoft.DotNet.Build.Tasks.Templating (#7403) Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com> * 5.0 fixes * TFM update Co-authored-by: John Luo <johluo@microsoft.com> Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com>
Fixes #204. This will need to be backported to 3.1 and 5.0 after approval