Compare commits

..

No commits in common. "0e71949bc1dcb0055f40b988d08fe931b15cd720" and "fe8cd65c2b2bb1f594b23e2a5a1b5883e0e3e853" have entirely different histories.

4 changed files with 107 additions and 89 deletions

View File

@ -76,20 +76,29 @@
''; '';
}; };
in with import nixpkgs { system = system; }; { in with import nixpkgs { system = system; }; {
packages = { packages.temurin =
temurin = (builtins.mapAttrs (name: value: buildAdoptLike name value) (builtins.mapAttrs (name: value: buildAdoptLike name value)
sources.${system}.temurin.versions) // { sources.${system}.temurin.versions) // {
latest = buildAdoptLike "latest" sources.${system}.temurin.latest; latest = buildAdoptLike "latest" sources.${system}.temurin.latest;
stable = buildAdoptLike "stable" sources.${system}.temurin.stable; stable = buildAdoptLike "stable" sources.${system}.temurin.stable;
lts = buildAdoptLike "lts" sources.${system}.temurin.lts; lts = buildAdoptLike "lts" sources.${system}.temurin.lts;
}; };
semeru = (builtins.mapAttrs (name: value: buildAdoptLike name value)
packages.temurin-latest = self.packages.${system}.temurin.latest;
packages.temurin-stable = self.packages.${system}.temurin.stable;
packages.temurin-lts = self.packages.${system}.temurin.lts;
packages.semeru =
(builtins.mapAttrs (name: value: buildAdoptLike name value)
sources.${system}.semeru.versions) // { sources.${system}.semeru.versions) // {
latest = buildAdoptLike "latest" sources.${system}.semeru.latest; latest = buildAdoptLike "latest" sources.${system}.semeru.latest;
stable = buildAdoptLike "stable" sources.${system}.semeru.stable; stable = buildAdoptLike "stable" sources.${system}.semeru.stable;
lts = buildAdoptLike "lts" sources.${system}.semeru.lts; lts = buildAdoptLike "lts" sources.${system}.semeru.lts;
}; };
};
packages.semeru-latest = self.packages.${system}.semeru.latest;
packages.semeru-stable = self.packages.${system}.semeru.stable;
packages.semeru-lts = self.packages.${system}.semeru.lts;
defaultPackage = self.packages.${system}.temurin.stable; defaultPackage = self.packages.${system}.temurin.stable;
}); });

View File

