diff --git a/core/jreleaser-model/src/main/java/org/jreleaser/model/Macports.java b/core/jreleaser-model/src/main/java/org/jreleaser/model/Macports.java index 1ff9e146c..300b5b750 100644 --- a/core/jreleaser-model/src/main/java/org/jreleaser/model/Macports.java +++ b/core/jreleaser-model/src/main/java/org/jreleaser/model/Macports.java @@ -124,13 +124,16 @@ public RepositoryTap getRepositoryTap() { @Override public boolean supportsPlatform(String platform) { - return isBlank(platform) || PlatformUtils.isMac(platform); + return isBlank(platform) || + (PlatformUtils.isMac(platform) && PlatformUtils.isIntel(platform)); } @Override public boolean supportsDistribution(Distribution distribution) { return distribution.getType() == Distribution.DistributionType.JAVA_BINARY || - distribution.getType() == Distribution.DistributionType.NATIVE_IMAGE; + distribution.getType() == Distribution.DistributionType.JLINK || + distribution.getType() == Distribution.DistributionType.NATIVE_IMAGE || + distribution.getType() == Distribution.DistributionType.BINARY; } public static class MacportsRepository extends AbstractRepositoryTap { diff --git a/core/jreleaser-model/src/main/java/org/jreleaser/model/validation/MacportsValidator.java b/core/jreleaser-model/src/main/java/org/jreleaser/model/validation/MacportsValidator.java index c7ea0b537..cfb3286db 100644 --- a/core/jreleaser-model/src/main/java/org/jreleaser/model/validation/MacportsValidator.java +++ b/core/jreleaser-model/src/main/java/org/jreleaser/model/validation/MacportsValidator.java @@ -17,6 +17,8 @@ */ package org.jreleaser.model.validation; +import org.jreleaser.bundle.RB; +import org.jreleaser.model.Active; import org.jreleaser.model.Artifact; import org.jreleaser.model.Distribution; import org.jreleaser.model.GitService; @@ -27,8 +29,10 @@ import org.jreleaser.util.Errors; import java.util.Collections; +import java.util.List; import java.util.Set; +import static java.util.stream.Collectors.toList; import static org.jreleaser.model.validation.DistributionsValidator.validateArtifactPlatforms; import static org.jreleaser.model.validation.ExtraPropertiesValidator.mergeExtraProperties; import static org.jreleaser.model.validation.TemplateValidator.validateTemplate; @@ -91,14 +95,21 @@ public static void validateMacports(JReleaserContext context, Distribution distr } } - // activate rmd160 checksum Set fileExtensions = tool.getSupportedExtensions(); - long count = distribution.getArtifacts().stream() + List candidateArtifacts = distribution.getArtifacts().stream() .filter(Artifact::isActive) .filter(artifact -> fileExtensions.stream().anyMatch(ext -> artifact.getPath().endsWith(ext))) .filter(artifact -> tool.supportsPlatform(artifact.getPlatform())) - .count(); - if (count > 0) { + .collect(toList()); + + if (candidateArtifacts.size() == 0) { + tool.setActive(Active.NEVER); + tool.disable(); + } else if(candidateArtifacts.size()> 1) { + errors.configuration(RB.$("validation_tool_multiple_artifacts", "distribution." + distribution.getName() + ".macports")); + tool.disable(); + } else { + // activate rmd160 checksum context.getModel().getChecksum().getAlgorithms().add(Algorithm.RMD160); } } diff --git a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates.properties b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates.properties index 7fef3ab32..2fd334f3f 100644 --- a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates.properties +++ b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates.properties @@ -41,11 +41,13 @@ java-binary.chocolatey=binary.nuspec.tpl,tools/chocolateyinstall.ps1.tpl,tools/c binary.docker=Dockerfile.tpl,Dockerfile-remote.tpl binary.scoop=README.md.tpl,manifest.json.tpl binary.brew=formula-multi.rb.tpl,cask.rb.tpl,README.md.tpl,formula.rb.tpl +binary.macports=Portfile.tpl binary.snap=README.md.tpl,snap/snapcraft.yaml.tpl native-package.brew=cask.rb.tpl,README.md.tpl jlink.docker=Dockerfile.tpl,Dockerfile-remote.tpl jlink.scoop=README.md.tpl,manifest.json.tpl jlink.brew=formula-multi.rb.tpl,cask.rb.tpl,README.md.tpl,formula.rb.tpl +jlink.macports=Portfile.tpl jlink.snap=README.md.tpl,/snap/snapcraft.yaml.tpl jlink.spec=app.spec.tpl jlink.chocolatey=binary.nuspec.tpl,tools/chocolateyinstall.ps1.tpl,tools/chocolateyuninstall.ps1.tpl diff --git a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/binary/macports/Portfile.tpl b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/binary/macports/Portfile.tpl new file mode 100644 index 000000000..a5b09b4b4 --- /dev/null +++ b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/binary/macports/Portfile.tpl @@ -0,0 +1,47 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# [JRELEASER_VERSION] + +PortSystem 1.0 + +name {{macportsPackageName}} +version {{projectVersion}} +revision {{macportsRevision}} + +categories {{macportsCategories}} +license {{projectLicense}} +maintainers {{macportsMaintainers}} +platforms darwin +supported_archs x86_64 + +description {{projectDescription}} +long_description {{projectLongDescription}} + +homepage {{projectWebsite}} + +master_sites {{macportsDistributionUrl}} +distname {{macportsDistname}} +use_zip yes + +checksums rmd160 {{distributionChecksumRmd160}} \ + sha256 {{distributionChecksumSha256}} \ + size {{distributionSize}} + +use_configure no + +build {} + +destroot { + set target ${destroot}${prefix}/share/${name} + + # Create the target directory + xinstall -m 755 -d ${target} + + # Copy over the needed elements of our directory tree + foreach f [glob -dir ${worksrcpath} *] { + copy ${f} ${target} + } + + ln -s ../share/${name}/bin/{{distributionExecutable}} ${destroot}${prefix}/bin/{{distributionExecutable}} +} + +livecheck.type none diff --git a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/java-binary/macports/Portfile.tpl b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/java-binary/macports/Portfile.tpl index 3895434e2..02f905f55 100644 --- a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/java-binary/macports/Portfile.tpl +++ b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/java-binary/macports/Portfile.tpl @@ -34,14 +34,14 @@ use_configure no build {} destroot { - set target ${destroot}${prefix}/share/java/${name} + set target ${destroot}${prefix}/share/${name} - # Create the target java directory + # Create the target directory xinstall -m 755 -d ${target} # Copy over the needed elements of our directory tree - foreach d { bin lib } { - copy ${worksrcpath}/${d} ${target} + foreach f [glob -dir ${worksrcpath} *] { + copy ${f} ${target} } # Remove extraneous files @@ -49,7 +49,7 @@ destroot { delete ${f} } - ln -s ../share/java/${name}/bin/{{distributionExecutable}} ${destroot}${prefix}/bin/{{distributionExecutable}} + ln -s ../share/${name}/bin/{{distributionExecutable}} ${destroot}${prefix}/bin/{{distributionExecutable}} } livecheck.type none diff --git a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/jlink/macports/Portfile.tpl b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/jlink/macports/Portfile.tpl new file mode 100644 index 000000000..a5b09b4b4 --- /dev/null +++ b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/jlink/macports/Portfile.tpl @@ -0,0 +1,47 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# [JRELEASER_VERSION] + +PortSystem 1.0 + +name {{macportsPackageName}} +version {{projectVersion}} +revision {{macportsRevision}} + +categories {{macportsCategories}} +license {{projectLicense}} +maintainers {{macportsMaintainers}} +platforms darwin +supported_archs x86_64 + +description {{projectDescription}} +long_description {{projectLongDescription}} + +homepage {{projectWebsite}} + +master_sites {{macportsDistributionUrl}} +distname {{macportsDistname}} +use_zip yes + +checksums rmd160 {{distributionChecksumRmd160}} \ + sha256 {{distributionChecksumSha256}} \ + size {{distributionSize}} + +use_configure no + +build {} + +destroot { + set target ${destroot}${prefix}/share/${name} + + # Create the target directory + xinstall -m 755 -d ${target} + + # Copy over the needed elements of our directory tree + foreach f [glob -dir ${worksrcpath} *] { + copy ${f} ${target} + } + + ln -s ../share/${name}/bin/{{distributionExecutable}} ${destroot}${prefix}/bin/{{distributionExecutable}} +} + +livecheck.type none diff --git a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/native-image/macports/Portfile.tpl b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/native-image/macports/Portfile.tpl index d00c47723..a5b09b4b4 100644 --- a/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/native-image/macports/Portfile.tpl +++ b/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/native-image/macports/Portfile.tpl @@ -37,8 +37,8 @@ destroot { xinstall -m 755 -d ${target} # Copy over the needed elements of our directory tree - foreach d { bin } { - copy ${worksrcpath}/${d} ${target} + foreach f [glob -dir ${worksrcpath} *] { + copy ${f} ${target} } ln -s ../share/${name}/bin/{{distributionExecutable}} ${destroot}${prefix}/bin/{{distributionExecutable}} diff --git a/jreleaser.yml b/jreleaser.yml index 938ba48c1..65aeb184a 100644 --- a/jreleaser.yml +++ b/jreleaser.yml @@ -206,6 +206,8 @@ distributions: artifacts: - path: apps/{{distributionName}}/build/distributions/{{distributionName}}-{{projectVersion}}.zip transform: '{{distributionName}}/{{distributionName}}-{{projectEffectiveVersion}}.zip' + extraProperties: + skipSpec: true - path: apps/{{distributionName}}/build/distributions/{{distributionName}}-{{projectVersion}}.tar transform: '{{distributionName}}/{{distributionName}}-{{projectEffectiveVersion}}.tar' diff --git a/src/jreleaser/distributions/jreleaser/macports/Portfile.tpl b/src/jreleaser/distributions/jreleaser/macports/Portfile.tpl index 86480485f..1631fef89 100644 --- a/src/jreleaser/distributions/jreleaser/macports/Portfile.tpl +++ b/src/jreleaser/distributions/jreleaser/macports/Portfile.tpl @@ -33,14 +33,14 @@ use_configure no build {} destroot { - set target ${destroot}${prefix}/share/java/${name} + set target ${destroot}${prefix}/share/${name} - # Create the target java directory + # Create the target directory xinstall -m 755 -d ${target} # Copy over the needed elements of our directory tree - foreach d { bin lib } { - copy ${worksrcpath}/${d} ${target} + foreach f [glob -dir ${worksrcpath} *] { + copy ${f} ${target} } # Remove extraneous files @@ -48,7 +48,7 @@ destroot { delete ${f} } - ln -s ../share/java/${name}/bin/{{distributionExecutable}} ${destroot}${prefix}/bin/{{distributionExecutable}} + ln -s ../share/${name}/bin/{{distributionExecutable}} ${destroot}${prefix}/bin/{{distributionExecutable}} } livecheck.type regex