|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | 6 | import * as gulp from 'gulp'; |
7 | | -import * as xml2js from 'xml2js'; |
8 | 7 | import * as fs from 'fs'; |
9 | | -import axios, { AxiosResponse } from 'axios'; |
10 | 8 | import * as minimist from 'minimist'; |
11 | 9 | import { Octokit } from '@octokit/rest'; |
12 | 10 |
|
@@ -68,9 +66,23 @@ async function findRoslynCommitAsync(): Promise<string | null> { |
68 | 66 |
|
69 | 67 | console.log(`Roslyn version is ${roslynVersion}`); |
70 | 68 | // Nuget package should exist under out/.nuget/ since we have run the install dependencies task. |
71 | | - const nuspecFile = fs.readFileSync(`out/.nuget/microsoft.codeAnalysis.languageServer/${roslynVersion}`); |
72 | | - const nuspecFileXml = await xml2js.parseStringPromise(nuspecFile); |
73 | | - const commitNumber = nuspecFileXml.package.metadata[0].repository[0].$['commit']; |
| 69 | + const nuspecFile = fs |
| 70 | + .readFileSync( |
| 71 | + `out/.nuget/microsoft.codeAnalysis.languageServer/${roslynVersion}/microsoft.codeAnalysis.languageServer.nuspec` |
| 72 | + ) |
| 73 | + .toString(); |
| 74 | + const results = /commit="(.*)"/.exec(nuspecFile); |
| 75 | + if (results == null || results.length == 0) { |
| 76 | + logError('Failed to find commit number from nuspec file'); |
| 77 | + return null; |
| 78 | + } |
| 79 | + |
| 80 | + if (results.length != 2) { |
| 81 | + logError('Unexpected regex match result from nuspec file.'); |
| 82 | + return null; |
| 83 | + } |
| 84 | + |
| 85 | + const commitNumber = results[1]; |
74 | 86 | console.log(`commitNumber is ${commitNumber}`); |
75 | 87 | return commitNumber; |
76 | 88 | } |
@@ -119,21 +131,6 @@ async function tagRepoAsync( |
119 | 131 | return true; |
120 | 132 | } |
121 | 133 |
|
122 | | -async function sendHttpsGetRequestAsync(url: string): Promise<AxiosResponse<any, any> | null> { |
123 | | - try { |
124 | | - const nuspecResponse = await axios.get(url); |
125 | | - if (nuspecResponse.status != 200) { |
126 | | - logError('Failed to get nuspec file from nuget server'); |
127 | | - return null; |
128 | | - } |
129 | | - return nuspecResponse; |
130 | | - } catch (err) { |
131 | | - logError(`Failed to get response for ${url}`); |
132 | | - } |
133 | | - |
134 | | - return null; |
135 | | -} |
136 | | - |
137 | 134 | function logError(message: string): void { |
138 | 135 | console.log(`##vso[task.logissue type=error]${message}`); |
139 | 136 | } |
0 commit comments