-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.ps1
73 lines (62 loc) · 2.14 KB
/
bootstrap.ps1
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
Function Get-Folder($description)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$foldername = New-Object System.Windows.Forms.FolderBrowserDialog
$foldername.Description = $description
$foldername.rootfolder = "MyComputer"
$folder = ""
if($foldername.ShowDialog() -eq "OK") {
$folder = $foldername.SelectedPath
}
return $folder
}
$inputPath = Get-Folder -description "Select engine-3d diretory";
$inputPath = $inputPath.Replace("\", "\\");
$outputPath = Get-Folder -description "Select output directory";
$outputPath = $outputPath.Replace("\", "\\");
$content = @"
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "启动程序",
"program": "`${workspaceFolder}\\out\\index.js",
"args": [
"$inputPath",
"$outputPath",
"lib\\builtin\\effects",
"lib\\renderer\\shaders",
"script\\rollup.config.js",
"script\\rollup-mappings.config.js",
"examples",
"tests",
"node_modules",
"dist"
],
"outFiles": [
"`${workspaceFolder}/**/*.js"
]
}
]
}
"@
[System.IO.File]::WriteAllLines(".vscode/launch.json", $content)
function copyDir($relativePath, $include) {
"&Robocopy.exe $inputPath/$relativePath $outputPath/$relativePath $include /e"
&Robocopy.exe $inputPath/$relativePath $outputPath/$relativePath $include /e
}
function copyFile($fileName, $relativePath = ".") {
&Robocopy.exe $inputPath/$relativePath $outputPath/$relativePath $fileName
}
copyDir "examples"
copyDir "tests"
copyDir "lib\builtin\effects" -include @("*.json")
copyDir "lib\renderer\shaders" -include @("*.frag", "*.vert", "*.json")
&Robocopy.exe ".\resource\engine-3d-ts" $outputPath /e
Write-Host "Finished."
Read-Host "Press ENTER to exit"