-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
96 lines (68 loc) · 2.92 KB
/
build.sh
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
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bash
set -ex
## x = exit immediately if a pipeline returns a non-zero status.
## e = print a trace of commands and their arguments during execution.
## See: http://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html#The-Set-Builtin
# ----- Variables -------------------------------------------------------------
# Variables in the build.properties file will be available to Jenkins
# build steps. Variables local to this script can be defined below.
. ./build.properties
# fix for jenkins inserting the windows-style path in $WORKSPACE
cd "$WORKSPACE"
export WORKSPACE=`pwd`
# ----- Common ----------------------------------------------------------------
# Common build script creates functions and variables expected by Jenkins.
if [ -d $WORKSPACE/../build-tools ]; then
## When script directory already exists, just update when there are changes.
cd $WORKSPACE/../build-tools
git fetch && git stash
if ! git log HEAD..origin/master --oneline --quiet; then
git pull
fi
cd $WORKSPACE
else
git clone https://github.com/versionone/openAgile-build-tools.git $WORKSPACE/../build-tools
fi
source ../build-tools/common.sh
# ---- Produce .NET Metadata --------------------------------------------------
COMPONENTS="Automation.Tfs.Console Automation.Tfs.Tools"
for COMPONENT_NAME in $COMPONENTS; do
cat > "$WORKSPACE/$COMPONENT_NAME/Properties/AssemblyInfo.cs" <<EOF
// Auto generated by build.sh at `date -u`
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("$VERSION_NUMBER.0")]
[assembly: AssemblyFileVersion("$VERSION_NUMBER.$BUILD_NUMBER")]
[assembly: AssemblyInformationalVersion("See $GITHUB_WEB_URL/wiki")]
[assembly: AssemblyProduct("$COMPONENT_NAME")]
[assembly: AssemblyTitle("$COMPONENT_NAME")]
[assembly: AssemblyDescription("$PRODUCT_NAME $Configuration Build")]
[assembly: AssemblyCompany("$ORGANIZATION_NAME")]
[assembly: AssemblyCopyright("Copyright $COPYRIGHT_RANGE, $ORGANIZATION_NAME, Licensed under modified BSD.")]
[assembly: AssemblyConfiguration("$Configuration")]
EOF
done
# ---- Clean solution ---------------------------------------------------------
MSBuild.exe $SOLUTION_FILE -m \
-t:Clean \
-p:Configuration="$Configuration" \
-p:Platform="$Platform" \
-p:Verbosity=Diagnostic
# ---- Refresh nuget packages -------------------------------------------------
nuget_packages_refresh
# ---- Build solution using msbuild -------------------------------------------
WIN_SIGNING_KEY="`winpath "$SIGNING_KEY"`"
echo $Platform
MSBuild.exe $SOLUTION_FILE \
-p:SignAssembly=false \
-p:AssemblyOriginatorKeyFile=$WIN_SIGNING_KEY \
-p:RequireRestoreConsent=false \
-p:Configuration="$Configuration" \
-p:Platform="$Platform" \
-p:Verbosity=Diagnostic \
-p:VisualStudioVersion=12.0
# ---- Execute nspec tests -------------------------------------------
# ./tests.sh