I want integrate CPD (Copy-Paste-Detection) to my iOS project. I read about it here and here.
To automatically determine CopyPaste in the code I'm using bash script:
echo "Checking files in ${SOURCE_ROOT}"
JARS_DIR=${PROJECT_DIR}/CPD
FULL_PATH_TO_CPD_XML_OUTPUT=${PROJECT_DIR}/cpd-output.xml
# Running CPD
java -classpath "${JARS_DIR}/ObjCLanguage-0.0.5-SNAPSHOT.jar:${JARS_DIR}/pmd.jar" net.sourceforge.pmd.cpd.CPD --minimum-tokens 100 --files "${SOURCE_ROOT}" -v --language ObjectiveC --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > "${FULL_PATH_TO_CPD_XML_OUTPUT}"
# Running self :)
${BUILT_PRODUCTS_DIR} -cpd-xml "${FULL_PATH_TO_CPD_XML_OUTPUT}"
That code create cpd-output.xml file. But take me an error at compile time "Command /bin/sh failed with exit code 126". Here is log copy http://pastebin.com/359k1Wni I took the code from this example project Error is going then I comment this string:
${BUILT_PRODUCTS_DIR} -cpd-xml "${FULL_PATH_TO_CPD_XML_OUTPUT}"
I tried to find what ever information about this error, but found only a few of these problems without answers. I'm not know anything about bash scripting. I will be happy with any advice. Thank you for your attention.
P.S. Author of following the script written:
In order to integrate XCode and the CPD, we will add to the Build Phases target with the project, Run Script phase, conventionally consisting of several parts: Actually calling cpd Parsing cpd-output.xml Output in the "right format"
126 for “command not executable"
# Running self :)
${BUILT_PRODUCTS_DIR} -cpd-xml "${FULL_PATH_TO_CPD_XML_OUTPUT}"
It looks like $BUILT_PRODUCTS_DIR} is not executable Can you update with the value of this var please
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With