com.teamtter.mavennatives.nativedependencies.UnpackedArtifactsInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nativedependencies-maven-plugin Show documentation
Show all versions of nativedependencies-maven-plugin Show documentation
This plugin allows the automatic unpacking of natives in jars depending on a classifier with a certain pattern.
It is a fork from http://code.google.com/p/mavennatives/ . Thanks to the original authors [email protected] and [email protected] !
package com.teamtter.mavennatives.nativedependencies;
import java.io.File;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import lombok.Data;
@Data
public class UnpackedArtifactsInfo {
private Map pathToLastModified = new HashMap<>();
public void flagAsUnpacked(File file) {
Path normalizedPath = file.toPath().normalize();
String pathAsString = normalizedPath.toString();
long lastModified = file.lastModified();
pathToLastModified.put(pathAsString, lastModified);
}
public boolean containsExactly(File currentArtifactFile) {
boolean contains = false;
String normalizedPath = currentArtifactFile.toPath().normalize().toString();
Long lastModifiedDate = pathToLastModified.get(normalizedPath);
if (lastModifiedDate != null) {
long currentArtifactLastModifiedDate = currentArtifactFile.lastModified();
if (currentArtifactLastModifiedDate == lastModifiedDate) {
contains = true;
}
}
return contains;
}
}