forked from fbertram/TuringTrader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SINGLE_CLICK_BUILD.bat
127 lines (102 loc) · 3.97 KB
/
SINGLE_CLICK_BUILD.bat
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
@echo off
rem TODO: there should be a better way to find the path to MSVC
PATH=%PATH%;"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE"
echo *
echo *
echo ***************************************************************************
echo *** clean project
echo ***************************************************************************
rem * we'd like to clean more aggressively than 'dotnet clean'
rd /s /q TuringTrader\bin
rd /s /q TuringTrader\obj
rd /s /q TuringTrader.Simulator\bin
rd /s /q TuringTrader.Simulator\obj
rd /s /q BooksAndPubs\bin
rd /s /q BooksAndPubs\obj
rd /s /q BooksAndPubsV2\bin
rd /s /q BooksAndPubsV2\obj
rd /s /q TuringTrader.Setup\bin
rd /s /q TuringTrader.Setup\obj
rd /s /q DocFX\_site
git stash -u
echo *
echo *
echo ***************************************************************************
echo *** version info
echo ***************************************************************************
rem * example: git tag = 0.13
rem git describe = 0.13-14-g87a9f97
rem TT_GIT = 0.13-14-g87a9f97
rem TT_VER = 0.13.14-g87a9f97
for /f "tokens=*" %%g in ('git describe') do (set TT_GIT=%%g)
set TT_VER=%TT_GIT:-g=#g%
set TT_VER=%TT_VER:-=.%
set TT_VER=%TT_VER:#g=-g%
set _TT_VER=%TT_VER%-gdummy
set _SUFFIX=%_TT_VER:*-=%
call set TT_V0=%%_TT_VER:%_SUFFIX%=%%
set TT_V0=%TT_V0:-=%
echo *** GIT INFO: %TT_GIT%
echo *** VERSION: %TT_VER%
echo *** VERSION-0: %TT_V0%
pushd TuringTrader
echo internal static class GitInfo { public static string Version = "%TT_GIT%"; } > GitVersion.cs
popd
echo *
echo *
echo ***************************************************************************
echo *** build TuringTrader
echo ***************************************************************************
dotnet build TuringTrader/TuringTrader.csproj -c "Release" /p:Platform=x64 /p:Version=%TT_VER%
dotnet publish TuringTrader\TuringTrader.csproj -c "Release" /p:Platform=x64 /p:PublishProfile=FolderProfile /p:Version=%TT_VER%
rem * we can delete these after publishing
rd /s /q TuringTrader\bin
rd /s /q TuringTrader\obj
rd /s /q TuringTrader.Simulator\bin
rd /s /q TuringTrader.Simulator\obj
echo *
echo *
echo ***************************************************************************
echo *** build Books and Pubs
echo ***************************************************************************
dotnet build BooksAndPubs/BooksAndPubs.csproj -c "Release" /p:Platform=x64 /p:Version=%TT_VER%
dotnet build BooksAndPubsV2/BooksAndPubsV2.csproj -c "Release" /p:Platform=x64 /p:Version=%TT_VER%
rem * we can delete these, because the DLLs have been copied to Algorithms
rd /s /q BooksAndPubs\bin
rd /s /q BooksAndPubs\obj
rd /s /q BooksAndPubsV2\bin
rd /s /q BooksAndPubsV2\obj
echo *
echo *
echo ***************************************************************************
echo *** build setup file
echo ***************************************************************************
rem * it is important that the books and pubs folders have their bin and obj
rem * cleaned so that WiX won't harvest these
dotnet build TuringTrader.Setup\TuringTrader.Setup.wixproj -c "Release" /p:Platform=x64 /p:Version=%TT_V0%
rem * we won't need these anymore
rd /s /q TuringTrader.Setup\obj
rd /s /q TuringTrader/publish
echo *
echo *
echo ***************************************************************************
echo *** build documentation
echo ***************************************************************************
pushd DocFX
docfx
popd
echo *
echo *
echo ***************************************************************************
echo *** cleanup
echo ***************************************************************************
rem * fall back to the original file w/o version info
git restore TuringTrader/GitVersion.cs
git stash pop
echo *
echo *
echo ***************************************************************************
echo *** end of build
echo ***************************************************************************
start TuringTrader.Setup\bin\x64\Release
pause