forked from google/orbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-orbit.ps1
72 lines (59 loc) · 2.43 KB
/
bootstrap-orbit.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
# Copyright (c) 2020 The Orbit Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
$conan = Get-Command -ErrorAction Ignore conan
if (!$conan) {
Write-Host "Conan not found. Trying to install it via python-pip..."
$pip3 = Get-Command -ErrorAction Ignore pip3
if(!$pip3) {
Write-Error -ErrorAction Stop @"
It seems you don't have Python3 installed (pip3.exe not found).
Please install Python or make it available in the path.
Alternatively you could also just install conan manually and make
it available in the path.
"@
}
& $pip3.Path install conan==1.40.3
if ($LastExitCode -ne 0) {
Throw "Error while installing conan via pip3."
}
$conan = Get-Command -ErrorAction Ignore conan
if (!$conan) {
Write-Error -ErrorAction Stop @"
It seems we installed conan sucessfully, but it is not available
in the path. Please ensure that your Python user-executable folder is
in the path and call this script again.
You can call 'pip3 show -f conan' to figure out where conan.exe was placed.
"@
}
} else {
Write-Host "Conan found. Checking version..."
$conan_version = (& $conan.Path --version).split(" ")[2]
$conan_version_major = $conan_version.split(".")[0] -as [int]
$conan_version_minor = $conan_version.split(".")[1] -as [int]
$conan_version_major_required = 1
$conan_version_minor_min = 36
if ($conan_version_major -eq $conan_version_major_required -and $conan_version_minor -lt $conan_version_minor_min) {
Write-Host "Your conan version $conan_version is too old. Let's try to update it."
Try {
$pip3 = Get-Command pip3
& $pip3.Path install --upgrade conan==1.40.3
} Catch {
Throw "Error while upgrading conan via pip3. Probably you have conan installed differently." +
" Please manually update conan to a at least version $conan_version_major_required.$conan_version_minor_min."
}
Write-Host "Successfully updated conan!"
} else {
Write-Host "Found conan version $conan_version. That fulfills the requirements!"
}
}
# Install conan config
& "$PSScriptRoot\third_party\conan\configs\install.ps1"
# Start build
if ($args) {
& "$PSScriptRoot\build.ps1" $args
} elseif (& $conan.Path remote list | Select-String -NotMatch "Disabled:" | Select-String "artifactory:") {
& "$PSScriptRoot\build.ps1" "default_relwithdebinfo" "ggp_relwithdebinfo"
} else {
& "$PSScriptRoot\build.ps1"
}