@ -2,129 +2,159 @@
"aarch64-linux": { "aarch64-linux": {
"semeru": { "semeru": {
"versions": { "versions": {
"jdk10": {
"link": "https://github.com/AdoptOpenJDK/openjdk10-openj9-releases/releases/download/jdk-10.0.2%2B13_openj9-0.9.0/OpenJDK10-OPENJ9_x64_Linux_jdk-10.0.2.13_openj9-0.9.0.tar.gz",
"major_version": 10,
"sha256": "1ef0dab3853b2f3666091854ef8149fcb85970254558d5d62cfa9446831779d1",
"java_version": "10.0.2+13"
},
"jdk11": { "jdk11": {
"link": "https://github.com/AdoptOpenJDK/semeru11-binaries/releases/download/jdk-11.0.18%2B10_openj9-0.36.1/ibm-semeru-open-jdk_aarch64_linux_11.0.18_10_openj9-0.36.1.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru11-binaries/releases/download/jdk-11.0.18%2B10_openj9-0.36.1/ibm-semeru-open-jdk_x64_linux_11.0.18_10_openj9-0.36.1.tar.gz",
"major_version": 11, "major_version": 11,
"sha256": "499594963aeb85293992f1ee95856f0f1642fd4de350e36766616fc47098fd02", "sha256": "256135d0992f23acaf61cf955325e6a899ebbd41bb2c7fdd2fe7ac4c2ee55e38",
"java_version": "11.0.18+10" "java_version": "11.0.18+10"
}, },
"jdk12": {
"link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10_openj9-0.15.1/OpenJDK12U-jdk_x64_linux_openj9_12.0.2_10_openj9-0.15.1.tar.gz",
"major_version": 12,
"sha256": "e2f6f021560ddf217c60980ac147856e5b36f0ab0a0fd70091800d6042136229",
"java_version": "12.0.2+10"
},
"jdk13": {
"link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8_openj9-0.18.0/OpenJDK13U-jdk_x64_linux_openj9_13.0.2_8_openj9-0.18.0.tar.gz",
"major_version": 13,
"sha256": "aeecf6d30d0c847db81d07793cf97e5dc44890c29366d7d9f8f9f397f6c52590",
"java_version": "13.0.2+8"
},
"jdk14": {
"link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12_openj9-0.21.0/OpenJDK14U-jdk_x64_linux_openj9_14.0.2_12_openj9-0.21.0.tar.gz",
"major_version": 14,
"sha256": "306f7138cdb65daaf2596ec36cafbde72088144c83b2e964f0193662e6caf3be",
"java_version": "14.0.2+12"
},
"jdk15": { "jdk15": {
"link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7_openj9-0.24.0/OpenJDK15U-jdk_aarch64_linux_openj9_15.0.2_7_openj9-0.24.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7_openj9-0.24.0/OpenJDK15U-jdk_x64_linux_openj9_15.0.2_7_openj9-0.24.0.tar.gz",
"major_version": 15, "major_version": 15,
"sha256": "b69a4bc87ed2e985d252cff02d53f1a11b8d83d39e0800cd4a1cab4521375314", "sha256": "5515ccd79b1b5e8d8a615b80d5fe1272f7bb41100e46d94fb78ee611ea014816",
"java_version": "15.0.2-ea+7" "java_version": "15.0.2+7"
}, },
"jdk16": { "jdk16": {
"link": "https://github.com/AdoptOpenJDK/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.0/ibm-semeru-open-jdk_aarch64_linux_16.0.2_7_openj9-0.27.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.0/ibm-semeru-open-jdk_x64_linux_16.0.2_7_openj9-0.27.0.tar.gz",
"major_version": 16, "major_version": 16,
"sha256": "022cda1210331488c3db3d0d1282ea74467397fdabc34cb482cdfe81c45f6a15", "sha256": "1349eb9a1d9af491a1984d66a80126730357c4a5c4fcbe7112a2c832f6c0886e",
"java_version": "16.0.2-ea+7" "java_version": "16.0.2+7"
}, },
"jdk17": { "jdk17": {
"link": "https://github.com/AdoptOpenJDK/semeru17-binaries/releases/download/jdk-17.0.6%2B10_openj9-0.36.0/ibm-semeru-open-jdk_aarch64_linux_17.0.6_10_openj9-0.36.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru17-binaries/releases/download/jdk-17.0.6%2B10_openj9-0.36.0/ibm-semeru-open-jdk_x64_linux_17.0.6_10_openj9-0.36.0.tar.gz",
"major_version": 17, "major_version": 17,
"sha256": "7c6ef5b4989313b2e64b77613c13ec66a3fe85429732f63b6fe9f410d9e37d3c", "sha256": "ce39a4f7c2e08e56083f17f3e44c05e0fbbeba775e670f015a337679c99c54c6",
"java_version": "17.0.6+10" "java_version": "17.0.6+10"
}, },
"jdk18": { "jdk18": {
"link": "https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.2%2B9_openj9-0.33.1/ibm-semeru-open-jdk_aarch64_linux_18.0.2_9_openj9-0.33.1.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.2%2B9_openj9-0.33.1/ibm-semeru-open-jdk_x64_linux_18.0.2_9_openj9-0.33.1.tar.gz",
"major_version": 18, "major_version": 18,
"sha256": "00e46a2b8be005eb03e3e4d939d4cf9b8331f22ee50ed75b84136d3f0ead7498", "sha256": "b694d47666035b1f7870bc3749aa7c1903d50976eab3772fd81c32dab2aa8e64",
"java_version": "18.0.2+9" "java_version": "18.0.2+9"
}, },
"jdk19": { "jdk19": {
"link": "https://github.com/AdoptOpenJDK/semeru19-binaries/releases/download/jdk-19.0.2%2B7_openj9-0.37.0/ibm-semeru-open-jdk_aarch64_linux_19.0.2_7_openj9-0.37.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru19-binaries/releases/download/jdk-19.0.2%2B7_openj9-0.37.0/ibm-semeru-open-jdk_x64_linux_19.0.2_7_openj9-0.37.0.tar.gz",
"major_version": 19, "major_version": 19,
"sha256": "c20cd3c641eebc3e534fa4ce05b211fc8bcd011eb392ceda40d3fadd35f5f8d0", "sha256": "5fd94c57afe0d4e778bfc284f3f7830c34de59bed4faba12d4bb46a77d0b516e",
"java_version": "19.0.2+7" "java_version": "19.0.2+7"
}, },
"jdk8": { "jdk8": {
"link": "https://github.com/AdoptOpenJDK/semeru8-binaries/releases/download/jdk8u362-b09_openj9-0.36.0/ibm-semeru-open-jdk_aarch64_linux_8u362b09_openj9-0.36.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru8-binaries/releases/download/jdk8u362-b09_openj9-0.36.0/ibm-semeru-open-jdk_x64_linux_8u362b09_openj9-0.36.0.tar.gz",
"major_version": 8, "major_version": 8,
"sha256": "502b13e9ff9dae3984633ef1560b642d9836b8a0e7f5d84baf2d4a438d375360", "sha256": "4c956f08cbe02d43a06536e9eae888925cc495a669bd024606389bec5ea6964a",
"java_version": "1.8.0_362-b09" "java_version": "1.8.0_362-b09"
},
"jdk9": {
"link": "https://github.com/AdoptOpenJDK/openjdk9-openj9-releases/releases/download/jdk-9.0.4%2B12_openj9-0.9.0/OpenJDK9-OPENJ9_x64_Linux_jdk-9.0.4.12_openj9-0.9.0.tar.gz",
"major_version": 9,
"sha256": "d5bb41b7ed4fc1a6aba0914718aff4abec42acf18c776b7641efcbbb761e6e6b",
"java_version": "9.0.4+12"
} }
}, },
"latest": { "latest": {
"link": "https://github.com/AdoptOpenJDK/semeru19-binaries/releases/download/jdk-19.0.2%2B7_openj9-0.37.0/ibm-semeru-open-jdk_aarch64_linux_19.0.2_7_openj9-0.37.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru19-binaries/releases/download/jdk-19.0.2%2B7_openj9-0.37.0/ibm-semeru-open-jdk_x64_linux_19.0.2_7_openj9-0.37.0.tar.gz",
"major_version": 19, "major_version": 19,
"sha256": "c20cd3c641eebc3e534fa4ce05b211fc8bcd011eb392ceda40d3fadd35f5f8d0", "sha256": "5fd94c57afe0d4e778bfc284f3f7830c34de59bed4faba12d4bb46a77d0b516e",
"java_version": "19.0.2+7" "java_version": "19.0.2+7"
}, },
"stable": { "stable": {
"link": "https://github.com/AdoptOpenJDK/semeru19-binaries/releases/download/jdk-19.0.2%2B7_openj9-0.37.0/ibm-semeru-open-jdk_aarch64_linux_19.0.2_7_openj9-0.37.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru19-binaries/releases/download/jdk-19.0.2%2B7_openj9-0.37.0/ibm-semeru-open-jdk_x64_linux_19.0.2_7_openj9-0.37.0.tar.gz",
"major_version": 19, "major_version": 19,
"sha256": "c20cd3c641eebc3e534fa4ce05b211fc8bcd011eb392ceda40d3fadd35f5f8d0", "sha256": "5fd94c57afe0d4e778bfc284f3f7830c34de59bed4faba12d4bb46a77d0b516e",
"java_version": "19.0.2+7" "java_version": "19.0.2+7"
}, },
"lts": { "lts": {
"link": "https://github.com/AdoptOpenJDK/semeru17-binaries/releases/download/jdk-17.0.6%2B10_openj9-0.36.0/ibm-semeru-open-jdk_aarch64_linux_17.0.6_10_openj9-0.36.0.tar.gz", "link": "https://github.com/AdoptOpenJDK/semeru17-binaries/releases/download/jdk-17.0.6%2B10_openj9-0.36.0/ibm-semeru-open-jdk_x64_linux_17.0.6_10_openj9-0.36.0.tar.gz",
"major_version": 17, "major_version": 17,
"sha256": "7c6ef5b4989313b2e64b77613c13ec66a3fe85429732f63b6fe9f410d9e37d3c", "sha256": "ce39a4f7c2e08e56083f17f3e44c05e0fbbeba775e670f015a337679c99c54c6",
"java_version": "17.0.6+10" "java_version": "17.0.6+10"
} }
}, },
"temurin": { "temurin": {
"versions": { "versions": {
"jdk11": { "jdk11": {
"link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.19%2B7/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.19_7.tar.gz", "link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.19%2B7/OpenJDK11U-jdk_x64_linux_hotspot_11.0.19_7.tar.gz",
"major_version": 11, "major_version": 11,
"sha256": "0c7763a19b4af4ef5fbae831781b5184e988d6f131d264482399eeaf51b6e254", "sha256": "5f19fb28aea3e28fcc402b73ce72f62b602992d48769502effe81c52ca39a581",
"java_version": "11.0.19+7" "java_version": "11.0.19+7"
}, },
"jdk16": { "jdk16": {
"link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_aarch64_linux_hotspot_16.0.2_7.tar.gz", "link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz",
"major_version": 16, "major_version": 16,
"sha256": "cb77d9d126f97898dfdc8b5fb694d1e0e5d93d13a0a6cb2aeda76f8635384340", "sha256": "323d6d7474a359a28eff7ddd0df8e65bd61554a8ed12ef42fd9365349e573c2c",
"java_version": "16.0.2+7" "java_version": "16.0.2+7"
}, },
"jdk17": { "jdk17": {
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.7_7.tar.gz", "link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
"major_version": 17, "major_version": 17,
"sha256": "0084272404b89442871e0a1f112779844090532978ad4d4191b8d03fc6adfade", "sha256": "e9458b38e97358850902c2936a1bb5f35f6cffc59da9fcd28c63eab8dbbfbc3b",
"java_version": "17.0.7+7" "java_version": "17.0.7+7"
}, },
"jdk18": { "jdk18": {
"link": "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.2.1%2B1/OpenJDK18U-jdk_aarch64_linux_hotspot_18.0.2.1_1.tar.gz", "link": "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.2.1%2B1/OpenJDK18U-jdk_x64_linux_hotspot_18.0.2.1_1.tar.gz",
"major_version": 18, "major_version": 18,
"sha256": "262be608e266fd76d7496af83b2832be853c3aaf7460d6a4da198cd40db74553", "sha256": "7d6beba8cfc0a8347f278f7414351191a95a707d46b6586e9a786f2669af0f8b",
"java_version": "18.0.2.1+1" "java_version": "18.0.2.1+1"
}, },
"jdk19": { "jdk19": {
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-19.0.2%2B7/OpenJDK19U-jdk_aarch64_linux_hotspot_19.0.2_7.tar.gz", "link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-19.0.2%2B7/OpenJDK19U-jdk_x64_linux_hotspot_19.0.2_7.tar.gz",
"major_version": 19, "major_version": 19,
"sha256": "1c4be9aa173cb0deb0d215643d9509c8900e5497290b29eee4bee335fa57984f", "sha256": "3a3ba7a3f8c3a5999e2c91ea1dca843435a0d1c43737bd2f6822b2f02fc52165",
"java_version": "19.0.2+7" "java_version": "19.0.2+7"
}, },
"jdk20": { "jdk20": {
"link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk-20.0.1%2B9/OpenJDK20U-jdk_aarch64_linux_hotspot_20.0.1_9.tar.gz", "link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk-20.0.1%2B9/OpenJDK20U-jdk_x64_linux_hotspot_20.0.1_9.tar.gz",
"major_version": 20, "major_version": 20,
"sha256": "b16c0271899de1f0e277dc0398bfff11b54511765f104fa938929ac484dc926d", "sha256": "43ad054f135a7894dc87ad5d10ad45d8e82846186515892acdbc17c2c5cd27e4",
"java_version": "20.0.1+9" "java_version": "20.0.1+9"
}, },
"jdk8": { "jdk8": {
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u372-b07/OpenJDK8U-jdk_aarch64_linux_hotspot_8u372b07.tar.gz", "link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u372-b07/OpenJDK8U-jdk_x64_linux_hotspot_8u372b07.tar.gz",
"major_version": 8, "major_version": 8,
"sha256": "195808eb42ab73535c84de05188914a52a47c1ac784e4bf66de95fe1fd315a5a", "sha256": "78a0b3547d6f3d46227f2ad8c774248425f20f1cd63f399b713f0cdde2cc376c",
"java_version": "1.8.0_372-b07" "java_version": "1.8.0_372-b07"
} }
}, },
"latest": { "latest": {
"link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk20u-2023-05-10-08-56-beta/OpenJDK20U-jdk_aarch64_linux_hotspot_2023-05-10-08-56.tar.gz", "link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk20u-2023-05-10-08-56-beta/OpenJDK20U-jdk_x64_linux_hotspot_2023-05-10-08-56.tar.gz",
"major_version": 20, "major_version": 20,
"sha256": "e960a51dbc2d1f984eabbdf964af54481bf3eb697c3a4a8aedf3cdfb3c6af8ab", "sha256": "d73db1554c637bf1619cd0e23f27e3e236ab505359934afbf7abe0cd357288c9",
"java_version": "20.0.1-beta+9-202305100346" "java_version": "20.0.1-beta+9-202305100346"
}, },
"stable": { "stable": {
"link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk-20.0.1%2B9/OpenJDK20U-jdk_aarch64_linux_hotspot_20.0.1_9.tar.gz", "link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk-20.0.1%2B9/OpenJDK20U-jdk_x64_linux_hotspot_20.0.1_9.tar.gz",
"major_version": 20, "major_version": 20,
"sha256": "b16c0271899de1f0e277dc0398bfff11b54511765f104fa938929ac484dc926d", "sha256": "43ad054f135a7894dc87ad5d10ad45d8e82846186515892acdbc17c2c5cd27e4",
"java_version": "20.0.1+9" "java_version": "20.0.1+9"
}, },
"lts": { "lts": {
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.7_7.tar.gz", "link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz",
"major_version": 17, "major_version": 17,
"sha256": "0084272404b89442871e0a1f112779844090532978ad4d4191b8d03fc6adfade", "sha256": "e9458b38e97358850902c2936a1bb5f35f6cffc59da9fcd28c63eab8dbbfbc3b",
"java_version": "17.0.7+7" "java_version": "17.0.7+7"
} }
} }

View File

@ -7,7 +7,7 @@ use color_eyre::{
}; };
use isahc::HttpClient; use isahc::HttpClient;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::{debug, error, info, instrument, trace, warn}; use tracing::{debug, error, instrument, trace, warn};
/// Abstraction over an adoptium API instance /// Abstraction over an adoptium API instance
#[derive(custom_debug::Debug)] #[derive(custom_debug::Debug)]
@ -58,21 +58,18 @@ impl AdoptiumAPI {
} }
/// Return the most recent version for the specified release and architecture /// Return the most recent version for the specified release and architecture
#[instrument(skip(arch, os), fields(arch = arch.as_ref(), os = os.as_ref()))]
pub async fn release( pub async fn release(
&self, &self,
version: u32, version: u32,
arch: impl AsRef<str>, arch: impl AsRef<str>,
os: impl AsRef<str>,
pre_release: bool, pre_release: bool,
) -> Result<Version> { ) -> Result<Version> {
let release_type = if pre_release { "ea" } else { "ga" }; let release_type = if pre_release { "ea" } else { "ga" };
let arch = arch.as_ref(); let arch = arch.as_ref();
let os = os.as_ref();
let version = format!("[{version}, {})", version + 1); let version = format!("[{version}, {})", version + 1);
let version = urlencoding::encode(&version); let version = urlencoding::encode(&version);
let url = format!( let url = format!(
"{}/v3/info/release_versions?architecture={arch}&heap_size=normal&image_type=jdk&os_type={os}&project=jdk&release_type={release_type}&sort_method=DATE&sort_order=DESC&jvm_impl={}&version={version}", "{}/v3/info/release_versions?architecture={arch}&heap_size=normal&image_type=jdk&os_type=linux&project=jdk&release_type={release_type}&sort_method=DATE&sort_order=DESC&jvm_impl={}&version={version}",
self.base_url, self.base_url,
self.jvm_impl, self.jvm_impl,
); );
@ -93,20 +90,18 @@ impl AdoptiumAPI {
} }
/// Return latest release /// Return latest release
#[instrument(skip(arch, os), fields(arch = arch.as_ref(), os = os.as_ref()))] #[instrument(skip(arch), fields(arch = arch.as_ref()))]
pub async fn latest( pub async fn latest(
&self, &self,
version: u32, version: u32,
arch: impl AsRef<str>, arch: impl AsRef<str>,
os: impl AsRef<str>,
pre_release: bool, pre_release: bool,
) -> Result<Release> { ) -> Result<Release> {
let release_type = if pre_release { "ea" } else { "ga" }; let release_type = if pre_release { "ea" } else { "ga" };
debug!(?release_type); debug!(?release_type);
let arch = arch.as_ref(); let arch = arch.as_ref();
let os = os.as_ref();
let url = format!( let url = format!(
"{}/v3/assets/feature_releases/{version}/{release_type}?architecture={arch}&heap_size=normal&image_type=jdk&os={os}&page=0&page_size=10&project=jdk&sort_method=DATE&sort_order=DESC&jvm_impl={}", "{}/v3/assets/feature_releases/{version}/{release_type}?architecture={arch}&heap_size=normal&image_type=jdk&os=linux&page=0&page_size=10&project=jdk&sort_method=DATE&sort_order=DESC&jvm_impl={}",
self.base_url, self.base_url,
self.jvm_impl self.jvm_impl
); );
@ -151,65 +146,49 @@ impl AdoptiumAPI {
} }
/// Get all versions /// Get all versions
#[instrument(skip(arch, os), fields(arch = arch.as_ref(), os = os.as_ref()))] pub async fn get_all(&self, arch: impl AsRef<str>) -> Result<OutputReleases> {
pub async fn get_all(
&self,
arch: impl AsRef<str>,
os: impl AsRef<str>,
) -> Result<OutputReleases> {
let input_versions = self let input_versions = self
.available_releases() .available_releases()
.await .await
.context("Failed to get releases")?; .context("Failed to get releases")?;
let arch = arch.as_ref(); let arch = arch.as_ref();
let os = os.as_ref();
info!(?input_versions, "Getting versions");
let mut versions: BTreeMap<String, OutputRelease> = BTreeMap::new(); let mut versions: BTreeMap<String, OutputRelease> = BTreeMap::new();
for release in &input_versions.available_releases { for release in &input_versions.available_releases {
match self.latest(*release, arch, os, false).await { let output_release: OutputRelease = self
Ok(output_release) => { .latest(*release, arch, false)
let output_release: OutputRelease = output_release.into(); .await
trace!(?output_release, "Inserting version"); .context("Failed to get version")?
versions.insert( .into();
format!("jdk{}", output_release.major_version), versions.insert(
output_release, format!("jdk{}", output_release.major_version),
); output_release,
} );
Err(e) => {
warn!(?e, ?release, "Version not available for os/architecture");
}
};
} }
info!("Getting latest");
let latest: OutputRelease = match self let latest: OutputRelease = match self
.latest(input_versions.most_recent_feature_version, arch, os, true) .latest(input_versions.most_recent_feature_version, arch, true)
.await .await
{ {
Ok(x) => x.into(), Ok(x) => x.into(),
Err(_) => self Err(_) => self
.latest(input_versions.most_recent_feature_release, arch, os, false) .latest(input_versions.most_recent_feature_release, arch, false)
.await .await
.context("Failed to get latest version")? .context("Failed to get latest version")?
.into(), .into(),
}; };
info!("Getting stable");
let stable: OutputRelease = self let stable: OutputRelease = self
.latest( .latest(
input_versions.available_releases[input_versions.available_releases.len() - 1], input_versions.available_releases[input_versions.available_releases.len() - 1],
arch, arch,
os,
false, false,
) )
.await .await
.context("Failed to get version - stable")? .context("Failed to get version - stable")?
.into(); .into();
info!("Getting lts");
let lts: OutputRelease = self let lts: OutputRelease = self
.latest( .latest(
input_versions.available_lts_releases input_versions.available_lts_releases
[input_versions.available_lts_releases.len() - 1], [input_versions.available_lts_releases.len() - 1],
arch, arch,
os,
false, false,
) )
.await .await

View File

@ -22,38 +22,38 @@ async fn main() -> Result<()> {
// Create the api instances // Create the api instances
let adoptium = AdoptiumAPI::adoptium().context("Creating api")?; let adoptium = AdoptiumAPI::adoptium().context("Creating api")?;
let semeru = AdoptiumAPI::semeru().context("Creating api")?; let semeru = AdoptiumAPI::semeru().context("Creating api")?;
// Fill in x86_64-linux first // Fill in x86_64 first
{ {
let x86_64 = output.entry("x86_64-linux".to_string()).or_default(); let x86_64 = output.entry("x86_64-linux".to_string()).or_default();
x86_64.insert( x86_64.insert(
"temurin".to_string(), "temurin".to_string(),
adoptium adoptium
.get_all("x64", "linux") .get_all("x64")
.await .await
.context("Failed getting x86_64 adopt releases")?, .context("Failed getting x86_64 adopt releases")?,
); );
x86_64.insert( x86_64.insert(
"semeru".to_string(), "semeru".to_string(),
semeru semeru
.get_all("x64", "linux") .get_all("x64")
.await .await
.context("Failed getting x86_64 adopt releases")?, .context("Failed getting x86_64 adopt releases")?,
); );
} }
// Then aarch64-linux // Then aarch64
{ {
let aarch64 = output.entry("aarch64-linux".to_string()).or_default(); let aarch64 = output.entry("aarch64-linux".to_string()).or_default();
aarch64.insert( aarch64.insert(
"temurin".to_string(), "temurin".to_string(),
adoptium adoptium
.get_all("aarch64", "linux") .get_all("x64")
.await .await
.context("Failed getting aarch64 adopt releases")?, .context("Failed getting aarch64 adopt releases")?,
); );
aarch64.insert( aarch64.insert(
"semeru".to_string(), "semeru".to_string(),
semeru semeru
.get_all("aarch64", "linux") .get_all("x64")
.await .await
.context("Failed getting aarch64 adopt releases")?, .context("Failed getting aarch64 adopt releases")?,
); );