You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2016/12/18 11:12:17 UTC
svn commit: r1774875 - in /jmeter/trunk: build.properties build.xml
test/src/org/apache/jmeter/JMeterVersionTest.java xdocs/changes.xml
Author: fschumacher
Date: Sun Dec 18 11:12:17 2016
New Revision: 1774875
URL: http://svn.apache.org/viewvc?rev=1774875&view=rev
Log:
Add sonar analysis task to build
Bugzilla Id: 60494
Modified:
jmeter/trunk/build.properties
jmeter/trunk/build.xml
jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/build.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.properties?rev=1774875&r1=1774874&r2=1774875&view=diff
==============================================================================
--- jmeter/trunk/build.properties (original)
+++ jmeter/trunk/build.properties Sun Dec 18 11:12:17 2016
@@ -284,6 +284,11 @@ slf4j-api.jar = slf4j-api-
slf4j-api.loc = ${maven2.repo}/org/slf4j/slf4j-api/${slf4j-api.version}
slf4j-api.md5 = c9be56284a92dcb2576679282eff80bf
+sonarqube-ant-task.version = 2.5
+sonarqube-ant-task.jar = sonarqube-ant-task-${sonarqube-ant-task.version}.jar
+sonarqube-ant-task.loc = ${maven2.repo}/org/sonarsource/scanner/ant/sonarqube-ant-task/${sonarqube-ant-task.version}
+sonarqube-ant-task.md5 = 0458ef676194411fcccad3bdec8b22c9
+
jtidy.version = r938
jtidy.jar = jtidy-${jtidy.version}.jar
jtidy.loc = ${maven2.repo}/net/sf/jtidy/jtidy/${jtidy.version}
@@ -398,4 +403,4 @@ rat-tasks.md5 = 96b699581
jacocoant.version = 0.7.7.201606060606
jacocoant.jar = org.jacoco.ant-${jacocoant.version}-nodeps.jar
jacocoant.loc = ${maven2.repo}/org/jacoco/org.jacoco.ant/${jacocoant.version}
-jacocoant.md5 = fc093f67abf5bafb782d2eafa2f5815e
\ No newline at end of file
+jacocoant.md5 = fc093f67abf5bafb782d2eafa2f5815e
Modified: jmeter/trunk/build.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1774875&r1=1774874&r2=1774875&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Sun Dec 18 11:12:17 2016
@@ -134,6 +134,7 @@
reportlevel="${findbugs.level}"
excludeFilter="fb-excludes.xml"
jvmargs="-Xms512m -Xmx512m"
+ omitVisitors="InefficientStringBuffering"
outputFile="${findbugs.outName}.xml" >
<sourcePath path="${src.core}" />
<sourcePath path="${src.http}" />
@@ -548,13 +549,14 @@
<filter token="YEAR" value="${year}"/>
</filterset>
+ <!--
+ JMeter version
+ This is overridden for formal releases.
+ -->
+ <property name="jmeter.version" value="3.2-SNAPSHOT"/>
+
<target name="init-version">
<tstamp/>
- <!--
- JMeter version
- This is overridden for formal releases.
- -->
- <property name="jmeter.version" value="3.2-SNAPSHOT"/>
<!-- Remember to change "docversion" below if necessary -->
<condition property="implementation.version"
value="${jmeter.version} r${svn.revision}" else="${jmeter.version}.${DSTAMP}">
@@ -2804,6 +2806,42 @@ run JMeter unless all the JMeter jars ar
</junit>
</target>
+ <target name="complete-junit" depends="compile-tests"
+ description="Run individual JUnit test (-Dtest.case=org.apache.jorphan.test.AllTests) (-Dtest.format=plain) (-Dtest.showoutput=true)"
+ xmlns:jacoco="antlib:org.jacoco.ant">
+ <mkdir dir="reports"/>
+ <property name="test.format" value="plain"/>
+ <property name="test.case" value="org.apache.jorphan.test.AllTests"/>
+ <property name="test.showoutput" value="false"/>
+ <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
+ <classpath refid="sonar.classpath" />
+ </taskdef>
+ <jacoco:coverage destfile="reports/jacoco.exec">
+ <junit fork="true"
+ dir="${basedir}/bin"
+ showoutput="${test.showoutput}"
+ printsummary="on">
+ <formatter type="${test.format}" usefile="yes"/>
+ <formatter type="xml"/>
+ <jvmarg value="-Dfile.encoding=${test.encoding}"/>
+ <!-- Allow headless to be passed in -->
+ <jvmarg value="-Djava.awt.headless=${java.awt.headless}"/>
+ <classpath>
+ <fileset dir="${dest.jar}" includes="*.jar"/>
+ <pathelement location="${build.test}"/>
+ <pathelement location="${build.test-res}"/>
+ <path refid="classpath"/>
+ </classpath>
+ <batchtest todir="reports" skipNonTests="true">
+ <fileset dir="${src.test}">
+ <include name="**/*Test*.java" />
+ <exclude name="**/AllTests.java" />
+ </fileset>
+ </batchtest>
+ </junit>
+ </jacoco:coverage>
+ </target>
+
<!-- Utility target to collate reports -->
<target name="junitreport">
<mkdir dir="reports"/>
@@ -3029,6 +3067,7 @@ run JMeter unless all the JMeter jars ar
<process_jarfile jarname="xpp3"/>
<process_jarfile jarname="xstream"/>
<process_jarfile jarname="jacocoant" dest.dir="${lib.coverage}" />
+ <process_jarfile jarname="sonarqube-ant-task" dest.dir="${lib.coverage}" />
</target>
<target name="_process_doc_jars">
@@ -3324,4 +3363,91 @@ run JMeter unless all the JMeter jars ar
<fileset dir="${maven.dir}" includes="*.*" excludes="*.asc *.md5 *.sha1 *.sha"/>
</gpg>
</target>
+
+ <path id="sonar.classpath">
+ <fileset dir="./lib/opt" includes="**/*.jar" />
+ </path>
+
+ <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
+ <classpath refid="sonar.classpath" />
+ </taskdef>
+
+ <property name="sonar.organizationName" value="Apache" />
+ <property name="sonar.projectName" value="JMeter" />
+
+ <property name="sonar.projectKey" value="org.apache.jmeter:${sonar.projectName}" />
+ <property name="sonar.projectVersion" value="${jmeter.version}" />
+ <property name="sonar.language" value="java" />
+ <property name="sonar.modules" value="core,http,ftp,java,jdbc,ldap,mail,components,functions,jorphan,tcp,jms,native" />
+ <property name="sonar.java.binaries" value="${build.core},${build.http},${build.core},${build.http},${build.ftp},${build.java},${build.jdbc},${build.ldap},${build.mail},${build.components},${build.functions},${build.jorphan},${build.tcp},${build.jms},${build.native}" />
+ <property name="sonar.java.libraries" value="lib,lib/opt" />
+
+ <property name="sonar.junit.reportsPath" value="reports" />
+ <property name="sonar.jacoco.reportPath" value="reports/jacoco.exec" />
+
+ <property name="core.sonar.projectName" value="core" />
+ <property name="core.sonar.sources" value="${src.core}" />
+ <property name="core.sonar.projectBaseDir" value="./" />
+ <property name="http.sonar.projectName" value="http" />
+ <property name="http.sonar.sources" value="${src.http}" />
+ <property name="http.sonar.projectBaseDir" value="./" />
+ <property name="ftp.sonar.projectName" value="ftp" />
+ <property name="ftp.sonar.sources" value="${src.ftp}" />
+ <property name="ftp.sonar.projectBaseDir" value="./" />
+ <property name="java.sonar.projectName" value="java" />
+ <property name="java.sonar.sources" value="${src.java}" />
+ <property name="java.sonar.projectBaseDir" value="./" />
+ <property name="jdbc.sonar.projectName" value="jdbc" />
+ <property name="jdbc.sonar.sources" value="${src.jdbc}" />
+ <property name="jdbc.sonar.projectBaseDir" value="./" />
+ <property name="ldap.sonar.projectName" value="ldap" />
+ <property name="ldap.sonar.sources" value="${src.ldap}" />
+ <property name="ldap.sonar.projectBaseDir" value="./" />
+ <property name="mail.sonar.projectName" value="mail" />
+ <property name="mail.sonar.sources" value="${src.mail}" />
+ <property name="mail.sonar.projectBaseDir" value="./" />
+ <property name="components.sonar.projectName" value="components" />
+ <property name="components.sonar.sources" value="${src.components}" />
+ <property name="components.sonar.projectBaseDir" value="./" />
+ <property name="functions.sonar.projectName" value="functions" />
+ <property name="functions.sonar.sources" value="${src.functions}" />
+ <property name="functions.sonar.projectBaseDir" value="./" />
+ <property name="jorphan.sonar.projectName" value="jorphan" />
+ <property name="jorphan.sonar.sources" value="${src.jorphan}" />
+ <property name="jorphan.sonar.projectBaseDir" value="./" />
+ <property name="tcp.sonar.projectName" value="tcp" />
+ <property name="tcp.sonar.sources" value="${src.tcp}" />
+ <property name="tcp.sonar.projectBaseDir" value="./" />
+ <property name="jms.sonar.projectName" value="jms" />
+ <property name="jms.sonar.sources" value="${src.jms}" />
+ <property name="jms.sonar.projectBaseDir" value="./" />
+ <property name="native.sonar.projectName" value="native" />
+ <property name="native.sonar.sources" value="${src.native}" />
+ <property name="native.sonar.projectBaseDir" value="./" />
+
+ <target name="sonar" depends="compile, install, complete-junit">
+ <property environment="env" />
+ <condition property="sonar.host.url" value="${env.SONAR_HOST_URL}" else="http://localhost:9000">
+ <isset property="env.SONAR_HOST_URL" />
+ </condition>
+ <condition property="sonar.login" value="${env.SONAR_LOGIN}">
+ <isset property="env.SONAR_LOGIN" />
+ </condition>
+ <condition property="sonar.password" value="${env.SONAR_PASSWORD}">
+ <isset property="env.SONAR_PASSWORD" />
+ </condition>
+ <condition property="sonar.jdbc.url" value="${env.SONAR_JDBC_URL}">
+ <isset property="env.SONAR_JDBC_URL" />
+ </condition>
+ <condition property="sonar.jdbc.username" value="${env.SONAR_JDBC_USERNAME}">
+ <isset property="env.SONAR_JDBC_USERNAME" />
+ </condition>
+ <condition property="sonar.jdbc.password" value="${env.SONAR_JDBC_PASSWORD}">
+ <isset property="env.SONAR_JDBC_PASSWORD" />
+ </condition>
+ <property name="sonar.java.test.libraries" value="lib/**/*.jar" />
+ <sonar:sonar xmlns:sonar="antlib:org.sonar.ant">
+ </sonar:sonar>
+ </target>
+
</project>
Modified: jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java?rev=1774875&r1=1774874&r2=1774875&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java Sun Dec 18 11:12:17 2016
@@ -115,9 +115,11 @@ public class JMeterVersionTest extends J
versions.remove("rat");
propNames.remove("rat-tasks");
versions.remove("rat-tasks");
- // remove optional jacoco jars (required for coverage reporting, not required for jmeter)
- propNames.remove("jacocoant");
- versions.remove("jacocoant");
+ // remove optional jacoco and sonar jars (required for coverage reporting, not required for jmeter)
+ for (String optLib : Arrays.asList("jacocoant", "sonarqube-ant-task")) {
+ propNames.remove(optLib);
+ versions.remove(optLib);
+ }
prop = buildProp;
final File licencesDir = getFileFromHome("licenses/bin");
licencesDir.list(new FilenameFilter() {
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1774875&r1=1774874&r2=1774875&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Dec 18 11:12:17 2016
@@ -187,6 +187,7 @@ Fill in some detail.
Based on patch by Liu XP (liu_xp2003 at sina.com)</li>
<li><bug>60442</bug>Fix a typo in <code>build.xml</code> (gavin at 16degrees.com.au)</li>
<li><bug>60449</bug>JMeter Tree : Annoying behaviour when node name is empty</li>
+ <li><bug>60494</bug>Add sonar analysis task to build</li>
</ul>
<!-- =================== Thanks =================== -->