forked from versionone/VersionOne.Client.VisualStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
144 lines (122 loc) · 5.38 KB
/
build.sh
File metadata and controls
144 lines (122 loc) · 5.38 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/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 $WORKSPACE/../build-tools/common.sh
# ---- Produce vsixmanifest ---------------------------------------------------
COMPONENTS="VersionOne.VisualStudio.VSPackage"
for COMPONENT_NAME in $COMPONENTS; do
cat > "$WORKSPACE/$COMPONENT_NAME/source.extension.vsixmanifest" <<EOF
<?xml version="1.0" encoding="utf-8"?>
<!-- Auto generated by build.sh at `date -u` -->
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="9423c8f0-ca04-432e-af2d-89aa9bc5ebe5" Version="$VERSION_NUMBER.$BUILD_NUMBER" Language="en-US" Publisher="VersionOne" />
<DisplayName>VersionOne Tracker</DisplayName>
<Description xml:space="preserve">VersionOne Package for Microsoft Visual Studio. For more information about VersionOne, see the VersionOne website at http://www.versionone.com.</Description>
<MoreInfo>http://www.versionone.com</MoreInfo>
<License>LICENSE.txt</License>
</Metadata>
<Installation>
<InstallationTarget Version="[11.0,13.0)" Id="Microsoft.VisualStudio.Premium"/>
<InstallationTarget Version="[11.0,13.0)" Id="Microsoft.VisualStudio.Ultimate"/>
<InstallationTarget Version="[11.0,13.0)" Id="Microsoft.VisualStudio.Pro"/>
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.0,4.5)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
</PackageManifest>
EOF
done
# ---- Produce .NET Metadata -------------------------------------------------
COMPONENTS="VersionOne.VisualStudio.VSPackage VersionOne.VisualStudio.DataLayer"
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.$BUILD_NUMBER")]
[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 $COMPONENT_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 ---------------------------------------------------------
rm -rf $WORKSPACE/*.nupkg
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"`"
MSBuild.exe $SOLUTION_FILE \
-p:SignAssembly=$SIGN_ASSEMBLY \
-p:AssemblyOriginatorKeyFile=$WIN_SIGNING_KEY \
-p:RequireRestoreConsent=false \
-p:Configuration="$Configuration" \
-p:Platform="$Platform" \
-p:Verbosity=Diagnostic
# ---- Run Tests --------------------------------------------------------------------------
if [ -z "$NUNIT_XML_OUTPUT" ]
then
NUNIT_XML_OUTPUT="nunit-VisualStudioClient-result.xml"
fi
# Make sure the nunit-console is available first...
NUNIT_CONSOLE_RUNNER=`/usr/bin/find packages | grep "${NUNIT_RUNNER_NAME}\$"`
if [ -z "$NUNIT_CONSOLE_RUNNER" ]
then
echo "Could not find $NUNIT_RUNNER_NAME in the $WORKSPACE/packages folder."
exit -1
fi
if [ -e /etc/bash.bashrc ] ; then
# Cygwin specific settings
$NUNIT_CONSOLE_RUNNER \
-framework:net-4.5\
-labels \
-stoponerror \
-xml=$NUNIT_XML_OUTPUT \
`winpath "$WORKSPACE/$TEST_DIR/bin/$Configuration/$TEST_DLL"`
else
# Msysgit specific settings
$NUNIT_CONSOLE_RUNNER \
//framework:net-4.5 \
//labels \
//stoponerror \
//xml=$NUNIT_XML_OUTPUT \
`winpath "$WORKSPACE/$TEST_DIR/bin/$Configuration/$TEST_DLL"`
fi