firmware_tools/autobuild/Common_scripts/differences/json.groovy
2019-01-28 10:00:44 +00:00

17 lines
481 B
Groovy

def comparefiles(importedjsonfile, currentjsonfile) {
env.IMPORTED_JSON="${importedjsonfile}"
env.CURRENT_JSON="${currentjsonfile}"
if (isUnix()) {
sh """
which jq
if [ \$? -ne 0 ]; then exit 1; fi
# jq -S sorts json output
diff -c <(jq -S . "${IMPORTED_JSON}") <(jq -S . "${CURRENT_JSON}")
"""
}
else {
error "Windows not currently supporting json file comparison"
}
}
return this;