VS Python analysis engine integration #1231
VS Python analysis engine integration #1231MikhailArkhipov merged 70 commits intomicrosoft:masterfrom MikhailArkhipov:vsc
Conversation
src/client/activation/downloader.ts
Outdated
| }); | ||
|
|
||
| let firstResponse = true; | ||
| https.get(uri, (response) => { |
There was a problem hiding this comment.
please use npm package like request-package for this.
src/client/activation/downloader.ts
Outdated
|
|
||
| let firstResponse = true; | ||
| https.get(uri, (response) => { | ||
| this.checkHttpResponse(response); |
There was a problem hiding this comment.
Return value of checkHttpResponse not checked
There was a problem hiding this comment.
N/A as replaced by request-package
src/client/activation/downloader.ts
Outdated
| deferred.resolve(); | ||
| }).on('error', (err) => { | ||
| tempFile.cleanupCallback(); | ||
| this.handleError(`Unable to download Python Analysis Engine. Error ${err}`); |
There was a problem hiding this comment.
Errors thrown by this.handleError will not be bubbled up.
You're better off changing as follows:
fileStream.on('finish', () => {
fileStream.close();
deferred.resolve();
}).on('error', (err) => {
tempFile.cleanupCallback();
deferred.reject(err);
});There was a problem hiding this comment.
resolve will be done by VSC progress. Added reject
| try { | ||
| await this.verifyDownload(localTempFilePath); | ||
| await this.unpackArchive(context.extensionPath, localTempFilePath); | ||
| } finally { |
There was a problem hiding this comment.
better to add a catch here and then invoke this.handleError
This way, all errors are handled and logged in one place (you won't need to call this.handleError in a number of places)
src/client/activation/downloader.ts
Outdated
| this.output.append('Verifying download... '); | ||
| const verifier = new HashVerifier(); | ||
| if (!await verifier.verifyHash(filePath, this.platformData.getExpectedHash())) { | ||
| this.handleError('Hash of the downloaded file does not match.'); |
There was a problem hiding this comment.
better to just throw an exception here, let calling code log the error.
There was a problem hiding this comment.
It is more for the output formatting. It starts with Verifying download... and I'd like it to look as
Verifying download... valid on the same line and on different lines if there is an error. Same as in other cases: download and unpack.
| return process.env.VSC_PYTHON_CI_TEST === '1'; | ||
| } | ||
|
|
||
| public async checkDependencies(): Promise<boolean> { |
There was a problem hiding this comment.
Please move to some other place. Checking dependencies is not the role of a Configuration service.
| } | ||
| } | ||
|
|
||
| private async checkDotNet(): Promise<boolean> { |
There was a problem hiding this comment.
Please move out of this class ( Checking dependencies is not the role of a Configuration service)
| - yarn run testDebugger --silent | ||
| - yarn run testSingleWorkspace --silent | ||
| - yarn run testMultiWorkspace --silent | ||
| # - yarn run testAnalysisEngine --silent |
There was a problem hiding this comment.
Can't remember, but please could you confirm that the tests only run on Appveyor and not on Travis. If this is true, then we might want to create an issue for this, to ensure we try to get this resolved.
There was a problem hiding this comment.
They currently only on Appveyor b/c of setup issues. We need to discuss if we want a) install .NET Runtime on Travis or b) rely on some other means. (b) may work for us as we download from Azure but third party contributors cant.
|
|
||
| const downloadUriPrefix = 'https://pvsc.blob.core.windows.net/python-analysis'; | ||
| const downloadBaseFileName = 'python-analysis-vscode'; | ||
| const downloadVersion = '0.1.0'; |
There was a problem hiding this comment.
We might want to store the version info, in package.json.
This way its easier when we make upgrades (all dependencies and versions are stored and listed in a central location - package.json).
E.g. package.json:
},
"dotNetDepedencies":{
"python-analysis-vscode":"0.1.0"
},
"dependencies": {
"arch": "^2.1.0",There was a problem hiding this comment.
Might want to store the hashes in here too.
There was a problem hiding this comment.
Hashes are generated in the build. And we don't want users to be able to modify them (or any malicious code running under user creds). Also, don't want users to be able to change engine version or URLs.
|
|
||
| // This file will be replaced by a generated one during the release build | ||
| // with actual hashes of the uploaded packages. | ||
| export const analysis_engine_win_x86_sha512 = ''; |
There was a problem hiding this comment.
Wouldn't it be better to generate some json file to store this information, rather than generating a .js. Feels better to store in a json file (possibly package.json or other).
The goal is to ensure all depedencies (file names, versions, etc are stored in a central location such as package.json or as in .net, we'd stored these in the project file)
There was a problem hiding this comment.
No. We don't want it visible and easily modifiable.
Replaces #1144
Fixes #1101
Fixes #1087
Fixes #1063
Fixes #1051
Fixes #1004
Fixes #998
Fixes #408
Fixes #82
This pull request: