Skip to content

Commit

Permalink
[templates] update jlink/nativeImage templates with platform informat…
Browse files Browse the repository at this point in the history
…ion. Resolves #591
  • Loading branch information
aalmiray committed Dec 12, 2021
1 parent c6c89b6 commit 171923d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
Expand Up @@ -20,6 +20,7 @@ long_description {{projectLongDescription}}
homepage {{projectWebsite}}

master_sites {{macportsDistributionUrl}}
distname {{macportsDistname}}
use_zip yes

checksums rmd160 {{distributionChecksumRmd160}} \
Expand Down
Expand Up @@ -19,6 +19,7 @@ long_description {{projectLongDescription}}
homepage {{projectWebsite}}

master_sites {{macportsDistributionUrl}}
distname {{macportsDistname}}
use_zip yes

checksums rmd160 {{distributionChecksumRmd160}} \
Expand Down
Expand Up @@ -330,13 +330,15 @@ protected boolean verifyAndAddArtifacts(Map<String, Object> props,
if (artifactName.endsWith("-")) {
artifactName = artifactName.substring(0, artifactName.length() - 1);
}
artifactVersion = projectVersion;
}
projectVersion = context.getModel().getProject().getVersion();
if (isBlank(artifactName) && isNotBlank(projectVersion) && artifactFileName.contains(projectVersion)) {
artifactName = artifactFileName.substring(0, artifactFileName.indexOf(projectVersion));
if (artifactName.endsWith("-")) {
artifactName = artifactName.substring(0, artifactName.length() - 1);
}
artifactVersion = projectVersion;
}

String artifactOs = "";
Expand Down
Expand Up @@ -31,8 +31,12 @@

import static org.jreleaser.templates.TemplateUtils.trimTplExtension;
import static org.jreleaser.util.Constants.KEY_DISTRIBUTION_ARTIFACT_FILE;
import static org.jreleaser.util.Constants.KEY_DISTRIBUTION_ARTIFACT_FILE_NAME;
import static org.jreleaser.util.Constants.KEY_DISTRIBUTION_ARTIFACT_NAME;
import static org.jreleaser.util.Constants.KEY_DISTRIBUTION_ARTIFACT_VERSION;
import static org.jreleaser.util.Constants.KEY_DISTRIBUTION_URL;
import static org.jreleaser.util.Constants.KEY_MACPORTS_CATEGORIES;
import static org.jreleaser.util.Constants.KEY_MACPORTS_DISTNAME;
import static org.jreleaser.util.Constants.KEY_MACPORTS_DISTRIBUTION_URL;
import static org.jreleaser.util.Constants.KEY_MACPORTS_JAVA_VERSION;
import static org.jreleaser.util.Constants.KEY_MACPORTS_MAINTAINERS;
Expand Down Expand Up @@ -87,6 +91,12 @@ protected void fillToolProperties(Map<String, Object> props, Distribution distri
}
distributionUrl = distributionUrl.replace(context.getModel().getProject().getEffectiveVersion(), "${version}");
props.put(KEY_MACPORTS_DISTRIBUTION_URL, distributionUrl);

String artifactFileName = (String) props.get(KEY_DISTRIBUTION_ARTIFACT_FILE_NAME);
String artifactName = (String) props.get(KEY_DISTRIBUTION_ARTIFACT_NAME);
String artifactVersion = (String) props.get(KEY_DISTRIBUTION_ARTIFACT_VERSION);
props.put(KEY_MACPORTS_DISTNAME, artifactFileName.replace(artifactName, "${name}")
.replace(artifactVersion, "${version}"));
}

private String resolveJavaVersion(Distribution distribution) {
Expand Down
Expand Up @@ -222,6 +222,7 @@ public interface Constants {
String KEY_MACPORTS_CATEGORIES = "macportsCategories";
String KEY_MACPORTS_MAINTAINERS = "macportsMaintainers";
String KEY_MACPORTS_DISTRIBUTION_URL = "macportsDistributionUrl";
String KEY_MACPORTS_DISTNAME = "macportsDistname";
String KEY_MACPORTS_JAVA_VERSION = "macportsJavaVersion";
String KEY_MACPORTS_REPOSITORY_REPO_URL = "macportsRepositoryRepoUrl";
String KEY_MACPORTS_REPOSITORY_REPO_CLONE_URL = "macportsRepositoryRepoCloneUrl";
Expand Down
Expand Up @@ -19,6 +19,7 @@ long_description {{projectLongDescription}}
homepage {{projectWebsite}}

master_sites {{macportsDistributionUrl}}
distname {{macportsDistname}}
use_zip yes

checksums rmd160 {{distributionChecksumRmd160}} \
Expand Down

0 comments on commit 171923d

Please sign in to comment.