Java portgroup default fallback?
nils at breun.nl
Fri Feb 24 13:51:58 UTC 2023
Joshua Root <jmr at macports.org> wrote:
> On 24/2/2023 11:44, Nils Breunese wrote:
>> Latest LTS (currently openjdk17) could be reasonable, but ideally the fallback version should be verified to work. If that implicitly happens on CI, because there is never a pre-existing Java installation there, then I guess that’s could be ok, although I personally think it’s good to have explicitly set fallback versions.
> Yes, it would need to be a dynamic default, taking into account the OS version, build_arch, and java.version in order to pick a JDK port that will work.
A specific fallback port provides a specific Java feature version. A Java fallback port should indeed support all archs supported by the port that is getting installed, but most of them support both x86_64 and arm64. But if necessary java.fallback could be set conditionally based on anything.
> I don't understand why having individual ports set their own fallback version would be considered better in general, since it doesn't actually guarantee that a specific JDK will be present. The portgroup's behaviour is to use any installed JDK that meets the requirement given in java.version. Ports that need a specific JDK need to explicitly declare a dependency on it either way.
If no Java version that meets the java.version requirement is present, then the java.fallback port will be installed. When that happens I think it should be a Java port that actually works for the port, not some default that ‘hopefully works’, so that is why I’m in favor of port maintainers setting a fallback Java port explicitly.
More information about the macports-dev