Skip writing reflection_generated.h if not changed (#5776)

This commit is contained in:
Derek Bailey 2020-02-24 14:46:24 -08:00 committed by GitHub
parent 34305c4ce4
commit 8c02d17bea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -15,4 +15,16 @@
# limitations under the License.
set -e
../flatc -c --cpp-std c++0x --no-prefix -o ../include/flatbuffers reflection.fbs
tempDir="../include/flatbuffers/.tmp"
originalFile="../include/flatbuffers/reflection_generated.h"
newFile="$tempDir/reflection_generated.h"
../flatc -c --cpp-std c++0x --no-prefix -o $tempDir reflection.fbs
if [ -f "$newFile" ]; then
if ! cmp -s "$originalFile" "$newFile"; then
mv $newFile $original
fi
rm $newFile
rmdir $tempDir
fi