forked from microsoft/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache.ps1
More file actions
27 lines (25 loc) · 893 Bytes
/
Copy pathcache.ps1
File metadata and controls
27 lines (25 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Store or restore the node_modules cache on Windows.
#
# Usage:
# cache.ps1 archive # create .build/node_modules_cache/cache.7z (cache miss)
# cache.ps1 extract # restore .build/node_modules_cache/cache.7z (cache hit)
#
# Uses 7-Zip. The archive and extract format must stay compatible; if you change
# the format here, bump build/.cachesalt to invalidate old caches.
param(
[Parameter(Mandatory = $true)]
[ValidateSet("archive", "extract")]
[string]$Action
)
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
switch ($Action) {
"archive" {
exec { node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt }
exec { mkdir -Force .build/node_modules_cache }
exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }
}
"extract" {
exec { 7z.exe x .build/node_modules_cache/cache.7z -aoa }
}
}