-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathChess.build
More file actions
144 lines (118 loc) · 5.68 KB
/
Chess.build
File metadata and controls
144 lines (118 loc) · 5.68 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
<?xml version="1.0"?>
<project name="Chess" default="all" basedir=".">
<!-- ============================================================
Build script for the Chess solution.
============================================================ -->
<target name="all" depends="init, build, package"/>
<!-- ============================================================
Initialize the projet properties.
============================================================ -->
<target name="init">
<property name="solutionFile" value="All.sln"/>
<property name="msbuildCmd" value="${environment::get-folder-path('ProgramFilesX86')}\MSBuild\14.0\bin\amd64\msbuild.exe"/>
<fail unless="${file::exists(msbuildCmd)}">
Unable to find msbuild.exe - file ${msbuildCmd} does not exist.
Try downloading the Microsoft Build Tools 2015 from https://www.microsoft.com/en-us/download/details.aspx?id=48159
</fail>
<echo>Using msbuild.exe from ${msbuildCmd}</echo>
<property name="config" value="debug" overwrite="false"/>
<property name="nuget.tool" value=".\Packages\NuGet.CommandLine.3.3.0\tools\nuget.exe"/>
<property name="nuget.temp" value=".\Nuget\Temp"/>
<!--
Define CHESS API version number using semantic versioning convention http://semver.org/
This version number MUST be incremented everytime the API changes so that the nuget package
is updated correctly.
-->
<property name="apiVersion" value="1.0.1"/>
<!-- Verify the nuspec verion is the same and the defined apiVersion.-->
<property name="chess.nuspec" value=".\Nuget\Chess.nuspec"/>
<xmlpeek file="${chess.nuspec}" xpath="//package/metadata/version" property="nuget.apiVersion" />
<fail unless="${apiVersion == nuget.apiVersion}">
API version in build (${apiVersion}) differs from API version in nuget nuspec package (${nuget.apiVersion}).
These values must be the same.
</fail>
<property name="chess.nupkg" value="Chess.${apiVersion}.nupkg"/>
</target>
<!-- ============================================================
Build the solution.
============================================================ -->
<target name="build" depends="init">
<exec program="${msbuildCmd}" >
<arg value="${solutionFile}" />
<arg value="/p:configuration=${config}" />
<arg value="/t:Rebuild" />
<arg value='/p:DefineConstants="TRACE;DEBUG;CODE_ANALYSIS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS"'/>
</exec>
</target>
<!-- ============================================================
Package the project.
============================================================ -->
<target name="package" depends="init">
<delete dir="${nuget.temp}" if="${directory::exists(nuget.temp)}"/>
<mkdir dir="${nuget.temp}"/>
<mkdir dir="${nuget.temp}\tools"/>
<mkdir dir="${nuget.temp}\lib"/>
<copy todir="${nuget.temp}\tools">
<fileset basedir=".\bin\">
<include name="Chess.dll"/>
<include name="mchess.exe"/>
<include name="mchess.exe.config"/>
<include name="mcut.exe"/>
<include name="Microsoft.Concurrency.Taskometer.dll"/>
<include name="Microsoft.Concurrency.UnitTesting.Execution.dll"/>
<include name="Microsoft.Concurrency.UnitTesting.Extensions.dll"/>
<include name="Microsoft.Concurrency.UnitTestingFramework.dll"/>
<include name="Microsoft.ManagedChess.Base.exe"/>
<include name="Microsoft.ManagedChess.Engine.dll"/>
<include name="Microsoft.ManagedChess.Framework4Wrappers.dll"/>
<include name="Microsoft.ManagedChess.Framework35Wrappers.dll"/>
<include name="Microsoft.ManagedChess.Launcher.dll"/>
<include name="Microsoft.ManagedChess.MChess.dll"/>
<include name="Microsoft.ManagedChess.ThreadingWrappers.dll"/>
<include name="Microsoft.ManagedChessAPI.dll"/>
<include name="Scenario.Managed.dll"/>
</fileset>
</copy>
<copy todir="${nuget.temp}\tools">
<fileset basedir=".\ManagedChess\external">
<include name="Microsoft.ExtendedReflection.dll"/>
<include name="Microsoft.ExtendedReflection.ClrMonitor.X86.dll"/>
</fileset>
</copy>
<echo file="${nuget.temp}\tools\regClrMonitor.bat">@echo off
REM Run this batch file with elevated priveledges in order to register the required components to run CHESS
regsvr32 /u /s Microsoft.ExtendedReflection.ClrMonitor.X86.dll
regsvr32 Microsoft.ExtendedReflection.ClrMonitor.X86.dll
</echo>
<copy todir="${nuget.temp}\lib">
<fileset basedir=".\bin\">
<include name="Microsoft.Concurrency.UnitTestingFramework.dll"/>
</fileset>
</copy>
<!-- Pack the packages -->
<exec program="${nuget.tool}">
<arg value="pack"/>
<arg value="${chess.nuspec}"/>
</exec>
</target>
<!-- ============================================================
Push the built/packaged project to nuget
============================================================ -->
<target name="push" depends="init, initPush, build, package">
<exec program="${nuget.tool}">
<arg value="push"/>
<arg value="${chess.nupkg}"/>
<arg value="${nuget.apikey}"/>
</exec>
</target>
<!-- ============================================================
Set up push specific properties
============================================================ -->
<target name="initPush" depends="init">
<fail unless="${property::exists('nuget.apikey')}">
Cannot push to nuget without nuget API key.
This can be passed on the command line with the command:
build push -D:nuget.apikey=[key]
</fail>
</target>
</project>