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: workflow_dispatch:
jobs: jobs:
setup-java-major-versions: setup-java-major-versions:
if: ${{ matrix.distribution != 'microsoft' || matrix.version != '8' }}
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }} name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
@ -23,6 +22,9 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica', 'microsoft' ] # internally 'adopt-hotspot' is the same as 'adopt' distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica', 'microsoft' ] # internally 'adopt-hotspot' is the same as 'adopt'
version: ['8', '11', '16'] version: ['8', '11', '16']
exclude:
- distribution: microsoft
version: 8
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 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` 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) | | `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/) | | `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. **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) => { ])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => {
const result = await distribution['findPackageForDownload'](input); const result = await distribution['findPackageForDownload'](input);
expect(result.version).toBe(expectedVersion); expect(result.version).toBe(expectedVersion);
var os: string; let os: string;
var archive: string; let archive: string;
switch (process.platform) { switch (process.platform) {
case 'darwin': case 'darwin':
os = 'macos'; os = 'macos';
@ -53,7 +53,7 @@ describe('findPackageForDownload', () => {
it('should throw an error', async () => { it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow( 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

24964
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 supportedPlatform = `'linux', 'macos', 'windows'`;
const supportedArchitecture = `'x64', 'armv7', 'aarch64'`;
export class MicrosoftDistributions extends JavaBase { export class MicrosoftDistributions extends JavaBase {
constructor(installerOptions: JavaInstallerOptions) { constructor(installerOptions: JavaInstallerOptions) {
super('Microsoft', installerOptions); super('Microsoft', installerOptions);
@ -48,7 +46,7 @@ export class MicrosoftDistributions extends JavaBase {
const opts = this.getPlatformOption(); const opts = this.getPlatformOption();
const availableVersions = availableVersionsRaw.map(item => ({ 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) version: this.convertVersionToSemver(item)
})); }));
@ -70,22 +68,20 @@ export class MicrosoftDistributions extends JavaBase {
} }
private async getAvailableVersions(): Promise<MicrosoftVersion[]> { private async getAvailableVersions(): Promise<MicrosoftVersion[]> {
console.time('microsoft-retrieve-available-versions');
// TODO get these dynamically! // TODO get these dynamically!
const jdkVersions = [ const jdkVersions = [
{ {
majorVersion: 17, majorVersion: 17,
minorVersion: 0, minorVersion: 0,
patchVersion: 1, patchVersion: 1,
fullVersion: '17.0.1.12.1' fullVersion: [17,0,1,12,1],
}, },
{ {
majorVersion: 16, majorVersion: 16,
minorVersion: 0, minorVersion: 0,
patchVersion: 2, patchVersion: 2,
fullVersion: '16.0.2.7.1' fullVersion: [16,0,2.7,1],
} },
]; ];
// M1 is only supported for Java 16 & 17 // M1 is only supported for Java 16 & 17
@ -94,7 +90,7 @@ export class MicrosoftDistributions extends JavaBase {
majorVersion: 11, majorVersion: 11,
minorVersion: 0, minorVersion: 0,
patchVersion: 13, 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'; type OsVersions = 'linux' | 'macos' | 'windows';
export type ArchiveType = 'tar.gz' | 'zip'; type ArchiveType = 'tar.gz' | 'zip';
export interface PlatformOptions { export interface PlatformOptions {
archive: ArchiveType; archive: ArchiveType;
@ -11,5 +11,5 @@ export interface MicrosoftVersion {
majorVersion: number; majorVersion: number;
minorVersion: number; minorVersion: number;
patchVersion: number; patchVersion: number;
fullVersion: string; fullVersion: Array<number>;
} }