-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathdev.ps1
More file actions
80 lines (65 loc) · 2.2 KB
/
Copy pathdev.ps1
File metadata and controls
80 lines (65 loc) · 2.2 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
<#
.SYNOPSIS
Developer task runner for v8-jsi.
.DESCRIPTION
A single entry point for common development tasks.
Run without arguments or with -? to see available commands.
.EXAMPLE
.\dev build --help
.\dev build --configuration debug
.\dev fork-sync --dep nodejs --status
#>
param(
[Parameter(Position = 0)]
[string]$Command,
[Parameter(Position = 1, ValueFromRemainingArguments)]
[string[]]$Args
)
$ErrorActionPreference = 'Stop'
$ScriptDir = $PSScriptRoot
# =============================================================================
# Helpers
# =============================================================================
function Ensure-ScriptDeps {
$stamp = Join-Path $ScriptDir 'scripts\fork-sync\node_modules\.package-lock.json'
$pkg = Join-Path $ScriptDir 'scripts\fork-sync\package.json'
if (-not (Test-Path $stamp) -or
(Get-Item $pkg).LastWriteTime -gt (Get-Item $stamp).LastWriteTime) {
Write-Host 'Installing script dependencies...'
Push-Location (Join-Path $ScriptDir 'scripts\fork-sync')
try { npm install } finally { Pop-Location }
}
}
function Show-Help {
Write-Host ''
Write-Host ' v8-jsi developer tasks'
Write-Host ' ======================'
Write-Host ''
Write-Host ' .\dev build [args] Build v8jsi'
Write-Host ' .\dev fork-sync [args] Run fork-sync tool'
Write-Host ''
Write-Host ' Examples:'
Write-Host ' .\dev build --help'
Write-Host ' .\dev build --configuration debug'
Write-Host ' .\dev build --no-build --test'
Write-Host ' .\dev fork-sync --dep nodejs --status'
Write-Host ''
}
# =============================================================================
# Commands
# =============================================================================
switch ($Command) {
'build' {
& node (Join-Path $ScriptDir 'scripts\build.ts') @Args
}
'fork-sync' {
Ensure-ScriptDeps
& node (Join-Path $ScriptDir 'scripts\fork-sync\node_modules\@rnx-kit\fork-sync\lib\sync.js') @Args
}
default {
Show-Help
}
}
exit $LASTEXITCODE