mirror of
				https://github.com/actions/setup-dotnet.git
				synced 2025-11-04 12:13:46 +00:00 
			
		
		
		
	Add static fields to DotnetCoreInstaller
This commit is contained in:
		
							parent
							
								
									7de6b26c38
								
							
						
					
					
						commit
						44ac234a2e
					
				
							
								
								
									
										10
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@ -253,8 +253,6 @@ class DotnetCoreInstaller {
 | 
				
			|||||||
        return __awaiter(this, void 0, void 0, function* () {
 | 
					        return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
            let output = '';
 | 
					            let output = '';
 | 
				
			||||||
            let resultCode = 0;
 | 
					            let resultCode = 0;
 | 
				
			||||||
            const installationDirectoryWindows = 'C:\\Program` Files\\dotnet';
 | 
					 | 
				
			||||||
            const installationDirectoryLinux = '/usr/share/dotnet';
 | 
					 | 
				
			||||||
            const versionResolver = new DotnetVersionResolver(this.version);
 | 
					            const versionResolver = new DotnetVersionResolver(this.version);
 | 
				
			||||||
            const versionObject = versionResolver.createVersionObject();
 | 
					            const versionObject = versionResolver.createVersionObject();
 | 
				
			||||||
            var envVariables = {};
 | 
					            var envVariables = {};
 | 
				
			||||||
@ -284,7 +282,7 @@ class DotnetCoreInstaller {
 | 
				
			|||||||
                if (process.env['no_proxy'] != null) {
 | 
					                if (process.env['no_proxy'] != null) {
 | 
				
			||||||
                    command += ` -ProxyBypassList ${process.env['no_proxy']}`;
 | 
					                    command += ` -ProxyBypassList ${process.env['no_proxy']}`;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                command += ` -InstallDir ${installationDirectoryWindows}`;
 | 
					                command += ` -InstallDir ${DotnetCoreInstaller.installationDirectoryWindows}`;
 | 
				
			||||||
                // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
					                // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
				
			||||||
                const powershellPath = yield io.which('powershell', true);
 | 
					                const powershellPath = yield io.which('powershell', true);
 | 
				
			||||||
                var options = {
 | 
					                var options = {
 | 
				
			||||||
@ -322,7 +320,7 @@ class DotnetCoreInstaller {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (IS_LINUX) {
 | 
					                if (IS_LINUX) {
 | 
				
			||||||
                    scriptArguments.push('--install-dir', installationDirectoryLinux);
 | 
					                    scriptArguments.push('--install-dir', DotnetCoreInstaller.installationDirectoryLinux);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
					                // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
				
			||||||
                resultCode = yield exec.exec(`"${scriptPath}"`, scriptArguments, {
 | 
					                resultCode = yield exec.exec(`"${scriptPath}"`, scriptArguments, {
 | 
				
			||||||
@ -347,7 +345,7 @@ class DotnetCoreInstaller {
 | 
				
			|||||||
        else {
 | 
					        else {
 | 
				
			||||||
            if (IS_WINDOWS) {
 | 
					            if (IS_WINDOWS) {
 | 
				
			||||||
                // This is the default set in install-dotnet.ps1
 | 
					                // This is the default set in install-dotnet.ps1
 | 
				
			||||||
                core.exportVariable('DOTNET_ROOT', "C:\Program Files\dotnet");
 | 
					                core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryWindows);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
                // This is the default set in install-dotnet.sh
 | 
					                // This is the default set in install-dotnet.sh
 | 
				
			||||||
@ -359,6 +357,8 @@ class DotnetCoreInstaller {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.DotnetCoreInstaller = DotnetCoreInstaller;
 | 
					exports.DotnetCoreInstaller = DotnetCoreInstaller;
 | 
				
			||||||
 | 
					DotnetCoreInstaller.installationDirectoryWindows = 'C:\\Program` Files\\dotnet';
 | 
				
			||||||
 | 
					DotnetCoreInstaller.installationDirectoryLinux = '/usr/share/dotnet';
 | 
				
			||||||
function logWarning(message) {
 | 
					function logWarning(message) {
 | 
				
			||||||
    const warningPrefix = '[warning]';
 | 
					    const warningPrefix = '[warning]';
 | 
				
			||||||
    core.info(`${warningPrefix}${message}`);
 | 
					    core.info(`${warningPrefix}${message}`);
 | 
				
			||||||
 | 
				
			|||||||
@ -83,6 +83,8 @@ export class DotnetVersionResolver {
 | 
				
			|||||||
export class DotnetCoreInstaller {
 | 
					export class DotnetCoreInstaller {
 | 
				
			||||||
  private version: string;
 | 
					  private version: string;
 | 
				
			||||||
  private quality: string;
 | 
					  private quality: string;
 | 
				
			||||||
 | 
					  static installationDirectoryWindows = 'C:\\Program` Files\\dotnet';
 | 
				
			||||||
 | 
					  static installationDirectoryLinux = '/usr/share/dotnet';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(version: string, quality: string) {
 | 
					  constructor(version: string, quality: string) {
 | 
				
			||||||
    this.version = version;
 | 
					    this.version = version;
 | 
				
			||||||
@ -92,8 +94,7 @@ export class DotnetCoreInstaller {
 | 
				
			|||||||
  public async installDotnet() {
 | 
					  public async installDotnet() {
 | 
				
			||||||
    let output = '';
 | 
					    let output = '';
 | 
				
			||||||
    let resultCode = 0;
 | 
					    let resultCode = 0;
 | 
				
			||||||
    const installationDirectoryWindows = 'C:\\Program` Files\\dotnet';
 | 
					    
 | 
				
			||||||
    const installationDirectoryLinux = '/usr/share/dotnet';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const versionResolver = new DotnetVersionResolver(this.version);
 | 
					    const versionResolver = new DotnetVersionResolver(this.version);
 | 
				
			||||||
    const versionObject = versionResolver.createVersionObject();
 | 
					    const versionObject = versionResolver.createVersionObject();
 | 
				
			||||||
@ -129,7 +130,7 @@ export class DotnetCoreInstaller {
 | 
				
			|||||||
        command += ` -ProxyBypassList ${process.env['no_proxy']}`;
 | 
					        command += ` -ProxyBypassList ${process.env['no_proxy']}`;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      command += ` -InstallDir ${installationDirectoryWindows}`;
 | 
					      command += ` -InstallDir ${DotnetCoreInstaller.installationDirectoryWindows}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
					      // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
				
			||||||
      const powershellPath = await io.which('powershell', true);
 | 
					      const powershellPath = await io.which('powershell', true);
 | 
				
			||||||
@ -178,7 +179,7 @@ export class DotnetCoreInstaller {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (IS_LINUX) {
 | 
					      if (IS_LINUX) {
 | 
				
			||||||
        scriptArguments.push('--install-dir', installationDirectoryLinux);
 | 
					        scriptArguments.push('--install-dir', DotnetCoreInstaller.installationDirectoryLinux);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
					      // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
 | 
				
			||||||
@ -206,7 +207,7 @@ export class DotnetCoreInstaller {
 | 
				
			|||||||
        // This is the default set in install-dotnet.ps1
 | 
					        // This is the default set in install-dotnet.ps1
 | 
				
			||||||
        core.exportVariable(
 | 
					        core.exportVariable(
 | 
				
			||||||
          'DOTNET_ROOT',
 | 
					          'DOTNET_ROOT',
 | 
				
			||||||
          "C:\Program Files\dotnet"
 | 
					          DotnetCoreInstaller.installationDirectoryWindows
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        // This is the default set in install-dotnet.sh
 | 
					        // This is the default set in install-dotnet.sh
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user