Resolve legacy OpenJDK build metadata

This commit is contained in:
copilot-swe-agent[bot]
2026-07-28 02:40:37 +00:00
committed by GitHub
parent cb48866ec3
commit 333d9ce35a
3 changed files with 43 additions and 2 deletions
+11 -1
View File
@@ -131939,13 +131939,23 @@ class OpenJdkDistribution extends JavaBase {
const pattern = new RegExp(`href="(https://download\\.java\\.net/[^"]+/openjdk-([^"_]+)_${platformPattern}-${arch}_bin\\.${extensionPattern})"`, 'g');
return Array.from(html.matchAll(pattern), match => {
const url = match[1];
const build = url.match(/\/(\d+)\/(?:GPL\/)?openjdk-/)?.[1];
const build = url.match(/\/(\d+)\/(?:GPL\/)?openjdk-/)?.[1] ??
this.findBuildInArchiveHeading(html, match.index, match[2]);
return {
version: this.toSemver(match[2], build),
url
};
});
}
findBuildInArchiveHeading(html, assetIndex, version) {
const headings = Array.from(html.slice(0, assetIndex).matchAll(/\(build\s+([^)]+)\)/g));
const headingVersion = headings.at(-1)?.[1];
if (!headingVersion) {
return undefined;
}
const [javaVersion, build] = headingVersion.split('+');
return javaVersion === version ? build : undefined;
}
toSemver(version, urlBuild) {
const [javaVersion, filenameBuild] = version.replace('-ea', '').split('+');
const versionParts = javaVersion.split('.');