What is the quickest way to determine if files have changed during build?
Currently we're using an scm 'status' command, which we've found isn't great, performance-wise. Is there a recommended approach for determining if a file has changed during the build?
How would this be done using the plain Java API?
|
Accepted answer
One approach would be to compute checksums for each file in your extracted build tree prior to building anything, storing the information into a file. You can then to the same process after the build is over and compare the checksums.
Of course I don't know your requirements, but generally speaking it's a bad idea to be modifying source files during a build. Todd Strangio selected this answer as the correct answer
Comments
Todd Strangio
commented Jun 11 '13, 1:18 p.m.
Thanks Jeff. How would this be done using the Java API? You wouldn't need the plain Java API to perform any of this. Your build will load the content and you just need something to compute the checksums for before and after.
Jeff Care
commented Jun 11 '13, 3:24 p.m.
You shouldn't need to use the RTC API: all the classes you would need for this exist as part of the JDK. You could also probably implement this solution using a shell script, though the comparison part might be tricky that way.
Todd Strangio
commented Jun 11 '13, 3:38 p.m.
Some of our builds update a file during build with version info, which is then used during the deployment process. Looks like the SCM command is our best option for now, thanks for the answers.
Jeff Care
commented Jun 11 '13, 6:54 p.m.
I see.
|
One other answer
The command line is your best option. You might be able to get something more lightweight with the plain Java API but it would be quite a bit reimplementing of the command-line and I don't know how much time you're willing to spend on that.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Do you mean actually changed during the build or changed from one build to the next?
Hi Jeff, thanks for the quick reply. I actually meant 'changed during the build'....some of our builds change source files during build and I'd like to know what the experts think is the best approach to getting this data.