mirror of
				https://github.com/actions/setup-java.git
				synced 2025-10-31 22:40:54 +00:00 
			
		
		
		
	Suggest minor changes to the code of Semeru related PR (#2)
This commit is contained in:
		
					parent
					
						
							
								6457aa3c54
							
						
					
				
			
			
				commit
				
					
						a73fb66f44
					
				
			
		
					 5 changed files with 27 additions and 44 deletions
				
			
		|  | @ -103,8 +103,8 @@ Currently, the following distributions are supported: | ||||||
| | `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 Build of 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) | ||||||
| | `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/) | | `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/) | ||||||
| | `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense) |  | ||||||
| | `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) | | | `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) | | ||||||
|  | | `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense) | ||||||
| 
 | 
 | ||||||
| **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. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -82,12 +82,12 @@ describe('getAvailableVersions', () => { | ||||||
|       .mockReturnValueOnce({ |       .mockReturnValueOnce({ | ||||||
|         statusCode: 200, |         statusCode: 200, | ||||||
|         headers: {}, |         headers: {}, | ||||||
|         result: manifestData |         result: manifestData as any | ||||||
|       }) |       }) | ||||||
|       .mockReturnValueOnce({ |       .mockReturnValueOnce({ | ||||||
|         statusCode: 200, |         statusCode: 200, | ||||||
|         headers: {}, |         headers: {}, | ||||||
|         result: manifestData |         result: manifestData as any | ||||||
|       }) |       }) | ||||||
|       .mockReturnValueOnce({ |       .mockReturnValueOnce({ | ||||||
|         statusCode: 200, |         statusCode: 200, | ||||||
|  |  | ||||||
							
								
								
									
										35
									
								
								dist/setup/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								dist/setup/index.js
									
										
									
									
										vendored
									
									
								
							|  | @ -104316,9 +104316,9 @@ const installer_3 = __nccwpck_require__(8766); | ||||||
| const installer_4 = __nccwpck_require__(8579); | const installer_4 = __nccwpck_require__(8579); | ||||||
| const installer_5 = __nccwpck_require__(883); | const installer_5 = __nccwpck_require__(883); | ||||||
| const installer_6 = __nccwpck_require__(3613); | const installer_6 = __nccwpck_require__(3613); | ||||||
| const installer_7 = __nccwpck_require__(4750); | const installer_7 = __nccwpck_require__(1121); | ||||||
| const installer_8 = __nccwpck_require__(4298); | const installer_8 = __nccwpck_require__(4750); | ||||||
| const installer_9 = __nccwpck_require__(1121); | const installer_9 = __nccwpck_require__(4298); | ||||||
| var JavaDistribution; | var JavaDistribution; | ||||||
| (function (JavaDistribution) { | (function (JavaDistribution) { | ||||||
|     JavaDistribution["Adopt"] = "adopt"; |     JavaDistribution["Adopt"] = "adopt"; | ||||||
|  | @ -104351,11 +104351,11 @@ function getJavaDistribution(distributionName, installerOptions, jdkFile) { | ||||||
|         case JavaDistribution.Microsoft: |         case JavaDistribution.Microsoft: | ||||||
|             return new installer_6.MicrosoftDistributions(installerOptions); |             return new installer_6.MicrosoftDistributions(installerOptions); | ||||||
|         case JavaDistribution.Semeru: |         case JavaDistribution.Semeru: | ||||||
|             return new installer_9.SemeruDistribution(installerOptions); |             return new installer_7.SemeruDistribution(installerOptions); | ||||||
|         case JavaDistribution.Corretto: |         case JavaDistribution.Corretto: | ||||||
|             return new installer_7.CorrettoDistribution(installerOptions); |             return new installer_8.CorrettoDistribution(installerOptions); | ||||||
|         case JavaDistribution.Oracle: |         case JavaDistribution.Oracle: | ||||||
|             return new installer_8.OracleDistribution(installerOptions); |             return new installer_9.OracleDistribution(installerOptions); | ||||||
|         default: |         default: | ||||||
|             return null; |             return null; | ||||||
|     } |     } | ||||||
|  | @ -105022,7 +105022,9 @@ class SemeruDistribution extends base_installer_1.JavaBase { | ||||||
|             const imageType = this.packageType; |             const imageType = this.packageType; | ||||||
|             const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
 |             const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
 | ||||||
|             const releaseType = this.stable ? 'ga' : 'ea'; |             const releaseType = this.stable ? 'ga' : 'ea'; | ||||||
|             console.time('semeru-retrieve-available-versions'); // eslint-disable-line no-console
 |             if (core.isDebug()) { | ||||||
|  |                 console.time('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
 | ||||||
|  |             } | ||||||
|             const baseRequestArguments = [ |             const baseRequestArguments = [ | ||||||
|                 `project=jdk`, |                 `project=jdk`, | ||||||
|                 'vendor=ibm', |                 'vendor=ibm', | ||||||
|  | @ -105046,17 +105048,7 @@ class SemeruDistribution extends base_installer_1.JavaBase { | ||||||
|                     // url is identical except page_index so print it once for debug
 |                     // url is identical except page_index so print it once for debug
 | ||||||
|                     core.debug(`Gathering available versions from '${availableVersionsUrl}'`); |                     core.debug(`Gathering available versions from '${availableVersionsUrl}'`); | ||||||
|                 } |                 } | ||||||
|                 if (core.isDebug()) { |                 const paginationPage = (yield this.http.getJson(availableVersionsUrl)).result; | ||||||
|                     core.debug('Semeru distribution version URL: ' + availableVersionsUrl); |  | ||||||
|                 } |  | ||||||
|                 let iTypedResponse = null; |  | ||||||
|                 try { |  | ||||||
|                     iTypedResponse = yield this.http.getJson(availableVersionsUrl); |  | ||||||
|                 } |  | ||||||
|                 catch (element) { |  | ||||||
|                     console.log('error', element); // eslint-disable-line no-console
 |  | ||||||
|                 } |  | ||||||
|                 const paginationPage = iTypedResponse.result; |  | ||||||
|                 if (paginationPage === null || paginationPage.length === 0) { |                 if (paginationPage === null || paginationPage.length === 0) { | ||||||
|                     // break infinity loop because we have reached end of pagination
 |                     // break infinity loop because we have reached end of pagination
 | ||||||
|                     break; |                     break; | ||||||
|  | @ -105065,18 +105057,17 @@ class SemeruDistribution extends base_installer_1.JavaBase { | ||||||
|                 page_index++; |                 page_index++; | ||||||
|             } |             } | ||||||
|             if (core.isDebug()) { |             if (core.isDebug()) { | ||||||
|                 core.startGroup('Print information about available IBM Semeru versions'); |                 core.startGroup('Print information about available versions'); | ||||||
|                 console.timeEnd('semeru-retrieve-available-versions'); // eslint-disable-line no-console
 |                 console.timeEnd('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
 | ||||||
|                 core.debug(`Available versions: [${availableVersions.length}]`); |                 core.debug(`Available versions: [${availableVersions.length}]`); | ||||||
|                 core.debug(availableVersions.map(item => item.version_data.semver).join(', ')); |                 core.debug(availableVersions.map(item => item.version_data.semver).join(', ')); | ||||||
|                 core.debug(JSON.stringify(availableVersions)); |  | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|             } |             } | ||||||
|             return availableVersions; |             return availableVersions; | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     getPlatformOption() { |     getPlatformOption() { | ||||||
|         // Adoptium has own platform names so need to map them
 |         // Adopt has own platform names so need to map them
 | ||||||
|         switch (process.platform) { |         switch (process.platform) { | ||||||
|             case 'darwin': |             case 'darwin': | ||||||
|                 return 'mac'; |                 return 'mac'; | ||||||
|  |  | ||||||
|  | @ -6,9 +6,9 @@ import {AdoptDistribution, AdoptImplementation} from './adopt/installer'; | ||||||
| import {TemurinDistribution, TemurinImplementation} from './temurin/installer'; | import {TemurinDistribution, TemurinImplementation} from './temurin/installer'; | ||||||
| import {LibericaDistributions} from './liberica/installer'; | import {LibericaDistributions} from './liberica/installer'; | ||||||
| import {MicrosoftDistributions} from './microsoft/installer'; | import {MicrosoftDistributions} from './microsoft/installer'; | ||||||
|  | import {SemeruDistribution} from './semeru/installer'; | ||||||
| import {CorrettoDistribution} from './corretto/installer'; | import {CorrettoDistribution} from './corretto/installer'; | ||||||
| import {OracleDistribution} from './oracle/installer'; | import {OracleDistribution} from './oracle/installer'; | ||||||
| import {SemeruDistribution} from './semeru/installer'; |  | ||||||
| 
 | 
 | ||||||
| enum JavaDistribution { | enum JavaDistribution { | ||||||
|   Adopt = 'adopt', |   Adopt = 'adopt', | ||||||
|  |  | ||||||
|  | @ -129,7 +129,9 @@ export class SemeruDistribution extends JavaBase { | ||||||
|     const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
 |     const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
 | ||||||
|     const releaseType = this.stable ? 'ga' : 'ea'; |     const releaseType = this.stable ? 'ga' : 'ea'; | ||||||
| 
 | 
 | ||||||
|     console.time('semeru-retrieve-available-versions'); // eslint-disable-line no-console
 |     if (core.isDebug()) { | ||||||
|  |       console.time('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
 | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     const baseRequestArguments = [ |     const baseRequestArguments = [ | ||||||
|       `project=jdk`, |       `project=jdk`, | ||||||
|  | @ -158,20 +160,11 @@ export class SemeruDistribution extends JavaBase { | ||||||
|         ); |         ); | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if (core.isDebug()) { |       const paginationPage = ( | ||||||
|         core.debug('Semeru distribution version URL: ' + availableVersionsUrl); |         await this.http.getJson<ISemeruAvailableVersions[]>( | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       let iTypedResponse = null; |  | ||||||
|       try { |  | ||||||
|         iTypedResponse = await this.http.getJson<ISemeruAvailableVersions[]>( |  | ||||||
|           availableVersionsUrl |           availableVersionsUrl | ||||||
|         ); |         ) | ||||||
|       } catch (element) { |       ).result; | ||||||
|         console.log('error', element); // eslint-disable-line no-console
 |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       const paginationPage = iTypedResponse!.result; |  | ||||||
|       if (paginationPage === null || paginationPage.length === 0) { |       if (paginationPage === null || paginationPage.length === 0) { | ||||||
|         // break infinity loop because we have reached end of pagination
 |         // break infinity loop because we have reached end of pagination
 | ||||||
|         break; |         break; | ||||||
|  | @ -182,13 +175,12 @@ export class SemeruDistribution extends JavaBase { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (core.isDebug()) { |     if (core.isDebug()) { | ||||||
|       core.startGroup('Print information about available IBM Semeru versions'); |       core.startGroup('Print information about available versions'); | ||||||
|       console.timeEnd('semeru-retrieve-available-versions'); // eslint-disable-line no-console
 |       console.timeEnd('Retrieving available versions for Semeru took'); // eslint-disable-line no-console
 | ||||||
|       core.debug(`Available versions: [${availableVersions.length}]`); |       core.debug(`Available versions: [${availableVersions.length}]`); | ||||||
|       core.debug( |       core.debug( | ||||||
|         availableVersions.map(item => item.version_data.semver).join(', ') |         availableVersions.map(item => item.version_data.semver).join(', ') | ||||||
|       ); |       ); | ||||||
|       core.debug(JSON.stringify(availableVersions)); |  | ||||||
|       core.endGroup(); |       core.endGroup(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -196,7 +188,7 @@ export class SemeruDistribution extends JavaBase { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   private getPlatformOption(): string { |   private getPlatformOption(): string { | ||||||
|     // Adoptium has own platform names so need to map them
 |     // Adopt has own platform names so need to map them
 | ||||||
|     switch (process.platform) { |     switch (process.platform) { | ||||||
|       case 'darwin': |       case 'darwin': | ||||||
|         return 'mac'; |         return 'mac'; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue