Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review: move sorald to subfolder #779

Merged
merged 5 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/mem-constrained-exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -o errexit
set -o nounset
set -o pipefail

SORALD_JAR_PATH=$(echo target/sorald-*-jar-with-dependencies.jar)
SORALD_JAR_PATH=$(echo sorald/target/sorald-*-jar-with-dependencies.jar)
if [[ ! (-f "$SORALD_JAR_PATH") ]]; then
echo "expected Sorald jar at $SORALD_JAR_PATH"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sorald_buildbreaker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Run Sorald Buildbreaker
uses: SpoonLabs/sorald-buildbreaker@45bafb6db29a466080328864cecf9b20d9ace3de
with:
source: 'src/main/java'
source: 'sorald/src/main/java'
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:

- name: Test that generated code is up-to-date
run: |
mvn clean compile dependency:build-classpath -Dmdep.outputFile=cp.txt
java -cp "$(cat cp.txt):./target/classes" sorald.CodeGenerator
mvn spotless:apply
cd sorald && mvn clean compile dependency:build-classpath -Dmdep.outputFile=cp.txt
cd sorald && java -cp "$(cat cp.txt):.target/classes" sorald.CodeGenerator
cd sorald && mvn spotless:apply
git diff --exit-code
2 changes: 1 addition & 1 deletion experimentation/tools/sorald/_helpers/soraldwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def _find_default_sorald_jar() -> pathlib.Path:
target_dir = (
pathlib.Path(__file__).absolute().parent.parent.parent.parent.parent / "target"
pathlib.Path(__file__).absolute().parent.parent.parent.parent.parent / "sorald/target"
)
sorald_jar_matches = list(
target_dir.glob("sorald-*-jar-with-dependencies.jar")
Expand Down
2 changes: 1 addition & 1 deletion experimentation/tools/sorald/handled_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
OUTPUT_ARG = "--output"

PATH_TO_PROCESSOR_PACKAGE = (
pathlib.Path(__file__).absolute().parent.parent.parent.parent
pathlib.Path(__file__).absolute().parent.parent.parent.parent.parent
/ "src/main/java/sorald/processor"
)

Expand Down
1 change: 1 addition & 0 deletions experimentation/tools/tests/test_prmessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_uses_correct_sonar_version():

config = (
pathlib.Path(__file__).parent.parent.parent.parent
/ "sorald"
/ "src"
/ "main"
/ "resources"
Expand Down
177 changes: 57 additions & 120 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@
<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>se.kth.castor</groupId>
<artifactId>sorald-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>sorald-parent</relativePath>
</parent>
<packaging>pom</packaging>

<groupId>se.kth.castor</groupId>
<artifactId>sorald</artifactId>
<version>0.3.1-SNAPSHOT</version>

<name>Sorald</name>
<name>Sorald-parent</name>
<description>An automatic repair system for static code analysis warnings from Sonar Java.</description>
<url>https://github.com/SpoonLabs/sorald</url>

Expand All @@ -24,7 +18,6 @@
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<id>slarse</id>
Expand All @@ -50,26 +43,63 @@
</developers>

<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
<scope>
<!--Enabled for tests to make it possible to silence INFO log output from SonarJava-->
test
</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/fr.inria.gforge.spoon/spoon-core -->
<dependency>
<groupId>fr.inria.gforge.spoon</groupId>
<artifactId>spoon-core</artifactId>
<version>10.0.1-beta-9</version>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core</artifactId>
<version>8.2.0.43778</version>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>${picocli.version}</version>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>6.1.0.202203080745-r</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>${picocli.version}</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20220320</version>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0.1</version>
<optional>true</optional>
</dependency>
</dependencies>
<properties>
Expand All @@ -82,29 +112,7 @@
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>generateManPages</id>
<phase>process-classes</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>picocli.codegen.docgen.manpage.ManPageGenerator</mainClass>
<arguments>
<argument>--outdir=${project.basedir}/docs/usage</argument>
<argument>sorald.cli.RepairCommand</argument>
<argument>sorald.cli.MineCommand</argument>
</arguments>
</configuration>
</plugin>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down Expand Up @@ -133,55 +141,6 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- creates the build number (git commit hash) that is later attached to the manifest -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>create</goal></goals>
</execution>
</executions>
<configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<shortRevisionLength>8</shortRevisionLength>
<attach>true</attach>
<addOutputDirectoryToResources>true</addOutputDirectoryToResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<mainClass>sorald.Main</mainClass>
</manifest>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-SCM-Revision>${buildNumber}</Implementation-SCM-Revision>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
<!-- descriptorRef>project</descriptorRef -->
</descriptorRefs>
<!-- descriptor>src/main/assembly/project.xml</descriptor -->
</configuration>
<executions>
<execution>
<id>make-assembly</id><!-- this is used for inheritance merges -->
<phase>package</phase><!-- append to the packaging phase. -->
<goals>
<goal>single</goal><!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand All @@ -206,31 +165,6 @@
<version>3.10.1</version>
</plugin>
<!-- adapted from https://www.jacoco.org/jacoco/trunk/doc/examples/build/pom.xml -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>
<exclude>sorald/annotations/**/*.class</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
Comment on lines -209 to -233
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't dependenices like picocli and jacoco be in the top-level pom? I think they would be shared by all submodules?

Comment on lines -209 to -233
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't dependenices like picocli and jacoco be in the top-level pom? I think they would be shared by all submodules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No only sorald core (the sorald subfolder) needs the CLI feature currently. JaCoCo could be added to top level, but then we would force all projects implementing the API to use JaCoCo. I'm unsure if this is a great result.

<!-- adapted from https://github.com/diffplug/spotless/blob/main/plugin-maven/README.md -->
<plugin>
<groupId>com.diffplug.spotless</groupId>
Expand Down Expand Up @@ -335,4 +269,7 @@
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
<modules>
<module>sorald</module>
</modules>
</project>
Loading