Repository navigation
Add microsoft distribution of the JDK. #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1bc2528
9c1600a
2828873
f073089
434a5bf
3d55049
c3cb155
41cb4d7
50297fe
bf48000
ef8955b
d2ec614
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,13 +14,14 @@ 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: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [macos-latest, windows-latest, ubuntu-latest] | ||
| distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica'] # 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'] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we replace 16 with 17 here, since 17 is the latest LTS now?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably worth doing in a different PR since it is unrelated to adding MSFT.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yes. That'd be better indeed. |
||
| steps: | ||
| - name: Checkout | ||
|
|
@@ -175,16 +176,25 @@ jobs: | |
| shell: bash | ||
|
|
||
| setup-java-custom-architecture: | ||
| name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x86) - ${{ matrix.os }} | ||
| # Only Zulu provides x86 arch for now and only for windows / ubuntu | ||
| # Only Microsoft provides arm64 for windows / ubuntu / os x | ||
| if: ${{ (matrix.distribution == 'zulu' && matrix.architecture == 'x86' && matrix.os != 'macos-latest' ) || (matrix.distribution == 'microsoft' && matrix.architecture == 'arm64') }} | ||
|
brcrista marked this conversation as resolved.
Resolved
|
||
| name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ matrix.architecture }}) - ${{ matrix.os }} | ||
| needs: setup-java-major-minor-versions | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| <<<<<<< HEAD | ||
| # Only Zulu and Liberica provides x86 arch for now and only for windows / ubuntu | ||
| os: [windows-latest, ubuntu-latest] | ||
| distribution: ['zulu', 'liberica'] | ||
| ======= | ||
| os: [macos-latest, windows-latest, ubuntu-latest] | ||
| distribution: ['zulu', 'microsoft'] | ||
| >>>>>>> Add microsoft distribution of the JDK. | ||
|
brcrista marked this conversation as resolved.
Resolved
|
||
| version: ['11'] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move up to 17?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted. |
||
| architecture: [ 'x86', 'arm64' ] | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
|
|
@@ -194,7 +204,7 @@ jobs: | |
| with: | ||
| distribution: ${{ matrix.distribution }} | ||
| java-version: ${{ matrix.version }} | ||
| architecture: x86 | ||
| architecture: ${{ matrix.architecture }} | ||
| - name: Verify Java | ||
| run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" | ||
| shell: bash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct name is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done (apologies, this got lost in my rebasing) |
||
|
|
||
| **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. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import { MicrosoftDistributions } from '../../src/distributions/microsoft/installer'; | ||
| import { ArchitectureOptions } from '../../src/distributions/microsoft/models'; | ||
|
|
||
| describe('getArchitectureOptions', () => { | ||
| it.each([ | ||
| ['x64', { bitness: '64', arch: 'x86' }], | ||
| ['aarch64', { bitness: '64', arch: 'arm' }], | ||
| ] as [string, ArchitectureOptions][])('parse architecture %s -> %s', (input, expected) => { | ||
| const distributions = new MicrosoftDistributions({ | ||
| architecture: input, | ||
| checkLatest: false, | ||
| packageType: '', | ||
| version: '' | ||
| }); | ||
|
|
||
| expect(distributions['getArchitectureOptions']()).toEqual(expected); | ||
| }); | ||
|
|
||
| it.each(['armv6', 's390x'])('not support architecture %s', input => { | ||
| const distributions = new MicrosoftDistributions({ | ||
| architecture: input, | ||
| checkLatest: false, | ||
| packageType: '', | ||
| version: '' | ||
| }); | ||
|
|
||
| expect(() => distributions['getArchitectureOptions']()).toThrow( | ||
| /Architecture '\w+' is not supported\. Supported architectures: .*/ | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| describe('findPackageForDownload', () => { | ||
| let distribution: MicrosoftDistributions; | ||
|
|
||
| beforeEach(() => { | ||
| distribution = new MicrosoftDistributions({ | ||
| version: '', | ||
| architecture: 'x64', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
| }); | ||
|
|
||
| it.each([ | ||
| ['17.x', '17.0.1', 'https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-{{OS_TYPE}}-x64.tar.gz'], | ||
| ['16.0.x', '16.0.2', 'https://aka.ms/download-jdk/microsoft-jdk-16.0.2.7.1-{{OS_TYPE}}-x64.tar.gz'], | ||
| ['11.0.13', '11.0.13', 'https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-{{OS_TYPE}}-x64.tar.gz'], | ||
| ])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => { | ||
| const result = await distribution['findPackageForDownload'](input); | ||
| expect(result.version).toBe(expectedVersion); | ||
| var os: string; | ||
| switch (process.platform) { | ||
| case 'darwin': | ||
| os = 'macos'; | ||
| break; | ||
| case 'win32': | ||
| os = 'windows'; | ||
| break; | ||
| default: | ||
| os = process.platform.toString(); | ||
| break; | ||
| } | ||
| expect(result.url).toBe(expectedUrl.replace('{{OS_TYPE}}', os)); | ||
| }); | ||
|
|
||
| it('should throw an error', async () => { | ||
| await expect(distribution['findPackageForDownload']('8')).rejects.toThrow( | ||
| /Could not find satisfied version for semver */ | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| describe('getPlatformOption', () => { | ||
| const distributions = new MicrosoftDistributions({ | ||
| architecture: 'x64', | ||
| version: '11', | ||
| packageType: 'jdk', | ||
| checkLatest: false | ||
| }); | ||
|
|
||
| it.each([ | ||
| ['linux', 'linux'], | ||
| ['darwin', 'macos'], | ||
| ['win32', 'windows'], | ||
| ])('os version %s -> %s', (input, expected) => { | ||
| const actual = distributions['getPlatformOption'](input as NodeJS.Platform); | ||
|
|
||
| expect(actual).toEqual(expected); | ||
| }); | ||
|
|
||
| it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd', 'solaris', 'cygwin'])( | ||
| 'not support os version %s', | ||
| input => { | ||
| expect(() => distributions['getPlatformOption'](input as NodeJS.Platform)).toThrow( | ||
| /Platform '\w+' is not supported\. Supported platforms: .+/ | ||
| ); | ||
| } | ||
| ); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.