-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassemble.ps1
83 lines (67 loc) · 2.5 KB
/
assemble.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
74
75
76
77
78
79
80
81
82
83
If (Test-Path Env:APPVEYOR_REPO_TAG_NAME) {
$version = ($env:APPVEYOR_REPO_TAG_NAME).Substring(1)
if (($env:APPVEYOR_REPO_TAG_NAME).Contains("-") -eq $false) {
#Building a Full Release
$type = ""
$buildNumber = ""
echo "Tagged Release"
} Else {
#Building a Beta
$version = ($version).Substring(0, (($env:APPVEYOR_REPO_TAG_NAME).IndexOf("-") - 1))
$type = ($env:APPVEYOR_REPO_TAG_NAME).Substring((($env:APPVEYOR_REPO_TAG_NAME).IndexOf("-")))
$buildNumber = ""
echo "Tag but not release"
}
} Else {
$version = "2017.0.0"
$type = "-ci-"
$buildNumber = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$buildNumber = "{0:D4}" -f [convert]::ToInt32($buildNumber, 10), $buildNumber
}
# Taken from psake https://github.com/psake/psake
<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
#>
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
& $cmd
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}
echo "Building OpenCv Extern Library"
if ($env:APPVEYOR) {
$localFolder = "$env:APPVEYOR_BUILD_FOLDER\temp"
} else {
$localFolder = ".\temp"
}
./downloadCompiler.ps1
echo "Cloning FRC-OpenCvSharp repo"
git clone -q --branch=build2018 https://github.com/robotdotnet/FRC-OpenCvSharp.git "$localFolder\cvsharp"
$startLocation = Get-Location
Set-Location "$localFolder\cvsharp"
$cvBuild = "$localFolder\cvsharp\gradlew.bat"
./gradlew build
Set-Location $startLocation
if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) }
echo $version
echo $type
echo $buildNumber
./gradlew build -PbuildVersion="$version" -PbuildType="$type" -PbuildNumber="$buildNumber"
if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) }
If (($env:APPVEYOR_REPO_BRANCH -eq "master") -and (!$env:APPVEYOR_PULL_REQUEST_NUMBER)) {
if ($env:APPVEYOR) {
Get-ChildItem .\build\distributions\*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
}
}