Find a way to regenerate Spec.cs when Specs\*.md changes #179

Closed
opened 2026-01-29 14:29:32 +00:00 by claunia · 7 comments
Owner

Originally created by @leotsarev on GitHub (Jan 8, 2018).

  1. Change some spec (like Specs\MediaSpecs.md)
  2. Rebuild project

Expected result: Specs.cs was automatically updated
Actual result: You have to manually run Specs.tt custom tool to perform that.

P.S. Also Specs.cs probably should be excluded from source control

Originally created by @leotsarev on GitHub (Jan 8, 2018). 1. Change some spec (like Specs\MediaSpecs.md) 2. Rebuild project Expected result: Specs.cs was automatically updated Actual result: You have to manually run Specs.tt custom tool to perform that. P.S. Also Specs.cs probably should be excluded from source control
claunia added the enhancementPR Welcome! labels 2026-01-29 14:29:32 +00:00
Author
Owner

@xoofx commented on GitHub (Jan 8, 2018):

That's a limitation of tt files, so there is no real workaround for this. tt files cannot be triggered at build time, they are design time only, so you need to go through the saving whenever there is an update to an indirect files.

A different way to do it would be to generate the tests on the fly, by loading the specs when launching the tests and create the tests from there, but in my experience, it can make the test loading more laborious and less reactive (and not displayable if you don't try to run the tests...)

The process of updating the specs is not common, so it is not that critical, and if you are aware of the workflow in this case, you will not forget to resave the Specs.tt file

@xoofx commented on GitHub (Jan 8, 2018): That's a limitation of `tt` files, so there is no real workaround for this. `tt` files cannot be triggered at build time, they are design time only, so you need to go through the saving whenever there is an update to an indirect files. A different way to do it would be to generate the tests on the fly, by loading the specs when launching the tests and create the tests from there, but in my experience, it can make the test loading more laborious and less reactive (and not displayable if you don't try to run the tests...) The process of updating the specs is not common, so it is not that critical, and if you are aware of the workflow in this case, you will not forget to resave the Specs.tt file
Author
Owner

@leotsarev commented on GitHub (Jan 8, 2018):

According to Google, there is some solution
https://stackoverflow.com/a/24274820/408666

I'm not explored this yet, so I just leave this link here for future me (or you or any other guy) to explore

@leotsarev commented on GitHub (Jan 8, 2018): According to Google, there is __some__ solution https://stackoverflow.com/a/24274820/408666 I'm not explored this yet, so I just leave this link here for future me (or you or any other guy) to explore
Author
Owner

@xoofx commented on GitHub (Jan 8, 2018):

Yeah, sure you could run the T4 template process on your own, but frankly, that's a laborious process to setup, not really a typical usage with tt files. Again, once you know the workflow of updating the md specs files, it is not that annoying.

@xoofx commented on GitHub (Jan 8, 2018): Yeah, sure you could run the T4 template process on your own, but frankly, that's a laborious process to setup, not really a typical usage with tt files. Again, once you know the workflow of updating the md specs files, it is not that annoying.
Author
Owner

@leotsarev commented on GitHub (Jan 8, 2018):

I don't like commiting generated file :-)
But it probably my preference and it's for you to decide.

@leotsarev commented on GitHub (Jan 8, 2018): I don't like commiting generated file :-) But it probably my preference and it's for you to decide.
Author
Owner

@xoofx commented on GitHub (Jan 8, 2018):

I don't like commiting generated file :-)

On that matter, I generally agree with this statement 😉

If you want to try to generate the test on the fly by moving the specs loader from tt to the tests directly, you can try and see how it goes. As I have personally little bandwidth/interests on this matter, PR welcome.

@xoofx commented on GitHub (Jan 8, 2018): > I don't like commiting generated file :-) On that matter, I generally agree with this statement 😉 If you want to try to generate the test on the fly by moving the specs loader from tt to the tests directly, you can try and see how it goes. As I have personally little bandwidth/interests on this matter, PR welcome.
Author
Owner

@leotsarev commented on GitHub (Jan 8, 2018):

See PR.
It seems to discover same number of tests.
I don't know of other way to test it.

@leotsarev commented on GitHub (Jan 8, 2018): See PR. It seems to discover same number of tests. I don't know of other way to test it.
Author
Owner

@leotsarev commented on GitHub (Jan 28, 2019):

Probably can be closed.

@leotsarev commented on GitHub (Jan 28, 2019): Probably can be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#179