Skip to content
Merged
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
Prev Previous commit
Next Next commit
add property
  • Loading branch information
dmitry-shibanov committed Sep 5, 2022
commit afb8d2e48a1d98ffe17c0158db48e5aae167340d
15 changes: 10 additions & 5 deletions src/distributions/microsoft/installer.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { JavaBase } from '../base-installer';
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from '../base-models';
import semver from 'semver';
import { extractJdkFile, getDownloadArchiveExtension, isVersionSatisfies } from '../../util';
import { extractJdkFile, getDownloadArchiveExtension } from '../../util';
import * as core from '@actions/core';
import { MicrosoftVersion, PlatformOptions } from './models';
import * as tc from '@actions/tool-cache';
import fs from 'fs';
import path from 'path';

export interface IToolRelease {
version: string;
stable: boolean;
files: tc.IToolReleaseFile[];
}

export class MicrosoftDistributions extends JavaBase {
constructor(installerOptions: JavaInstallerOptions) {
super('Microsoft', installerOptions);
Expand Down Expand Up @@ -58,7 +63,7 @@ export class MicrosoftDistributions extends JavaBase {
const foundRelease = await tc.findFromManifest(
range,
true,
availableVersionsRaw,
availableVersionsRaw.map(item => Object.assign(item, { release_url: '' })),
this.architecture
);

Expand Down Expand Up @@ -95,12 +100,12 @@ export class MicrosoftDistributions extends JavaBase {
return { url: foundRelease.release_url, version: foundRelease.version };
}

private async getAvailableVersions(): Promise<tc.IToolRelease[] | null> {
private async getAvailableVersions(): Promise<IToolRelease[] | null> {
// TODO get these dynamically!
// We will need Microsoft to add an endpoint where we can query for versions.
const token = core.getInput('token');
const manifest = (
await this.http.getJson<tc.IToolRelease[]>(
await this.http.getJson<IToolRelease[]>(
'https://github.com/dmitry-shibanov/setup-java/blob/add-json-for-microsoft-versions/microsoft-build-of-openjdk-versions.json',
{ authorization: token }
)
Expand Down