firmware_tools/autobuild/Common_scripts/differences/file.groovy
2021-11-11 08:44:44 +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;