mirror of
				https://github.com/actions/setup-java.git
				synced 2025-10-31 14:30:53 +00:00 
			
		
		
		
	Fix formatting to match prettier.
This commit is contained in:
		
					parent
					
						
							
								1bc25281d6
							
						
					
				
			
			
				commit
				
					
						9c1600ace3
					
				
			
		
					 4 changed files with 52 additions and 34 deletions
				
			
		|  | @ -4,7 +4,7 @@ import { ArchitectureOptions } from '../../src/distributions/microsoft/models'; | ||||||
| describe('getArchitectureOptions', () => { | describe('getArchitectureOptions', () => { | ||||||
|   it.each([ |   it.each([ | ||||||
|     ['x64', { bitness: '64', arch: 'x86' }], |     ['x64', { bitness: '64', arch: 'x86' }], | ||||||
|     ['aarch64', { bitness: '64', arch: 'arm' }], |     ['aarch64', { bitness: '64', arch: 'arm' }] | ||||||
|   ] as [string, ArchitectureOptions][])('parse architecture %s -> %s', (input, expected) => { |   ] as [string, ArchitectureOptions][])('parse architecture %s -> %s', (input, expected) => { | ||||||
|     const distributions = new MicrosoftDistributions({ |     const distributions = new MicrosoftDistributions({ | ||||||
|       architecture: input, |       architecture: input, | ||||||
|  | @ -43,23 +43,35 @@ describe('findPackageForDownload', () => { | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   it.each([ |   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'], |       '17.x', | ||||||
|     ['11.0.13', '11.0.13', 'https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-{{OS_TYPE}}-x64.tar.gz'], |       '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) => { |   ])('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; |     var os: string; | ||||||
|     switch (process.platform) { |     switch (process.platform) { | ||||||
|         case 'darwin': |       case 'darwin': | ||||||
|             os = 'macos'; |         os = 'macos'; | ||||||
|             break; |         break; | ||||||
|         case 'win32': |       case 'win32': | ||||||
|             os = 'windows'; |         os = 'windows'; | ||||||
|             break; |         break; | ||||||
|         default: |       default: | ||||||
|             os = process.platform.toString(); |         os = process.platform.toString(); | ||||||
|             break; |         break; | ||||||
|     } |     } | ||||||
|     expect(result.url).toBe(expectedUrl.replace('{{OS_TYPE}}', os)); |     expect(result.url).toBe(expectedUrl.replace('{{OS_TYPE}}', os)); | ||||||
|   }); |   }); | ||||||
|  | @ -82,7 +94,7 @@ describe('getPlatformOption', () => { | ||||||
|   it.each([ |   it.each([ | ||||||
|     ['linux', 'linux'], |     ['linux', 'linux'], | ||||||
|     ['darwin', 'macos'], |     ['darwin', 'macos'], | ||||||
|     ['win32', 'windows'], |     ['win32', 'windows'] | ||||||
|   ])('os version %s -> %s', (input, expected) => { |   ])('os version %s -> %s', (input, expected) => { | ||||||
|     const actual = distributions['getPlatformOption'](input as NodeJS.Platform); |     const actual = distributions['getPlatformOption'](input as NodeJS.Platform); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ export function getJavaDistribution( | ||||||
|     case JavaDistribution.Liberica: |     case JavaDistribution.Liberica: | ||||||
|       return new LibericaDistributions(installerOptions); |       return new LibericaDistributions(installerOptions); | ||||||
|     case JavaDistribution.Microsoft: |     case JavaDistribution.Microsoft: | ||||||
|         return new MicrosoftDistributions(installerOptions); |       return new MicrosoftDistributions(installerOptions); | ||||||
|     default: |     default: | ||||||
|       return null; |       return null; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -44,7 +44,9 @@ export class MicrosoftDistributions extends JavaBase { | ||||||
|     const availableVersionsRaw = await this.getAvailableVersions(); |     const availableVersionsRaw = await this.getAvailableVersions(); | ||||||
| 
 | 
 | ||||||
|     const availableVersions = availableVersionsRaw.map(item => ({ |     const availableVersions = availableVersionsRaw.map(item => ({ | ||||||
|       url: `https://aka.ms/download-jdk/microsoft-jdk-${item.fullVersion}-${this.getPlatformOption()}-${this.architecture}.tar.gz`, |       url: `https://aka.ms/download-jdk/microsoft-jdk-${ | ||||||
|  |         item.fullVersion | ||||||
|  |       }-${this.getPlatformOption()}-${this.architecture}.tar.gz`,
 | ||||||
|       version: this.convertVersionToSemver(item) |       version: this.convertVersionToSemver(item) | ||||||
|     })); |     })); | ||||||
| 
 | 
 | ||||||
|  | @ -69,22 +71,26 @@ export class MicrosoftDistributions extends JavaBase { | ||||||
|     console.time('microsoft-retrieve-available-versions'); |     console.time('microsoft-retrieve-available-versions'); | ||||||
| 
 | 
 | ||||||
|     // TODO get these dynamically!
 |     // TODO get these dynamically!
 | ||||||
|     var jdkVersions = [{ |     var jdkVersions = [ | ||||||
|       majorVersion: 17, |       { | ||||||
|       minorVersion: 0, |         majorVersion: 17, | ||||||
|       patchVersion: 1, |         minorVersion: 0, | ||||||
|       fullVersion: '17.0.1.12.1' |         patchVersion: 1, | ||||||
|     }, { |         fullVersion: '17.0.1.12.1' | ||||||
|       majorVersion: 16, |       }, | ||||||
|       minorVersion: 0, |       { | ||||||
|       patchVersion: 2, |         majorVersion: 16, | ||||||
|       fullVersion: '16.0.2.7.1' |         minorVersion: 0, | ||||||
|     }, { |         patchVersion: 2, | ||||||
|       majorVersion: 11, |         fullVersion: '16.0.2.7.1' | ||||||
|       minorVersion: 0, |       }, | ||||||
|       patchVersion: 13, |       { | ||||||
|       fullVersion: '11.0.13.8.1' |         majorVersion: 11, | ||||||
|     }]; |         minorVersion: 0, | ||||||
|  |         patchVersion: 13, | ||||||
|  |         fullVersion: '11.0.13.8.1' | ||||||
|  |       } | ||||||
|  |     ]; | ||||||
| 
 | 
 | ||||||
|     return jdkVersions; |     return jdkVersions; | ||||||
|   } |   } | ||||||
|  | @ -120,4 +126,4 @@ export class MicrosoftDistributions extends JavaBase { | ||||||
|   private convertVersionToSemver(version: MicrosoftVersion): string { |   private convertVersionToSemver(version: MicrosoftVersion): string { | ||||||
|     return `${version.majorVersion}.${version.minorVersion}.${version.patchVersion}`; |     return `${version.majorVersion}.${version.minorVersion}.${version.patchVersion}`; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -14,4 +14,4 @@ export interface MicrosoftVersion { | ||||||
|   minorVersion: number; |   minorVersion: number; | ||||||
|   patchVersion: number; |   patchVersion: number; | ||||||
|   fullVersion: string; |   fullVersion: string; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue