Skip to content

Commit

Permalink
SONARJAVA-5049 Add CheckListGenerator (#4818)
Browse files Browse the repository at this point in the history
  • Loading branch information
irina-batinic-sonarsource authored Jun 24, 2024
1 parent 28486f2 commit c9933de
Show file tree
Hide file tree
Showing 18 changed files with 670 additions and 1,467 deletions.
9 changes: 6 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ sanity_task:
sanity_script:
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- mvn clean compile --projects java-checks-test-sources --also-make-dependents
- cd java-checks-test-sources
- mvn clean compile
- cd ../
- mvn verify -f sonar-java-plugin/pom.xml -Psanity -Dtest=SanityTest
cleanup_before_cache_script: cleanup_maven_repository

Expand Down Expand Up @@ -261,8 +263,9 @@ autoscan_task:
autoscan_script:
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- JAVA_HOME="${JAVA_21_HOME}" mvn clean compile --projects java-checks-test-sources --also-make-dependents
- cd its/autoscan
- cd java-checks-test-sources
- JAVA_HOME="${JAVA_21_HOME}" mvn clean compile
- cd ../its/autoscan
- mvn clean package --batch-mode --errors --show-version --activate-profiles it-autoscan -Dsonar.runtimeVersion=LATEST_RELEASE[10.3] -Dmaven.test.redirectTestOutputToFile=false -Dparallel=methods -DuseUnlimitedThreads=true
cleanup_before_cache_script: cleanup_maven_repository
on_failure:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ Running this test can be broken down in 2 steps:

Make sure that the `java-checks-tests-sources` module has been compiled (ie: the .class files in `java-checks-tests-sources/target/` are up to date).

In doubt, go the top-level of the project and run:
In doubt, go the [`java-checks-tests-sources`](java-checks-tests-sources) module and run:
```shell
# Use java 21!
mvn clean compile --projects java-checks-test-sources --also-make-dependents
mvn clean compile
```

##### Executing the autoscan test
Expand Down
117 changes: 117 additions & 0 deletions check-list/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<parent>
<groupId>org.sonarsource.java</groupId>
<artifactId>java</artifactId>
<version>8.1.0-SNAPSHOT</version>
</parent>

<artifactId>check-list</artifactId>

<name>SonarQube Java :: Check List</name>
<inceptionYear>2024</inceptionYear>

<dependencies>
<dependency>
<groupId>org.sonarsource.api.plugin</groupId>
<artifactId>sonar-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>java-checks</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>java-checks-aws</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>org.sonar.java.CheckListGenerator</mainClass>
<classpathScope>compile</classpathScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<!-- second compilation execution to compile the generated sources before the tests -->
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit c9933de

Please sign in to comment.