Add support for the microsoft distribution.

This commit is contained in:
Brendan Burns 2021-12-07 13:22:34 -08:00
parent 3d55049ca8
commit c3cb155fbc
7 changed files with 23371 additions and 26244 deletions

View file

@ -14,7 +14,6 @@ on:
workflow_dispatch:
jobs:
setup-java-major-versions:
if: ${{ matrix.distribution != 'microsoft' || matrix.version != '8' }}
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
@ -23,6 +22,9 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica', 'microsoft' ] # internally 'adopt-hotspot' is the same as 'adopt'
version: ['8', '11', '16']
exclude:
- distribution: microsoft
version: 8
steps:
- name: Checkout
uses: actions/checkout@v2

View file

@ -59,7 +59,7 @@ Currently, the following distributions are supported:
| `adopt` or `adopt-hotspot` | Adopt OpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
| `adopt-openj9` | Adopt OpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
| `microsoft` | Microsoft OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.

View file

@ -31,8 +31,8 @@ describe('findPackageForDownload', () => {
])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => {
const result = await distribution['findPackageForDownload'](input);
expect(result.version).toBe(expectedVersion);
var os: string;
var archive: string;
let os: string;
let archive: string;
switch (process.platform) {
case 'darwin':
os = 'macos';
@ -53,7 +53,7 @@ describe('findPackageForDownload', () => {
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
/Could not find satisfied version for semver */
/Could not find satisfied version for SemVer */
);
});
});

24607
dist/cleanup/index.js vendored

File diff suppressed because one or more lines are too long

24976
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -10,8 +10,6 @@ import path from 'path';
const supportedPlatform = `'linux', 'macos', 'windows'`;
const supportedArchitecture = `'x64', 'armv7', 'aarch64'`;
export class MicrosoftDistributions extends JavaBase {
constructor(installerOptions: JavaInstallerOptions) {
super('Microsoft', installerOptions);
@ -48,7 +46,7 @@ export class MicrosoftDistributions extends JavaBase {
const opts = this.getPlatformOption();
const availableVersions = availableVersionsRaw.map(item => ({
url: `https://aka.ms/download-jdk/microsoft-jdk-${item.fullVersion}-${opts.os}-${this.architecture}.${opts.archive}`,
url: `https://aka.ms/download-jdk/microsoft-jdk-${item.fullVersion.join('.')}-${opts.os}-${this.architecture}.${opts.archive}`,
version: this.convertVersionToSemver(item)
}));
@ -70,22 +68,20 @@ export class MicrosoftDistributions extends JavaBase {
}
private async getAvailableVersions(): Promise<MicrosoftVersion[]> {
console.time('microsoft-retrieve-available-versions');
// TODO get these dynamically!
const jdkVersions = [
{
majorVersion: 17,
minorVersion: 0,
patchVersion: 1,
fullVersion: '17.0.1.12.1'
fullVersion: [17,0,1,12,1],
},
{
majorVersion: 16,
minorVersion: 0,
patchVersion: 2,
fullVersion: '16.0.2.7.1'
}
fullVersion: [16,0,2.7,1],
},
];
// M1 is only supported for Java 16 & 17
@ -94,7 +90,7 @@ export class MicrosoftDistributions extends JavaBase {
majorVersion: 11,
minorVersion: 0,
patchVersion: 13,
fullVersion: '11.0.13.8.1'
fullVersion: [11, 0, 13, 8, 1],
});
}

View file

@ -1,5 +1,5 @@
export type OsVersions = 'linux' | 'macos' | 'windows';
export type ArchiveType = 'tar.gz' | 'zip';
type OsVersions = 'linux' | 'macos' | 'windows';
type ArchiveType = 'tar.gz' | 'zip';
export interface PlatformOptions {
archive: ArchiveType;
@ -11,5 +11,5 @@ export interface MicrosoftVersion {
majorVersion: number;
minorVersion: number;
patchVersion: number;
fullVersion: string;
fullVersion: Array<number>;
}