mirror of
https://github.com/actions/setup-java.git
synced 2026-11-06 01:40:36 +08:00
Fix Liberica Java 25 release resolution (#1313)
* Fix Liberica multi-component patch resolution Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix Liberica patch version ordering Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot App
parent
e144521edf
commit
ef0b922255
@@ -320,6 +320,60 @@ describe('findPackageForDownload', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('selects the latest multi-component patch release for Java 25', async () => {
|
||||
const releases: LibericaVersion[] = [
|
||||
'25.0.5+11',
|
||||
'25.0.5.0.2+5',
|
||||
'25.0.5.0.3+5'
|
||||
].map(version => {
|
||||
const [versionWithoutBuild, buildVersion] = version.split('+');
|
||||
const [featureVersion, interimVersion, updateVersion] =
|
||||
versionWithoutBuild.split('.').map(Number);
|
||||
return {
|
||||
version,
|
||||
featureVersion,
|
||||
interimVersion,
|
||||
updateVersion,
|
||||
buildVersion: Number(buildVersion),
|
||||
downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
|
||||
};
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => releases;
|
||||
|
||||
await expect(distribution['findPackageForDownload']('25')).resolves.toEqual(
|
||||
{
|
||||
version: '25.0.5+0.3.5',
|
||||
url: 'https://download.bell-sw.com/java/25.0.5.0.3+5/jdk.tar.gz'
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('compares patch components before build numbers when patch lengths differ', async () => {
|
||||
const releases: LibericaVersion[] = ['25.0.5.1+10', '25.0.5.1.1+1'].map(
|
||||
version => {
|
||||
const [versionWithoutBuild, buildVersion] = version.split('+');
|
||||
const [featureVersion, interimVersion, updateVersion] =
|
||||
versionWithoutBuild.split('.').map(Number);
|
||||
return {
|
||||
version,
|
||||
featureVersion,
|
||||
interimVersion,
|
||||
updateVersion,
|
||||
buildVersion: Number(buildVersion),
|
||||
downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
|
||||
};
|
||||
}
|
||||
);
|
||||
distribution['getAvailableVersions'] = async () => releases;
|
||||
|
||||
await expect(
|
||||
distribution['findPackageForDownload']('25.0.5')
|
||||
).resolves.toEqual({
|
||||
version: '25.0.5+1.1.1',
|
||||
url: 'https://download.bell-sw.com/java/25.0.5.1.1+1/jdk.tar.gz'
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw an error', async () => {
|
||||
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
|
||||
/No matching version found for SemVer/
|
||||
@@ -431,6 +485,39 @@ describe('patch request resolution from the constructor', () => {
|
||||
expect(distribution['version']).toBe('17.0.20.1');
|
||||
});
|
||||
|
||||
it('normalizes multi-component patch-only requests for exact matching', async () => {
|
||||
const releases: LibericaVersion[] = ['25.0.5.0.2+5', '25.0.5.0.3+5'].map(
|
||||
version => {
|
||||
const [versionWithoutBuild, buildVersion] = version.split('+');
|
||||
const [featureVersion, interimVersion, updateVersion] =
|
||||
versionWithoutBuild.split('.').map(Number);
|
||||
return {
|
||||
version,
|
||||
featureVersion,
|
||||
interimVersion,
|
||||
updateVersion,
|
||||
buildVersion: Number(buildVersion),
|
||||
downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
|
||||
};
|
||||
}
|
||||
);
|
||||
const distribution = new LibericaDistributions({
|
||||
version: '25.0.5.0.3',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => releases;
|
||||
|
||||
expect(distribution['version']).toBe('25.0.5.0.3');
|
||||
await expect(
|
||||
distribution['findPackageForDownload'](distribution['version'])
|
||||
).resolves.toEqual({
|
||||
version: '25.0.5+0.3.5',
|
||||
url: 'https://download.bell-sw.com/java/25.0.5.0.3+5/jdk.tar.gz'
|
||||
});
|
||||
});
|
||||
|
||||
it('orders main versions, patches, and builds consistently in cache', async () => {
|
||||
for (const version of ['17.0.20-1.2', '17.0.20-1.10', '17.0.21-1']) {
|
||||
const javaPath = path.join(
|
||||
@@ -577,6 +664,16 @@ describe('convertVersionToSemver', () => {
|
||||
},
|
||||
'25.0.4+1.1'
|
||||
],
|
||||
[
|
||||
{
|
||||
version: '25.0.5.0.3+5',
|
||||
featureVersion: 25,
|
||||
interimVersion: 0,
|
||||
updateVersion: 5,
|
||||
buildVersion: 5
|
||||
},
|
||||
'25.0.5+0.3.5'
|
||||
],
|
||||
[
|
||||
{
|
||||
version: '17.0.20.1+2',
|
||||
|
||||
Reference in New Issue
Block a user