use of org.jreleaser.util.Constants.KEY_PROJECT_VERSION in project jreleaser by jreleaser.
the class SpecPackagerProcessor method setupJavaBinary.
private void setupJavaBinary(Distribution distribution, Map<String, Object> props) throws PackagerProcessingException {
Artifact artifact = (Artifact) props.get(KEY_DISTRIBUTION_ARTIFACT);
Path artifactPath = artifact.getResolvedPath(context, distribution);
String artifactFileName = getFilename(artifactPath.getFileName().toString(), packager.getSupportedExtensions(distribution));
try {
List<String> entries = FileUtils.inspectArchive(artifactPath);
Set<String> directories = new LinkedHashSet<>();
List<String> binaries = new ArrayList<>();
List<String> files = new ArrayList<>();
entries.stream().filter(e -> !e.endsWith(distribution.getExecutable().resolveWindowsExtension())).filter(e -> !e.endsWith("/")).map(e -> e.substring(artifactFileName.length() + 1)).filter(e -> e.startsWith("bin/")).sorted().forEach(entry -> {
String[] parts = entry.split("/");
binaries.add(parts[1]);
});
entries.stream().filter(e -> !e.endsWith(distribution.getExecutable().resolveWindowsExtension())).filter(e -> !e.endsWith("/")).map(e -> e.substring(artifactFileName.length() + 1)).filter(e -> !e.startsWith("bin/")).sorted().forEach(entry -> {
String[] parts = entry.split("/");
if (parts.length > 1)
directories.add(parts[0]);
files.add(entry);
});
props.put(KEY_PROJECT_VERSION, context.getModel().getProject().version().toRpmVersion());
props.put(KEY_SPEC_DIRECTORIES, directories);
props.put(KEY_SPEC_BINARIES, binaries);
props.put(KEY_SPEC_FILES, files);
} catch (IOException e) {
throw new PackagerProcessingException("ERROR", e);
}
}
Aggregations