What is the quickest way to determine if files have changed during build?
Accepted answer
Of course I don't know your requirements, but generally speaking it's a bad idea to be modifying source files during a build.
Comments
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.
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.
Can you elaborate on why you modify source files during your build? Maybe there's a different way to approach your problem that wouldn't involve such a terrible anti-pattern.
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.
I see.
Again, I don't know the specifics, but in (superficially) similar cases in the past I have treated the source file as a template, generating the actual shipped file during the build process using the template, using token replacement, sed, or whatever other automated editing facility was available in the given context.
Comments
Jeff Care
Jun 07 '13, 1:40 p.m.Do you mean actually changed during the build or changed from one build to the next?
Todd Strangio
Jun 07 '13, 1:56 p.m.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.