Skip to content
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

Merged
merged 11 commits into from
Jun 9, 2021

Conversation

JunTaoLuo
Copy link

Fixes #204. This will need to be backported to 3.1 and 5.0 after approval

Copy link
Member

@dougbu dougbu left a 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.

@dougbu dougbu requested a review from alexperovich May 18, 2021 19:11
@dougbu
Copy link
Member

dougbu commented May 18, 2021

/fyi @rainersigwald (re dotnet/msbuild#4018) @ericstj (re #204) @ilyas1974 and @ViktorHofer (re tail end of #135)

@dougbu
Copy link
Member

dougbu commented May 18, 2021

@rainersigwald this migrationf from aspnet/BuildTools reminds me of a rather unrelated question: Why is the <JoinItems> task in the .NET SDK and not together with the more general msbuild tasks and targets❔ I'm reminded of the discrepancy when I reach for Remove with MatchOnMetadata (a poorly-documented and limited option) or difficult-to-grok task batching alternatives in projects that don't use that SDK.

@rainersigwald
Copy link
Member

Why is the <JoinItems> task in the .NET SDK and not together with the more general msbuild tasks and targets❔

It was needed there first. I am not opposed in principle to "promoting" it.

@ViktorHofer
Copy link
Member

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?

@ViktorHofer
Copy link
Member

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?

@JunTaoLuo
Copy link
Author

@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 [[RunCommands]] and [[EchoRunCommands]]

Copy link
Member

@ViktorHofer ViktorHofer left a 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? :)

@JunTaoLuo
Copy link
Author

There were no tests in the original implementation, maybe we should not block on that in this PR and file followup to add tests?

@ViktorHofer
Copy link
Member

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.

John Luo and others added 8 commits May 29, 2021 00:08
…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>
@JunTaoLuo
Copy link
Author

Hey all, I've addressed the style guidelines and other feedback.

@@ -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. -->
Copy link
Member

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.

@dougbu
Copy link
Member

dougbu commented Jun 3, 2021

This PR has been reviewed though I don't see any :shipit:s from Core-Eng folks. Unless I hear different before later tonight, I'll merge. Please sing out w/ objections if you have any.

@markwilkie
Copy link
Member

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]
Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Author

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.

Copy link
Member

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.

@JunTaoLuo JunTaoLuo changed the title Migrate GenerateTemplateFromFile to Microsoft.DotNet.Build.Tasks.Templating Migrate GenerateFileFromTemplate to Microsoft.DotNet.Build.Tasks.Templating Jun 8, 2021
@JunTaoLuo JunTaoLuo merged commit e81d8c9 into main Jun 9, 2021
@JunTaoLuo JunTaoLuo deleted the johluo/template branch June 9, 2021 20:49
@ViktorHofer
Copy link
Member

🎉🎉🎉

JunTaoLuo pushed a commit that referenced this pull request Jun 10, 2021
…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>
JunTaoLuo pushed a commit that referenced this pull request Jun 10, 2021
…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>
markwilkie pushed a commit that referenced this pull request Oct 5, 2021
…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>
markwilkie pushed a commit that referenced this pull request Oct 5, 2021
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source file pre-processing
8 participants