| <project name="CHKPII Testing" default="chkpii" basedir="."> |
| <!-- |
| Use this script like this (as called from /org.eclipse.emft/releng/ocl/builder/tests/scripts/test.xml, for example): |
| |
| <target name="runtests"> |
| ... |
| <property name="chkpii.xml" value="${basedir}/../../../org.eclipse.emft.common.releng/scripts/chkpii.xml"/> |
| <available file="${chkpii.xml}" property="chkpiiXMLAvailable"/><antcall target="runChkpii"/> |
| </target> |
| |
| <target name="runChkpii" if="chkpiiXMLAvailable"> |
| <ant target="chkpii" antfile="${chkpii.xml}" inheritall="true"> |
| <property name="zipPattern" value="emft-*.zip"/> |
| </ant> |
| </target> |
| |
| --> |
| |
| <target name="chkpiiSetup"> |
| <!-- test if chkpii.exe exists before proceeding --> |
| <property name="chkpii.exe" value="/usr/local/bin/chkpii.exe"/> |
| <available file="${chkpii.exe}" property="chkpiiAvailable"/> |
| </target> |
| |
| <target name="chkpii" description="If available, run PII tests" if="chkpiiAvailable" depends="chkpiiSetup"> |
| <!-- baseDir = .../2.2.0/S200512220106/testing/S200512220106/testing --> |
| <property name="folderToChkpii" value="${basedir}/chkpiiContents"/><mkdir dir="${folderToChkpii}"/> |
| <echo message="Unpack ${zipPattern} ..."/> |
| <unzip dest="${folderToChkpii}" overwrite="true"> |
| <fileset dir="."><include name="**/${zipPattern}"/></fileset> |
| <patternset> |
| <exclude name="**/org.eclipse.test*/**"/> |
| <exclude name="**/org.eclipse.ant*/**"/> |
| <include name="**/*.htm"/> |
| <include name="**/*.html"/> |
| <include name="**/*.xml"/> |
| <include name="**/*.properties"/> |
| </patternset> |
| </unzip> |
| <property name="chkpiiResultsFolder" value="${results}/chkpii"/><mkdir dir="${chkpiiResultsFolder}"/> |
| <property name="chkpiiLogFile" value="/dev/null"/> |
| <antcall target="doChkpii"><param name="filetype" value="htm"/></antcall> |
| <antcall target="doChkpii"><param name="filetype" value="xml"/></antcall> |
| <antcall target="doChkpii"><param name="filetype" value="properties"/></antcall> |
| </target> |
| |
| <target name="doChkpii" description="do a single PII check"> |
| <property name="ignoreFileFolder" value="${basedir}/../../../org.eclipse.emft.${subprojectName}.releng/builder/tests/configs/local"/> |
| <property name="chkpiiArgs" value="${folderToChkpii}/*.${filetype}* -E -S -JSQ -OX -O ${chkpiiResultsFolder}/org.eclipse.nls.${filetype}.xml -X ${ignoreFileFolder}/chkpii_ignore_list.txt"/> |
| <echo message="${chkpii.exe} ${chkpiiArgs}"/> |
| <exec executable="${chkpii.exe}" output="${chkpiiLogFile}"><arg line="${chkpiiArgs}"/></exec> |
| |
| <!-- parse resulting XML to get properties: Report.Summary.FileSummary.Errors, Report.Summary.FileSummary.Warnings --> |
| <xmlproperty file="${chkpiiResultsFolder}/org.eclipse.nls.${filetype}.xml"/> |
| <echo message="Total *.${filetype}* Files: ${Report.Summary.FileSummary.Total}; Checked: ${Report.Summary.FileSummary.Checked}; Errors: ${Report.Summary.FileSummary.Errors}; Warnings: ${Report.Summary.FileSummary.Warnings}; Not Done: ${Report.Summary.FileSummary.NotDone}"/> |
| <condition property="hasErrorsOrWarnings"><or> |
| <and><isset property="Report.Summary.FileSummary.Errors"/><not><equals arg1="${Report.Summary.FileSummary.Errors}" arg2="0"/></not></and> |
| <and><isset property="Report.Summary.FileSummary.Warnings"/><not><equals arg1="${Report.Summary.FileSummary.Warnings}" arg2="0"/></not></and> |
| </or></condition> |
| |
| <!-- generate summary file and delete xml if no errors/warnings --> |
| <antcall target="doChkpiiSummary"/> |
| <antcall target="doChkpiiDeleteXML"/> |
| </target> |
| |
| <target name="doChkpiiSummary" description="append to chkpii summary file" if="hasErrorsOrWarnings"> |
| <echo message="${filetype}: ${Report.Summary.FileSummary.Errors} E, ${Report.Summary.FileSummary.Warnings} W${line.separator}" append="true" |
| file="${chkpiiResultsFolder}/org.eclipse.nls.summary.txt"/> |
| </target> |
| |
| <target name="doChkpiiDeleteXML" description="delete chkpii XML details if no errors/warnings" unless="hasErrorsOrWarnings"> |
| <delete file="${chkpiiResultsFolder}/org.eclipse.nls.${filetype}.xml"/> |
| </target> |
| </project> |