firmware_tools/differences/file.groovy
Dan Hawkins 1b74ea88ff Squashed 'Common_scripts/' content from commit 2c26b22
git-subtree-dir: Common_scripts
git-subtree-split: 2c26b221f1
2022-01-12 14:42:51 +00:00

24 lines
698 B
Groovy

def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) {
echo "Comparing file: ${importedfile} with: ${currentfile} option: ${ignorewhitespace}"
def wsparameter = "-w"
if (!ignorewhitespace) {
wsparameter = ""
}
if (isUnix()) {
sh """
diff -c ${wsparameter} "${importedfile}" "${currentfile}"
"""
}
else {
// diffutils can be installed on windows with chocolatey
powershell """
# echo Checking utilities exist
# where diff
# if errorlevel 1 EXIT /b 1
diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}"
"""
}
}
return this;