Skip to content

Commit

Permalink
Add resources for IT
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarsotovalero committed Oct 24, 2022
1 parent 4803b73 commit 0cc86b6
Show file tree
Hide file tree
Showing 132 changed files with 279 additions and 13,107 deletions.
362 changes: 196 additions & 166 deletions .img/logo.ai

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## What is DepTrim?

DepTrim automatically diversifies dependencies in Maven projects for hardening its [software supply chain](https://www.cesarsotovalero.net/blog/the-software-supply-chain.html).
DepTrim automatically diversifies dependencies in Maven projects with the objective of hardening its [software supply chain](https://www.cesarsotovalero.net/blog/the-software-supply-chain.html).
To do so, it creates different variants of the dependencies in the dependency tree of a project.
DepTrim works as a Maven plugin.
It can be executed as a Maven goal through the command line or integrated directly into the Maven build lifecycle (CI/CD).
Expand Down
72 changes: 70 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<!-- Coordinates -->
<groupId>se.kth.castor</groupId>
<artifactId>deptrim</artifactId>
<artifactId>deptrim-maven-plugin</artifactId>
<version>0.0.1</version>
<packaging>maven-plugin</packaging>

Expand Down Expand Up @@ -103,7 +103,7 @@
<artifactId>slf4j-reload4j</artifactId>
<version>${slf4j-reload4j.version}</version>
</dependency>
<!-- Testing -->
<!-- Unit tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand All @@ -122,6 +122,32 @@
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
<!-- Integration tests -->
<!-- see https://khmarbaise.github.io/maven-it-extension/itf-documentation/usersguide/usersguide.html#_grouping_test_cases -->
<dependency>
<groupId>com.soebes.itf.jupiter.extension</groupId>
<artifactId>itf-extension-maven</artifactId>
<version>0.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.soebes.itf.jupiter.extension</groupId>
<artifactId>itf-assertj</artifactId>
<version>0.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.soebes.itf.jupiter.extension</groupId>
<artifactId>itf-jupiter-extension</artifactId>
<version>0.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.23.1</version>
<scope>test</scope>
</dependency>
<!--Maven tools for plugin construction-->
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -152,7 +178,49 @@

<!-- Build options -->
<build>
<!-- Integration tests -->
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
</testResource>
<testResource>
<directory>src/test/resources-its</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>com.soebes.itf.jupiter.extension</groupId>
<artifactId>itf-maven-plugin</artifactId>
<version>0.11.0</version>
<executions>
<execution>
<id>installing</id>
<phase>pre-integration-test</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
<!--Fix plugin descriptor-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo;
package se.kth.deptrim;

import java.io.File;
import java.io.IOException;
Expand All @@ -24,7 +24,7 @@
import se.kth.depclean.core.wrapper.DependencyManagerWrapper;
import se.kth.depclean.core.wrapper.LogWrapper;
import se.kth.depclean.util.MavenInvoker;
import se.kth.deptrim.mojo.util.TimeUtils;
import se.kth.deptrim.util.TimeUtils;

/**
* Runs the DepTrim process, regardless of a specific dependency manager.
Expand Down Expand Up @@ -165,7 +165,7 @@ private void trimLibClasses(ProjectDependencyAnalysis analysis, Set<String> trim
file.delete();
}
// Delete all empty directories in destDir.
se.kth.deptrim.mojo.util.FileUtils fileUtils = new se.kth.deptrim.mojo.util.FileUtils();
se.kth.deptrim.util.FileUtils fileUtils = new se.kth.deptrim.util.FileUtils();
fileUtils.deleteEmptyDirectories(destDir);

// Create a new jar file with the debloated classes and move it to libs-deptrim.
Expand All @@ -174,7 +174,7 @@ private void trimLibClasses(ProjectDependencyAnalysis analysis, Set<String> trim
File jarFile = libDeptrimPath.resolve(jarName).toFile();
try {
Files.createDirectories(libDeptrimPath); // create libs-deptrim directory if it does not exist
se.kth.deptrim.mojo.util.JarUtils.createJarFromDirectory(destDir, jarFile);
se.kth.deptrim.util.JarUtils.createJarFromDirectory(destDir, jarFile);
} catch (Exception e) {
getLog().error("Error creating trimmed jar for " + destDir.getName());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo;
package se.kth.deptrim;

import java.util.Set;
import lombok.SneakyThrows;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo.util;
package se.kth.deptrim.util;

import java.io.File;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo.util;
package se.kth.deptrim.util;

import java.io.BufferedInputStream;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo.util;
package se.kth.deptrim.util;

public class PomUtils {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo.util;
package se.kth.deptrim.util;

import java.util.concurrent.TimeUnit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo;
package se.kth.deptrim.util;

import java.io.File;
import java.io.IOException;
Expand All @@ -7,7 +7,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.rules.TemporaryFolder;
import se.kth.deptrim.mojo.util.JarUtils;

class JarUtilsTest {

Expand All @@ -31,7 +30,7 @@ void setUp() {

@Test
void ifCreateJarFromDirectoryThenJarShouldExist() throws Exception {
jarUtils.createJarFromDirectory(temporaryFolder.getRoot(), jarFile);
JarUtils.createJarFromDirectory(temporaryFolder.getRoot(), jarFile);
Assertions.assertTrue(jarFile.exists() && !jarFile.isDirectory());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package se.kth.deptrim.mojo.util;
package se.kth.deptrim.util;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/kryo-serializers/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions src/test/resources/kryo-serializers/.idea/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/resources/kryo-serializers/.idea/aws.xml

This file was deleted.

Loading

0 comments on commit 0cc86b6

Please sign in to comment.