morelinq / MoreLINQ

Extensions to LINQ to Objects
https://morelinq.github.io/
Apache License 2.0
3.7k stars 415 forks source link

Revert integration of T4 code generation into project file #940

Closed atifaziz closed 1 year ago

atifaziz commented 1 year ago

This reverts commit f669558facbbec9269a466c81594d5db8a19b4d1 from merge of PR #776.

The integration required parallel builds to be turned off for MoreLinq. Since PR #776, more frameworks are being targeted and this slows the build down considerably, taking per target 5 seconds (on my machine) and a total time of approximately 44 seconds:

13:15:15:755    Rebuild started...
13:15:16:123    Restored A:\MoreLINQ\main\bld\ExtensionsGenerator\MoreLinq.ExtensionsGenerator.csproj (in 38 ms).
13:15:16:123    Restored A:\MoreLINQ\main\MoreLinq\MoreLinq.csproj (in 127 ms).
13:15:16:372    1>------ Rebuild All started: Project: MoreLinq.ExtensionsGenerator, Configuration: Debug Any CPU ------
13:15:16:374    2>------ Rebuild All started: Project: MoreLinq, Configuration: Debug Any CPU ------
13:15:16:383    Restored A:\MoreLINQ\main\MoreLinq.Test\MoreLinq.Test.csproj (in 381 ms).
13:15:17:577    1>MoreLinq.ExtensionsGenerator -> A:\MoreLINQ\main\bld\ExtensionsGenerator\bin\Debug\net7.0\MoreLinq.ExtensionsGenerator.dll
13:15:24:161    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\net462\MoreLinq.dll
13:15:29:861    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\netstandard1.0\MoreLinq.dll
13:15:36:302    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\netstandard2.0\MoreLinq.dll
13:15:43:464    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\netstandard2.1\MoreLinq.dll
13:15:50:057    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\net6.0\MoreLinq.dll
13:15:50:388    3>------ Rebuild All started: Project: MoreLinq.Test, Configuration: Debug Any CPU ------
13:15:53:399    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\net6.0\MoreLinq.Test.dll
13:15:57:360    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\netcoreapp3.1\MoreLinq.Test.dll
13:15:58:028    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\net462\MoreLinq.Test.exe
13:15:59:206    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\net7.0\MoreLinq.Test.dll
13:15:59:255    ========== Rebuild All: 3 succeeded, 0 failed, 0 skipped ==========
13:15:59:255    ========== Elapsed 00:43.519 ==========

Reverting means that parallel builds can be enabled again and as a result, the total build time drop to approximately half:

13:16:23:133    Rebuild started...
13:16:23:338    Restored A:\MoreLINQ\main\bld\ExtensionsGenerator\MoreLinq.ExtensionsGenerator.csproj (in 24 ms).
13:16:23:395    Restored A:\MoreLINQ\main\MoreLinq\MoreLinq.csproj (in 86 ms).
13:16:23:508    Restored A:\MoreLINQ\main\MoreLinq.Test\MoreLinq.Test.csproj (in 260 ms).
13:16:23:513    1>------ Rebuild All started: Project: MoreLinq.ExtensionsGenerator, Configuration: Debug Any CPU ------
13:16:23:516    2>------ Rebuild All started: Project: MoreLinq, Configuration: Debug Any CPU ------
13:16:25:174    1>MoreLinq.ExtensionsGenerator -> A:\MoreLINQ\main\bld\ExtensionsGenerator\bin\Debug\net7.0\MoreLinq.ExtensionsGenerator.dll
13:16:25:641    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\net462\MoreLinq.dll
13:16:27:179    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\netstandard1.0\MoreLinq.dll
13:16:28:777    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\netstandard2.0\MoreLinq.dll
13:16:30:275    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\netstandard2.1\MoreLinq.dll
13:16:32:248    2>MoreLinq -> A:\MoreLINQ\main\MoreLinq\bin\Debug\net6.0\MoreLinq.dll
13:16:32:387    3>------ Rebuild All started: Project: MoreLinq.Test, Configuration: Debug Any CPU ------
13:16:35:260    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\net6.0\MoreLinq.Test.dll
13:16:40:810    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\net462\MoreLinq.Test.exe
13:16:41:595    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\netcoreapp3.1\MoreLinq.Test.dll
13:16:42:223    3>MoreLinq.Test -> A:\MoreLINQ\main\MoreLinq.Test\bin\Debug\net7.0\MoreLinq.Test.dll
13:16:42:289    ========== Rebuild All: 3 succeeded, 0 failed, 0 skipped ==========
13:16:42:289    ========== Elapsed 00:19.232 ==========

The cost of integrating T4 (which is rarely invoked) does not seem to justify the cost of doubling the build times. There's a small inconvenience to having to remember keeping the generated code fresh if the template is change by invoking the help shell scripts if you're not using Visual Studio, where it happens the moment the template is saved. The freshness of the generated code is asserting during CI build

https://github.com/morelinq/MoreLINQ/blob/62914fb870b41c3e7e067cd88b21c5aeda67f432/appveyor.yml#L79-L83

codecov[bot] commented 1 year ago

Codecov Report

Merging #940 (169395b) into master (c76db18) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #940   +/-   ##
=======================================
  Coverage   92.42%   92.42%           
=======================================
  Files         112      112           
  Lines        3446     3446           
  Branches     1023     1023           
=======================================
  Hits         3185     3185           
  Misses        199      199           
  Partials       62       62           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more