<target name="build-extensions">
<mkdir dir="${basedir}/target"/>
-
+
<mvn dir="target"
args="archetype:generate -B -DarchetypeGroupId=org.codehaus.sonar.archetypes -DarchetypeArtifactId=sonar-basic-plugin-archetype -DarchetypeVersion=${sonar.runtimeVersion} -DgroupId=com.mycompany.sonar -DartifactId=sonar-basic-sample-plugin -Dversion=0.1-SNAPSHOT"/>
<mvn args="install" dir="${basedir}/target/sonar-basic-sample-plugin"/>
<target name="analyze-custom-projects"
- depends="ant-static,ant-dynamic-clover,ant-dynamic-cobertura,ant-dynamic-junit,deprecated-sonar-light,struts,timemachine,reuse-coverage-reports"/>
+ depends="ant-static,ant-dynamic-clover,ant-dynamic-cobertura,ant-dynamic-junit,deprecated-sonar-light,struts,timemachine,violations-timemachine,reuse-coverage-reports"/>
<target name="ant-static">
<execant dir="${projects.dir}/ant-static/"/>
pom="${projects.dir}/timemachine/pom.xml"/>
</target>
+ <target name="violations-timemachine">
+ <mvn args="clean install -DskiptTests" dir="${projects.dir}/violations-timemachine/v1"/>
+ <mvnsonar failonerror="false"
+ args="-Dsonar.projectDate=2010-10-19"
+ pom="${projects.dir}/violations-timemachine/v1/pom.xml"/>
+
+ <mvn args="clean install -DskiptTests" dir="${projects.dir}/violations-timemachine/v2"/>
+ <mvnsonar failonerror="false"
+ args="-Dsonar.projectDate=2010-11-13"
+ pom="${projects.dir}/violations-timemachine/v2/pom.xml"/>
+ </target>
+
<target name="big-project">
<exec executable="ruby" failonerror="true" dir="${projects.dir}/big-project">
<arg line="generate-sources.rb 20 50"/>
</sequential>
</macrodef>
-</project>
\ No newline at end of file
+</project>
--- /dev/null
+Use-cases to check:
+* File added
+* File removed
+* File with new/fixed violations
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.sonar.tests</groupId>
+ <artifactId>violations-timemachine</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Violations timemachine</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+package org.sonar.tests.violationstimemachine;
+
+public class FileRemovedInV2 {
+
+ protected void methodOne() {
+ int i = 0; // unused local variable
+ i++;
+ }
+
+}
--- /dev/null
+package org.sonar.tests.violationstimemachine;
+
+public class Hello {
+
+ // We need two similar violations here to check that they would be associated correctly
+
+ protected void methodOne() { // design for extension
+ int i = 0; // unused local variable
+ i++;
+ }
+
+ protected void methodTwo() { // design for extension
+ int i = 0; // unused local variable
+ i++;
+ }
+
+ public int methodReturnThree() { // design for extension
+ return 3;
+ }
+}
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.sonar.tests</groupId>
+ <artifactId>violations-timemachine</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Violations timemachine</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+package org.sonar.tests.violationstimemachine;
+
+public class FileAddedInV2 {
+
+ protected void methodOne() {
+ int i = 0; // unused local variable
+ i++;
+ }
+
+}
--- /dev/null
+package org.sonar.tests.violationstimemachine;
+
+public class Hello {
+
+ // We need two similar violations here to check that they would be associated correctly
+
+ protected void methodOne() {
+ int i = 0; // unused local variable
+ i++;
+ }
+
+ protected void methodTwo() {
+ int i = 0; // unused local variable
+ i++;
+ }
+
+ public final int methodReturnThree() { // fixed - design for extension
+ int j = 0; // new - unused local variable
+ return 3;
+ }
+}