mirror of
https://gitea.com/actions/setup-java.git
synced 2026-11-27 09:13:03 +08:00
17 lines
428 B
TypeScript
17 lines
428 B
TypeScript
|
|
export function validateToolchainIds(
|
||
|
|
versions: string[],
|
||
|
|
versionFile: string,
|
||
|
|
toolchainIds: string[]
|
||
|
|
) {
|
||
|
|
if (!toolchainIds.length) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
const versionCount = versions.length || (versionFile ? 1 : 0);
|
||
|
|
if (versionCount !== toolchainIds.length) {
|
||
|
|
throw new Error(
|
||
|
|
`The number of Maven toolchain IDs (${toolchainIds.length}) must match the number of Java versions (${versionCount})`
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|