Skip to content

Commit 5913227

Browse files
committed
replace sourceDateEpoch with a Date
1 parent 6964b62 commit 5913227

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,10 +1259,10 @@ public String getOverrideGroupName()
12591259
}
12601260

12611261
@Override
1262-
public void configureReproducible( int sourceDateEpoch )
1262+
public void configureReproducible( Date outputTimestamp )
12631263
{
12641264
// 1. force last modified date
1265-
setLastModifiedDate( convertSourceDateEpochToDate( sourceDateEpoch ) );
1265+
setLastModifiedDate( convertOutputTimestamp( outputTimestamp ) );
12661266

12671267
// 2. sort filenames in each directory when scanning filesystem
12681268
setFilenameComparator( new Comparator<String>()
@@ -1286,8 +1286,8 @@ public int compare( String s1, String s2 )
12861286
setOverrideGroupName( "root" );
12871287
}
12881288

1289-
protected Date convertSourceDateEpochToDate( int sourceDateEpoch )
1289+
protected Date convertOutputTimestamp( Date outputTimestamp )
12901290
{
1291-
return new Date( sourceDateEpoch * 1000L );
1291+
return outputTimestamp;
12921292
}
12931293
}

src/main/java/org/codehaus/plexus/archiver/Archiver.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,8 @@ ResourceIterator getResources()
468468
* Builds</a>). This will require reproducible archive entries order, defined entries timestamp and reproducible
469469
* entries Unix mode.
470470
*
471-
* @param sourceDateEpoch Value like SOURCE_DATE_EPOCH as
472-
* <a href="https://reproducible-builds.org/specs/source-date-epoch/">defined in Reproducible Builds</a>:
473-
* a UNIX timestamp, defined as the number of seconds, excluding leap seconds, since 01 Jan 1970 00:00:00
474-
* UTC.
471+
* @param outputTimestamp the date to use for archive entries last modified time
475472
* @since 4.2.0
476473
*/
477-
void configureReproducible( int sourceDateEpoch );
474+
void configureReproducible( Date outputTimestamp );
478475
}

src/main/java/org/codehaus/plexus/archiver/diags/DelgatingArchiver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ public String getOverrideGroupName()
400400
}
401401

402402
@Override
403-
public void configureReproducible( int sourceDateEpoch )
403+
public void configureReproducible( Date outputTimestamp )
404404
{
405-
target.configureReproducible( sourceDateEpoch );
405+
target.configureReproducible( outputTimestamp );
406406
}
407407

408408
}

src/main/java/org/codehaus/plexus/archiver/diags/NoOpArchiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public String getOverrideGroupName()
415415
}
416416

417417
@Override
418-
public void configureReproducible( int sourceDateEpoch )
418+
public void configureReproducible( Date outputTimestamp )
419419
{
420420

421421
}

src/main/java/org/codehaus/plexus/archiver/diags/TrackingArchiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public String getOverrideGroupName()
470470
}
471471

472472
@Override
473-
public void configureReproducible( int sourceDateEpoch )
473+
public void configureReproducible( Date outputTimestamp )
474474
{
475475
}
476476
}

src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipArchiver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,12 +836,12 @@ protected String getArchiveType()
836836
}
837837

838838
@Override
839-
protected Date convertSourceDateEpochToDate( int sourceDateEpoch )
839+
protected Date convertOutputTimestamp( Date outputTimestamp )
840840
{
841841
// timestamp of zip entries at zip storage level ignores timezone: managed in ZipEntry.setTime,
842842
// that turns javaToDosTime: need to revert the operation here to get reproducible
843843
// zip entry time
844-
return new Date( dosToJavaTime( 1000L * sourceDateEpoch ) );
844+
return new Date( dosToJavaTime( outputTimestamp.getTime() ) );
845845
}
846846

847847
/**

0 commit comments

Comments
 (0)