forked from GENIVI/genivi-vehicle-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildLib.ps1
72 lines (51 loc) · 1.99 KB
/
BuildLib.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
# BuildConfig should contain variables for:
# $unity: path to unity editor executable
# $username: username used to access remote share on IC machine
# $password: password for the $username account
# $ComputerName: remote IC machine name
# $ICPATH: remote path to folder where IC should be deployed e.g. "\\MACHINE\sharename\deploy\"
# $MainPath: local path to folder where main sim app should be deployed: e.g. "C:\deploy"
# $ICLaunchService: ip and port where the IC launcher service is running
. "$PSScriptRoot\BuildConfig.ps1"
$MainExe = $MainPath + "\JLR_MAIN.exe"
$ICexe = $ICPath + "\JLR_CONSOLE.exe"
$ICStart = $ICLaunchService + "/start"
$ICStop = $ICLaunchService + "/stop"
function BuildAndDeploy() {
#create a dir to build in
New-Item TempDeploy -type directory
Write-Host "Bulding Main App.."
&$unity -quit -batchmode -executeMethod BuildType.BuildInternalMain | Write-Output
Write-Host "Main App Built, Packaging.."
#clean up any old versions
Remove-Item $MainPath\* -recurse
Copy-Item TempDeploy\* $MainPath -recurse
Write-Host "Building Console.."
&$unity -quit -batchmode -executeMethod BuildType.BuildInternalConsole | Write-Output
Write-Host "Copying Console to remote machine.."
#set up PSDrive for remote access
$SecurePassword = ConvertTo-SecureString -AsPlainText $Password -Force
$cred = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $username, $SecurePassword
New-PSDrive -Name Y -PSProvider filesystem -Root $ICPath -Credential $cred
#clean up any old versions
Remove-Item Y:\* -recurse
Copy-Item TempDeploy\* Y:\ -recurse
#clean up temp build dir
Remove-Item TempDeploy/* -recurse
Remove-Item TempDeploy
}
function RunBoth() {
Write-Host "Starting Main Application"
&$MainExe
Start-Sleep -s 3
Write-Host "Starting Console Application"
Invoke-WebRequest -Uri $ICStart
}
function KillBoth() {
Stop-Process -processname JLR_MAIN
Invoke-WebRequest -Uri $ICStop
}
function MakeAndRun() {
BuildAndDeploy
RunBoth
}