Skip to content

Commit

Permalink
Downgrade to Java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarsotovalero committed Jan 19, 2023
1 parent 26eadad commit aa75f24
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt-hotspot'
java-version: 17
java-version: 11
server-id: ossrh
server-username: OSSRH_USERNAME # env variable for username in release
server-password: OSSRH_TOKEN # env variable for token in release
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<!-- Project description-->
<name>DepTrim</name>
<description>DepTrim automatically specializes the software supply chain of dependencies in Maven projects.</description>
<description>DepTrim automatically specializes dependencies in Maven projects.</description>
<url>https://github.com/castor-software/deptrim</url>

<!-- Issues are managed on GitHub -->
Expand Down Expand Up @@ -52,10 +52,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Java version -->
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<compiler.release>11</compiler.release>
<javadoc.source>17</javadoc.source>
<javadoc.source>11</javadoc.source>
<!-- Plugin versions -->
<jacoco.maven.plugin>0.8.8</jacoco.maven.plugin>
<coveralls.maven.plugin>4.3.0</coveralls.maven.plugin>
Expand Down Expand Up @@ -358,7 +358,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin}</version>
<configuration>
<release>17</release>
<release>11</release>
</configuration>
</plugin>
<!-- Maven site -->
Expand Down Expand Up @@ -409,7 +409,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>17</release>
<release>11</release>
</configuration>
</plugin>
<!-- Maven source plugin -->
Expand Down
17 changes: 14 additions & 3 deletions src/main/java/se/kth/deptrim/util/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand All @@ -24,9 +25,19 @@ public class FileUtils {
* @param directory the directory to delete empty directories from
*/
public int deleteEmptyDirectories(File directory) {
List<File> toBeDeleted = Arrays.stream(Objects.requireNonNull(directory.listFiles())).sorted()
.filter(File::isDirectory)
.filter(f -> f.listFiles().length == deleteEmptyDirectories(f)).toList();
List<File> toSort = new ArrayList<>();
for (File f : Objects.requireNonNull(directory.listFiles())) {
toSort.add(f);
}
toSort.sort(null);
List<File> toBeDeleted = new ArrayList<>();
for (File f : toSort) {
if (f.isDirectory()) {
if (f.listFiles().length == deleteEmptyDirectories(f)) {
toBeDeleted.add(f);
}
}
}
int size = toBeDeleted.size();
toBeDeleted.forEach(t -> {
try {
Expand Down

0 comments on commit aa75f24

Please sign in to comment.