8000 Integrate templated code generation into project file by atifaziz · Pull Request #776 · morelinq/MoreLINQ · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Integrate templated code generation into project file #776

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

Merged
merged 6 commits into from
Dec 26, 2020

Conversation

atifaziz
Copy link
Member

This PR integrates dotnet t4 invocation directly into MoreLinq.csproj for the following benefits:

  • Works with dotnet build
  • Shell scripts like tt.* are not needed anymore
  • Uses incremental building built-into MSBuild; dotnet t4 is not invoked unless one of the *.g.tt files is touched

@codecov
Copy link
codecov bot commented Dec 25, 2020

Codecov Report

Merging #776 (00fa755) into master (31d6709) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #776   +/-   ##
=======================================
  Coverage   87.90%   87.90%           
=======================================
  Files         108      108           
  Lines        3473     3473           
  Branches      984      984           
=======================================
  Hits         3053     3053           
  Misses        272      272           
  Partials      148      148           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31d6709...00fa755. Read the comment docs.

Parallel build cause intermittent file locking errors since T4 tries to
write to the same output file in parallel, for each target framework.
@atifaziz
Copy link
Member Author

Unfortunately, parallel builds in MSBuild are incompatible with T4 code generation. It causes sporadic file locking issues when T4 tries to generate code to the same output file in parallel. The project therefore ends in an error if T4 code generation needs running but building is happening in parallel. Re-running with dotnet build -p:BuildInParallel=false fixes the issues. This is somewhat inconvenient, but will only happen if someone touches a template file (*.tt), forget to transform it so that the output file is in sync and runs dotnet build on the command line. In Visual Studio, the output is usually generated as soon as the template is touched and save so the two will generally be in sync. In build.cmd/build.sh, the T4 code generation is done with the -p:BuildInParallel=false switch before the main such that all generated output will be in sync and won't err due to parallel building being the default.

@atifaziz atifaziz merged commit f669558 into morelinq:master Dec 26, 2020
@atifaziz atifaziz deleted the t4-in-csproj branch December 26, 2020 12:16
atifaziz added a commit to atifaziz/MoreLINQ that referenced this pull request Jan 21, 2023
atifaziz added a commit that referenced this pull request Jan 21, 2023
atifaziz added a commit that referenced this pull request Jan 29, 2023
This adds to commit "Revert "Integrate templated code generation into
project file (#776)"" (0be76fd) that
was merge of PR #940.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0