aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/main.ts
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-06-21 13:58:34 +0100
committerVeetaha <[email protected]>2020-07-07 21:30:11 +0100
commitf92bfb580780cda02f9ba8a935538f984d8a4c0d (patch)
treefbf0e24250cc36eaa122904e78cd7cb50fe1c665 /editors/code/src/main.ts
parent980a67f44629ed67a54b603aaf9d015a81d61f7a (diff)
Gzip artifacts
Co-authored-by: bjorn3 <[email protected]> Override miniz_oxide to build it with optimizations Building this crate with optimizations decreases the gzipping part of `cargo xtask dist` from `30-40s` down to `3s`, the overhead for `rustc` to apply optimizations is miserable on this background
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r--editors/code/src/main.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index eda95ae5c..bd99d696a 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -274,13 +274,13 @@ async function getServer(config: Config, state: PersistentState): Promise<string
274 }; 274 };
275 if (config.package.releaseTag === null) return "rust-analyzer"; 275 if (config.package.releaseTag === null) return "rust-analyzer";
276 276
277 let binaryName: string | undefined = undefined; 277 let platform: string | undefined;
278 if (process.arch === "x64" || process.arch === "ia32") { 278 if (process.arch === "x64" || process.arch === "ia32") {
279 if (process.platform === "linux") binaryName = "rust-analyzer-linux"; 279 if (process.platform === "linux") platform = "linux";
280 if (process.platform === "darwin") binaryName = "rust-analyzer-mac"; 280 if (process.platform === "darwin") platform = "mac";
281 if (process.platform === "win32") binaryName = "rust-analyzer-windows.exe"; 281 if (process.platform === "win32") platform = "windows";
282 } 282 }
283 if (binaryName === undefined) { 283 if (platform === undefined) {
284 vscode.window.showErrorMessage( 284 vscode.window.showErrorMessage(
285 "Unfortunately we don't ship binaries for your platform yet. " + 285 "Unfortunately we don't ship binaries for your platform yet. " +
286 "You need to manually clone rust-analyzer repository and " + 286 "You need to manually clone rust-analyzer repository and " +
@@ -291,8 +291,8 @@ async function getServer(config: Config, state: PersistentState): Promise<string
291 ); 291 );
292 return undefined; 292 return undefined;
293 } 293 }
294 294 const ext = platform === "windows" ? ".exe" : "";
295 const dest = path.join(config.globalStoragePath, binaryName); 295 const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`);
296 const exists = await fs.stat(dest).then(() => true, () => false); 296 const exists = await fs.stat(dest).then(() => true, () => false);
297 if (!exists) { 297 if (!exists) {
298 await state.updateServerVersion(undefined); 298 await state.updateServerVersion(undefined);
@@ -309,7 +309,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
309 } 309 }
310 310
311 const release = await fetchRelease(config.package.releaseTag); 311 const release = await fetchRelease(config.package.releaseTag);
312 const artifact = release.assets.find(artifact => artifact.name === binaryName); 312 const artifact = release.assets.find(artifact => artifact.name === `rust-analyzer-${platform}.gz`);
313 assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); 313 assert(!!artifact, `Bad release: ${JSON.stringify(release)}`);
314 314
315 // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error. 315 // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error.
@@ -321,6 +321,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
321 url: artifact.browser_download_url, 321 url: artifact.browser_download_url,
322 dest, 322 dest,
323 progressTitle: "Downloading rust-analyzer server", 323 progressTitle: "Downloading rust-analyzer server",
324 gunzip: true,
324 mode: 0o755 325 mode: 0o755
325 }); 326 });
326 327