BoolBySigma / UpdateAssemblyInfo

SORRY THIS IS NO LONGER MAINTAINED
10 stars 9 forks source link

$(Rev) support #6

Closed ghost closed 7 years ago

ghost commented 7 years ago

$(Rev) token that can be used in BuildNumber is not available as build varaible.

Possible solution is to make use of build history and calculate the build number of the day.

Down side is that it will not always match up with $(Rev) in BuildNumber. When using $(Rev) in BuildNumber the count starts when $(Rev) is first used, independant of how many builds have run that day. This should only be an issue on the first day though.

Kujawadl commented 7 years ago

This is clever, I wouldn't have thought of that.

Another (if slightly more complicated) possibility is to fetch the BuildNumber format and check for the existence of $(Rev): if it's there, increment whatever the last build's rev was, if not, just count how many build there have been that day.

ghost commented 7 years ago

Good suggestion.

As far as I can tell Rev is based on queue time and not finish time.

Will do some tests and see how stable this would be

Kujawadl commented 7 years ago

I think this is the case as well, but it shouldn't be difficult to get the day's build history and sort by queueTime instead of finishTime. I'd suggest sorting by BuildNumber, but that could vary if the definition changes, so I don't think that'd be the best idea.

Speaking of, it's entirely possible that if the BuildNumber changes, the latest build would not be following whatever format we're expecting, so I suppose even if we can parse the BuildNumber format, it may still need to fallback on the # of builds.

ghost commented 7 years ago

I published version 2.0.21 with a patch for $(Rev).

As long as 'Build number format' contains the variable $(Rev:r) the variable can be used in the update assembly info task.

Use $(Rev:r) for 1 digit, $(Rev:rr) for 2 digits and so on... $(Rev:rrr) produces eg. '001'.

Try it out and see how it works for you.

ghost commented 7 years ago

Version 2.0.22 also exports build number revision to variable 'Build.BuildNumberRevision'

The variable can be used in any subsequent tasks using $(Build.BuildNumberRevision).

ghost commented 7 years ago

Published public version with $(Rev) variable support.

Kujawadl commented 7 years ago

Sorry I only got around to testing this, but it works great. Thanks again!

pisten commented 7 years ago

image

At build task: image

During build: image

What am I doing wrong?


UPDATE: Do use: $(Rev:r) and not $(rev:r). Case sensitive... I let this stand if someone else have this problem...