Skip to content

Commit 02e465b

Browse files
committed
ZCS-18242 add Sonar Scanner target
1 parent ffa0078 commit 02e465b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

build.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,35 @@
140140
-->
141141
</junit>
142142
</target>
143+
144+
<target name="sonar-scan" depends="compile" unless="skipSonarScan">
145+
<property environment="env"/>
146+
147+
<fail message="SONAR_HOST_URL environment variable not set" unless="env.SONAR_HOST_URL"/>
148+
<fail message="SONAR_TOKEN environment variable not set" unless="env.SONAR_TOKEN"/>
149+
150+
<path id="sonar.lib.path">
151+
<fileset dir="lib" includes="*.jar"/>
152+
</path>
153+
<pathconvert property="sonar.libraries.list" refid="sonar.lib.path" pathsep=","/>
154+
155+
<echo message="Running SonarQube scan for ical4j-0.9.16-patched"/>
156+
157+
<exec executable="sonar-scanner" failonerror="true">
158+
<arg value="-Dsonar.projectKey=ical4j-0.9.16-patched"/>
159+
<arg value="-Dsonar.projectName=ical4j-0.9.16-patched"/>
160+
<arg value="-Dsonar.java.source=1.5"/>
161+
<arg value="-Dsonar.sources=${source.dir}"/>
162+
163+
<arg value="-Dsonar.java.binaries=${output.dir}"/>
164+
165+
<arg value="-Dsonar.java.libraries=${sonar.libraries.list}"/>
166+
<arg value="-Dsonar.java.test.libraries=${sonar.libraries.list}"/>
167+
168+
<arg value="-Dsonar.tests=${test.source.dir}"/>
169+
170+
<arg value="-Dsonar.host.url=${env.SONAR_HOST_URL}"/>
171+
<arg value="-Dsonar.token=${env.SONAR_TOKEN}"/>
172+
</exec>
173+
</target>
143174
</project>

0 commit comments

Comments
 (0)