Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make the Adoptopenjdk package type look at the Temurin repo first for…
… latest assets
  • Loading branch information
johnoliver committed Jun 12, 2026
commit bf12c838ba3f0730c02c0f89b54be42d596538d3
51 changes: 50 additions & 1 deletion src/distributions/adopt/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
MAX_PAGINATION_PAGES,
validatePaginationUrl
} from '../../util';
import {TemurinDistribution, TemurinImplementation} from '../temurin/installer';

export enum AdoptImplementation {
Hotspot = 'Hotspot',
Expand All @@ -30,13 +31,61 @@ export enum AdoptImplementation {
export class AdoptDistribution extends JavaBase {
constructor(
installerOptions: JavaInstallerOptions,
private readonly jvmImpl: AdoptImplementation
private readonly jvmImpl: AdoptImplementation,
private readonly temurinDistribution: TemurinDistribution | null = null
) {
super(`Adopt-${jvmImpl}`, installerOptions);

if (temurinDistribution != null && jvmImpl != AdoptImplementation.Hotspot) {
Comment thread
johnoliver marked this conversation as resolved.
Outdated
throw new Error('Only Hotspot JVM is supported by Temurin.');
}

// Only use the temurin repo for Hotspot JVMs
if (temurinDistribution == null && jvmImpl == AdoptImplementation.Hotspot) {
Comment thread
johnoliver marked this conversation as resolved.
Outdated
this.temurinDistribution = new TemurinDistribution(
installerOptions,
TemurinImplementation.Hotspot
);
}
}
Comment thread
johnoliver marked this conversation as resolved.

protected async findPackageForDownload(
version: string
): Promise<JavaDownloadRelease> {
Comment thread
johnoliver marked this conversation as resolved.
if (this.jvmImpl == AdoptImplementation.Hotspot) {
Comment thread
johnoliver marked this conversation as resolved.
Outdated
core.notice(
"AdoptOpenJDK has moved to Eclipse Temurin https://github.com/actions/setup-java#supported-distributions please consider changing to the 'temurin' distribution type in your setup-java configuration."
);
}
Comment thread
johnoliver marked this conversation as resolved.
Comment thread
johnoliver marked this conversation as resolved.

if (
this.jvmImpl == AdoptImplementation.Hotspot &&
this.temurinDistribution != null
Comment thread
johnoliver marked this conversation as resolved.
Outdated
) {
try {
const result = await this.temurinDistribution.findPackageForDownload(
Comment thread
johnoliver marked this conversation as resolved.
Outdated
version
);

if (result != undefined) {
return result;
}
Comment thread
johnoliver marked this conversation as resolved.
Outdated
} catch (error) {
if (error.message.includes('Could not find satisfied version')) {
core.notice(
'The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' +
'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.'
);
Comment thread
johnoliver marked this conversation as resolved.
}
}
Comment thread
johnoliver marked this conversation as resolved.
}

// failed to find a Temurin version, so fall back to AdoptOpenJDK
return this.findPackageForDownloadOldAdoptOpenJdk(version);
Comment thread
johnoliver marked this conversation as resolved.
Comment thread
johnoliver marked this conversation as resolved.
}

private async findPackageForDownloadOldAdoptOpenJdk(
version: string
Comment thread
johnoliver marked this conversation as resolved.
): Promise<JavaDownloadRelease> {
const availableVersionsRaw = await this.getAvailableVersions();
const availableVersionsWithBinaries = availableVersionsRaw
Expand Down
2 changes: 1 addition & 1 deletion src/distributions/temurin/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class TemurinDistribution extends JavaBase {
super(`Temurin-${jvmImpl}`, installerOptions);
}

protected async findPackageForDownload(
public async findPackageForDownload(
Comment thread
johnoliver marked this conversation as resolved.
version: string
): Promise<JavaDownloadRelease> {
Comment thread
gdams marked this conversation as resolved.
const availableVersionsRaw = await this.getAvailableVersions();
Expand Down