firmware_tools/Common_scripts/differences/file.groovy
2022-02-13 19:44:32 +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;