Skip to content

Commit

Permalink
Restore maven-archiver as a compile scoped dependency to fix reproduc…
Browse files Browse the repository at this point in the history
…ible builds (#736)

Additionally use non-deprecated MavenArchiver.parseBuildOutputTimestamp() method
  • Loading branch information
norrisjeremy authored and tcurdt committed Aug 27, 2024
1 parent 4f6dc57 commit 6d88f60
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@
<scope>${maven.scope}</scope>
</dependency>
<dependency>
<!-- maven-archiver must be compile scope, see #736 -->
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
<version>3.6.2</version>
<scope>${maven.scope}</scope>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
Expand Down
36 changes: 36 additions & 0 deletions src/it/project-build-outputTimestamp/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.vafer</groupId>
<artifactId>jdeb-it</artifactId>
<version>1.0</version>
<description>description from pom</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.outputTimestamp>2024-08-26T14:00:00Z</project.build.outputTimestamp>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jdeb</goal>
</goals>
<configuration>
<verbose>true</verbose>
<controlDir>${basedir}/src/deb/control</controlDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
7 changes: 7 additions & 0 deletions src/it/project-build-outputTimestamp/src/deb/control/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Package: [[name]]
Version: [[version]]
Section: misc
Priority: low
Architecture: all
Description: [[description]]
Maintainer: [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.vafer.jdeb.examples;

public class Main {
public static void main(String[] args) {
System.out.println("jdeb example!");
}
}
1 change: 1 addition & 0 deletions src/it/project-build-outputTimestamp/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert new File( basedir, 'target/jdeb-it_1.0_all.deb' ).exists();
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.vafer.jdeb.utils;

import java.util.Date;
import java.time.Instant;
import java.util.Optional;
import java.util.concurrent.TimeUnit;

import org.apache.maven.archiver.MavenArchiver;
Expand All @@ -21,10 +22,10 @@ public OutputTimestampResolver(Console console) {

public Long resolveOutputTimestamp(String paramValue) {
if (paramValue != null) {
Date outputDate = new MavenArchiver().parseOutputTimestamp(paramValue);
if (outputDate != null) {
Optional<Instant> outputDate = MavenArchiver.parseBuildOutputTimestamp(paramValue);
if (outputDate.isPresent()) {
console.info("Accepted outputTimestamp parameter: " + paramValue);
return outputDate.getTime();
return outputDate.get().toEpochMilli();
}
}

Expand Down

0 comments on commit 6d88f60

Please sign in to comment.