Note: This task should be performed before GenerateJavadocSitemap
in order to have correct timestamps
inside the generated sitemaps.
This does not have any direct Ant dependencies. If only using this class, it is permissible to exclude the ant dependencies.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
mergeDirectory
(Instant outputTimestamp, boolean buildReproducible, boolean requireLastBuild, File lastBuildDirectory, File buildDirectory) Merges all*.aar
,*.jar
,*.war
, and*.zip
files betweenlastBuildDirectory
andbuildDirectory
.static void
mergeFile
(Instant outputTimestamp, boolean buildReproducible, File lastBuildArtifact, File buildArtifact) Creates a ZIP file with contents matchingbuildArtifact
but with timestamps derived fromlastBuildArtifact
.
-
Method Details
-
mergeFile
public static void mergeFile(Instant outputTimestamp, boolean buildReproducible, File lastBuildArtifact, File buildArtifact) throws IOException Creates a ZIP file with contents matchingbuildArtifact
but with timestamps derived fromlastBuildArtifact
.For each entry, if the content is byte-for-byte equal, maintains the time.
- Parameters:
outputTimestamp
- SeeZipTimestampMergeTask.setOutputTimestamp(java.lang.String)
buildReproducible
- SeeZipTimestampMergeTask.setBuildReproducible(boolean)
lastBuildArtifact
- The ZIP file from the last successful buildbuildArtifact
- The ZIP file from the current build- Throws:
IOException
-
mergeDirectory
public static void mergeDirectory(Instant outputTimestamp, boolean buildReproducible, boolean requireLastBuild, File lastBuildDirectory, File buildDirectory) throws IOException, ParseException Merges all*.aar
,*.jar
,*.war
, and*.zip
files betweenlastBuildDirectory
andbuildDirectory
. Artifacts inbuildDirectory
are overwritten in-place only when altered.Identifies the one-to-one mappings by matching artifactId, classifier (optional), and type. These are parsed from the filenames and make the following assumptions:
- All fields are separated by hyphens
'-'
- Version number begins with
[0-9]
- Type is everything after the final period and contains only
[a-zA-Z]
- Classifier is before the final period and contains only
[a-z-]
There must be only one possible mapping per unique
(artifactId, classifier, type)
. WhenrequireLastBuild = true
, there must be a one-to-one mapping in both directions betweenlastBuildDirectory
andbuildDirectory
. No file may be added or missing.Each mappings are resolved, calls
mergeFile(java.time.Instant, boolean, java.io.File, java.io.File)
for each pair of files.- Parameters:
outputTimestamp
- SeeZipTimestampMergeTask.setOutputTimestamp(java.lang.String)
buildReproducible
- SeeZipTimestampMergeTask.setBuildReproducible(boolean)
requireLastBuild
- SeeZipTimestampMergeTask.setRequireLastBuild(boolean)
lastBuildDirectory
- SeeZipTimestampMergeTask.setLastBuildDirectory(java.lang.String)
buildDirectory
- SeeZipTimestampMergeTask.setBuildDirectory(java.lang.String)
- Throws:
IOException
ParseException
- All fields are separated by hyphens
-