diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 127db9f..649ba89 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -87,22 +87,26 @@ pipeline { dir(PPDFOLDER) { def EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS}" """ - } - dir(SRC) { - if (isUnix()) { - sh """#!/bin/bash - set -ev - - export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ - } else { - bat """ - set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ + EXCLUDE_PARAM = '--exclude "' + def exclude_path_list = EXCLUDE_PATHS.split() + for (exclude_path in exclude_path_list) { + EXCLUDE_PARAM += "${WORKSPACE}/${exclude_path.trim()}," } + EXCLUDE_PARAM += '"' + } + if (isUnix()) { + sh """#!/bin/bash + set -ev + + export PMD_JAVA_OPTS=-Xmx65536m + echo "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ + } else { + bat """ + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ } } recordIssues(tools: [