-
Notifications
You must be signed in to change notification settings - Fork 61
/
build.ps1
60 lines (49 loc) · 2.04 KB
/
build.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
<#
.SYNOPSIS
Builds Ros2ForUnity asset
.DESCRIPTION
This script builds Ros2DorUnity asset
.PARAMETER with_tests
Build tests
.PARAMETER standalone
Add ros2 binaries. Currently standalone flag is fixed to true, so there is no way to build without standalone libs. Parameter kept for future releases
.PARAMETER clean_install
Makes a clean installation. Removes install dir before deploying
#>
Param (
[Parameter(Mandatory=$false)][switch]$with_tests=$false,
[Parameter(Mandatory=$false)][switch]$standalone=$false,
[Parameter(Mandatory=$false)][switch]$clean_install=$false
)
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
if(-Not (Test-Path -Path "$scriptPath\src\ros2cs")) {
Write-Host "Pull repositories with 'pull_repositories.ps1' first." -ForegroundColor Red
exit 1
}
Write-Host $msg -ForegroundColor Green
$options = @{
with_tests = $with_tests
standalone = $standalone
}
if($clean_install) {
Write-Host "Cleaning install directory..." -ForegroundColor White
Remove-Item -Path "$scriptPath\install" -Force -Recurse -ErrorAction Ignore
}
if($standalone) {
& "python" $SCRIPTPATH\src\scripts\metadata_generator.py --standalone
} else {
& "python" $SCRIPTPATH\src\scripts\metadata_generator.py
}
& "$scriptPath\src\ros2cs\build.ps1" @options
if($?) {
md -Force $scriptPath\install\asset | Out-Null
Copy-Item -Path $scriptPath\src\Ros2ForUnity -Destination $scriptPath\install\asset\ -Recurse -Force
$plugin_path=Join-Path -Path $scriptPath -ChildPath "\install\asset\Ros2ForUnity\Plugins\"
Write-Host "Deploying build to $plugin_path" -ForegroundColor Green
& "$scriptPath\deploy_unity_plugins.ps1" $plugin_path
Copy-Item -Path $scriptPath\src\Ros2ForUnity\metadata_ros2cs.xml -Destination $scriptPath\install\asset\Ros2ForUnity\Plugins\Windows\x86_64\
Copy-Item -Path $scriptPath\src\Ros2ForUnity\metadata_ros2cs.xml -Destination $scriptPath\install\asset\Ros2ForUnity\Plugins\
} else {
Write-Host "Ros2cs build failed!" -ForegroundColor Red
exit 1
}