forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathdev.ps1
More file actions
88 lines (72 loc) · 2.5 KB
/
dev.ps1
File metadata and controls
88 lines (72 loc) · 2.5 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
81
82
83
84
85
86
87
88
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
<#
.SYNOPSIS
Developer task runner for hermes-windows.
.DESCRIPTION
A single entry point for common development tasks.
Run without arguments or with -? to see available commands.
.EXAMPLE
.\dev build --help
.\dev fork-sync --dep icu-small
.\dev fork-sync --dep icu-small --status
#>
param(
[Parameter(Position = 0)]
[string]$Command,
[Parameter(Position = 1, ValueFromRemainingArguments)]
[string[]]$Args
)
$ErrorActionPreference = 'Stop'
$ScriptDir = $PSScriptRoot
# =============================================================================
# Helpers
# =============================================================================
function Ensure-ForkSync {
$stamp = Join-Path $ScriptDir 'tools\fork-sync\node_modules\.package-lock.json'
$pkg = Join-Path $ScriptDir 'tools\fork-sync\package.json'
if (-not (Test-Path $stamp) -or
(Get-Item $pkg).LastWriteTime -gt (Get-Item $stamp).LastWriteTime) {
Write-Host 'Installing fork-sync dependencies...'
Push-Location (Join-Path $ScriptDir 'tools\fork-sync')
try { npm install } finally { Pop-Location }
}
}
function Show-Help {
Write-Host ''
Write-Host ' hermes-windows developer tasks'
Write-Host ' =============================='
Write-Host ''
Write-Host ' .\dev build [args] Build Hermes for Windows'
Write-Host ' .\dev build-fork-sync Install fork-sync dependencies'
Write-Host ' .\dev fork-sync [args] Run fork-sync tool'
Write-Host ''
Write-Host ' Examples:'
Write-Host ' .\dev fork-sync --dep icu-small'
Write-Host ' .\dev fork-sync --dep icu-small --status'
Write-Host ' .\dev fork-sync --dep icu-small --continue'
Write-Host ' .\dev fork-sync --dep icu-small --abort'
Write-Host ' .\dev fork-sync --help'
Write-Host ' .\dev build --help'
Write-Host ''
}
# =============================================================================
# Commands
# =============================================================================
switch ($Command) {
'build' {
& node (Join-Path $ScriptDir '.ado\scripts\build.js') @Args
}
'build-fork-sync' {
Ensure-ForkSync
Write-Host 'fork-sync dependencies installed.'
}
'fork-sync' {
Ensure-ForkSync
& node (Join-Path $ScriptDir 'tools\fork-sync\sync.ts') @Args
}
default {
Show-Help
}
}
exit $LASTEXITCODE