All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aya.gradle.JdkUrls Maven / Gradle / Ivy

The newest version!
// Copyright (c) 2020-2023 Tesla (Yinsen) Zhang.
// Use of this source code is governed by the MIT license that can be found in the LICENSE.md file.
package org.aya.gradle;

public record JdkUrls(int javaVersion, String platform) {
  public static final String GARBAGE_SUFFIX = "-LTS";

  public String libericaJDK() {
    var libericaJdkVersion = System.getProperty("java.vm.version");
    if (libericaJdkVersion.endsWith(GARBAGE_SUFFIX)) {
      libericaJdkVersion = libericaJdkVersion.substring(0, libericaJdkVersion.length() - "-LTS".length());
    }

    var fixAmd64 = platform.replace("x64", "amd64");
    var suffix = platform.contains("linux") ? "tar.gz" : "zip";
    // "https://download.bell-sw.com/java/${libericaJdkVersion}/bellsoft-jdk${libericaJdkVersion}-${fixAmd64}.$suffix"
    return "https://download.bell-sw.com/java/" + libericaJdkVersion + "/bellsoft-jdk"
      + libericaJdkVersion + '-' + fixAmd64 + '.' + suffix;
  }

  public String riscv64JDK() {
    return "https://github.com/imkiva/openjdk-riscv-build/releases/download/bootstrap/openjdk-jdk" + javaVersion + "-" + platform + ".tar.gz";
  }

  public String jdk() {
    if (platform.contains("linux") && platform.contains("riscv")) return riscv64JDK();
    return libericaJDK();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy