Skip to content

Commit

Permalink
[MSOURCES-135] Cleanup project code
Browse files Browse the repository at this point in the history
- fix dependencies according to output of dependency:analyze
- bump plexus-utils to 3.5.1
- don't use deprecated methods
  • Loading branch information
slawekjaranowski committed May 17, 2023
1 parent 021af55 commit f186993
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
20 changes: 15 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ under the License.
<project.build.outputTimestamp>2019-12-16T18:10:36Z</project.build.outputTimestamp>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -122,13 +132,13 @@ under the License.
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.4.2</version>
<artifactId>plexus-archiver</artifactId>
<version>4.7.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
</dependency>

<dependency>
Expand Down
3 changes: 2 additions & 1 deletion src/it/reproducible/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ zipFile.close();
String buf = r.toString()
println buf

assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" )
// on Windows executable bit is not set
assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" ) || buf.startsWith( "reproducible-1.0-sources.jar sha1 = e14cb3b37b6d82db1728886d1959ad0cd79708d8" )
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.jar.JarArchiver;
import org.codehaus.plexus.archiver.jar.ManifestException;
import org.codehaus.plexus.archiver.util.DefaultFileSet;
import org.codehaus.plexus.util.FileUtils;

/**
Expand Down Expand Up @@ -420,8 +421,7 @@ protected void addDirectory(Archiver archiver, File sourceDirectory, String[] pI
throws MojoExecutionException {
try {
getLog().debug("add directory " + sourceDirectory + " to archiver");
// archiver.addFileSet( fileSet );
archiver.addDirectory(sourceDirectory, pIncludes, pExcludes);
archiver.addFileSet(DefaultFileSet.fileSet(sourceDirectory).includeExclude(pIncludes, pExcludes));
} catch (ArchiverException e) {
throw new MojoExecutionException("Error adding directory to source archive.", e);
}
Expand All @@ -440,7 +440,8 @@ protected void addDirectory(
throws MojoExecutionException {
try {
getLog().debug("add directory " + sourceDirectory + " to archiver with prefix " + prefix);
archiver.addDirectory(sourceDirectory, prefix, pIncludes, pExcludes);
archiver.addFileSet(
DefaultFileSet.fileSet(sourceDirectory).prefixed(prefix).includeExclude(pIncludes, pExcludes));
} catch (ArchiverException e) {
throw new MojoExecutionException("Error adding directory to source archive.", e);
}
Expand Down Expand Up @@ -486,12 +487,12 @@ private String[] getCombinedIncludes(List<String> additionalIncludes) {
combinedIncludes.addAll(Arrays.asList(includes));
}

if (additionalIncludes != null && additionalIncludes.size() > 0) {
if (additionalIncludes != null && !additionalIncludes.isEmpty()) {
combinedIncludes.addAll(additionalIncludes);
}

// If there are no other includes, use the default.
if (combinedIncludes.size() == 0) {
if (combinedIncludes.isEmpty()) {
combinedIncludes.addAll(Arrays.asList(DEFAULT_INCLUDES));
}

Expand All @@ -516,11 +517,11 @@ private String[] getCombinedExcludes(List<String> additionalExcludes) {
combinedExcludes.addAll(Arrays.asList(excludes));
}

if (additionalExcludes != null && additionalExcludes.size() > 0) {
if (additionalExcludes != null && !additionalExcludes.isEmpty()) {
combinedExcludes.addAll(additionalExcludes);
}

if (combinedExcludes.size() == 0) {
if (combinedExcludes.isEmpty()) {
combinedExcludes.addAll(Arrays.asList(DEFAULT_EXCLUDES));
}

Expand Down

0 comments on commit f186993

Please sign in to comment.