6
6
[switch ]$NoValidate
7
7
)
8
8
9
+ $AntlrVersion = " 3.5.2-dev"
10
+ $STVersion = " 4.0.9-dev"
11
+
9
12
# build the solution
10
13
$SolutionPath = " ..\..\Antlr3.sln"
11
14
@@ -43,6 +46,11 @@ If ($Logger) {
43
46
$LoggerArgument = " /logger:$Logger "
44
47
}
45
48
49
+ # Make sure we don't have a stray config file from the bootstrap build
50
+ If (Test-Path ' ..\..\NuGet.config' ) {
51
+ Remove-Item ' ..\..\NuGet.config'
52
+ }
53
+
46
54
# Restore packages
47
55
.\NuGet.exe update - self
48
56
.\NuGet.exe restore $SolutionPath - Project2ProjectTimeOut 1200
@@ -57,82 +65,25 @@ If (-not $?) {
57
65
$ArchivePath = " .\Backup\Bootstrap-" + [System.IO.Path ]::GetFileNameWithoutExtension([System.IO.Path ]::GetRandomFileName()) + " .7z"
58
66
.\7z.exe a - r $ArchivePath " ..\Bootstrap\*"
59
67
60
- # copy the new bootstrap files
61
- if ($DebugBuild ) {
62
- $BootstrapBinaries = " Antlr3.exe" , " Antlr3.exe.config" , " Antlr3.Runtime.dll" , " Antlr3.Runtime.Debug.dll" , " Antlr4.StringTemplate.dll" , " Antlr4.StringTemplate.Visualizer.dll" , " Antlr3.targets" , " Antlr3.props" , " AntlrBuildTask.dll"
63
- }
64
- else {
65
- $BootstrapBinaries = " Antlr3.exe" , " Antlr3.exe.config" , " Antlr3.Runtime.dll" , " Antlr3.Runtime.Debug.dll" , " Antlr4.StringTemplate.dll" , " Antlr3.targets" , " Antlr3.props" , " AntlrBuildTask.dll"
66
- }
67
-
68
- $BootstrapBinaries | ForEach-Object {
69
- copy - force " ..\..\bin\$BuildConfig \$_ " " ..\Bootstrap"
70
- If (-not $? ) {
71
- $host.ui.WriteErrorLine (" Bootstrap update failed, Aborting!" )
72
- exit 1
73
- }
74
- }
75
-
76
- If (-not $? ) {
77
- $host.ui.WriteErrorLine (" Bootstrap update failed, Aborting!" )
78
- exit 1
79
- }
80
-
81
- if (-not (Test-Path " ..\Bootstrap\Codegen\Templates\CSharp2" )) {
82
- mkdir " ..\Bootstrap\Codegen\Templates\CSharp2"
83
- }
84
-
85
- copy - force " ..\..\bin\$BuildConfig \Codegen\Templates\LeftRecursiveRules.stg" " ..\Bootstrap\Codegen\Templates"
86
- If (-not $? ) {
87
- $host.ui.WriteErrorLine (" Bootstrap update failed, Aborting!" )
88
- exit 1
89
- }
90
-
91
- copy - force " ..\..\bin\$BuildConfig \Codegen\Templates\CSharp2\*" " ..\Bootstrap\Codegen\Templates\CSharp2"
92
- If (-not $? ) {
93
- $host.ui.WriteErrorLine (' Bootstrap update failed, Aborting!' )
94
- exit 1
95
- }
96
-
97
- copy - force " ..\..\bin\$BuildConfig \Codegen\Templates\CSharp3\*" " ..\Bootstrap\Codegen\Templates\CSharp3"
98
- If (-not $? ) {
99
- $host.ui.WriteErrorLine (" Bootstrap update failed, Aborting!" )
100
- exit 1
101
- }
102
-
103
- copy - force " ..\..\bin\$BuildConfig \Targets\Antlr3.Targets.CSharp2.dll" " ..\Bootstrap\Targets"
104
- If (-not $? ) {
105
- $host.ui.WriteErrorLine (" Bootstrap update failed, Aborting!" )
106
- exit 1
107
- }
108
-
109
- copy - force " ..\..\bin\$BuildConfig \Targets\Antlr3.Targets.CSharp3.dll" " ..\Bootstrap\Targets"
110
- If (-not $? ) {
111
- $host.ui.WriteErrorLine (" Bootstrap update failed, Aborting!" )
112
- exit 1
113
- }
114
-
115
- copy - r - force " ..\..\bin\$BuildConfig \Tool\*" " ..\Bootstrap\Tool"
116
- If (-not $? ) {
117
- $host.ui.WriteErrorLine (" Bootstrap update failed, Aborting!" )
118
- exit 1
119
- }
120
-
121
- copy - r - force " ..\..\bin\$BuildConfig \Rules\*" " ..\Bootstrap"
68
+ # Build Antlr3.CodeGenerator so we can use it for the boostrap build
69
+ .\NuGet.exe pack .\Antlr3.CodeGenerator.nuspec - OutputDirectory nuget - Prop Configuration= $BuildConfig - Version $AntlrVersion - Prop ANTLRVersion= $AntlrVersion - Prop STVersion= $STVersion - Symbols
122
70
If (-not $? ) {
123
- $host.ui.WriteErrorLine (" Bootstrap update failed , Aborting!" )
71
+ $host.ui.WriteErrorLine (" Failed to create NuGet package prior to bootstrap , Aborting!" )
124
72
exit 1
125
73
}
126
74
127
- Remove-Item - force " ..\Bootstrap\Tool\Templates\messages\formats\gnu.stg"
128
-
129
75
# build the project again with the new bootstrap files
76
+ copy - force ' ..\..\NuGet.config.bootstrap' ' ..\..\NuGet.config'
77
+ .\NuGet.exe restore $SolutionPath - Project2ProjectTimeOut 1200
130
78
& $msbuild / nologo / m / nr:false / t:rebuild " /verbosity:$Verbosity " / p:Configuration= $BuildConfig $SolutionPath
131
79
If (-not $? ) {
132
80
$host.ui.WriteErrorLine (" Build Failed, Aborting!" )
81
+ Remove-Item ' ..\..\NuGet.config'
133
82
exit 1
134
83
}
135
84
85
+ Remove-Item ' ..\..\NuGet.config'
86
+
136
87
# copy files from the build
137
88
mkdir Runtime
138
89
mkdir Tool
@@ -225,8 +176,6 @@ copy "..\..\bin\$BuildConfig\Antlr4.StringTemplate.Visualizer.xml" ".\ST4"
225
176
copy " ..\..\LICENSE.txt" " .\ST4"
226
177
227
178
# compress the distributable packages
228
- $AntlrVersion = " 3.5.2-dev"
229
- $STVersion = " 4.0.9-dev"
230
179
231
180
$ArchivePath = " .\dist\antlr-dotnet-csharpbootstrap-" + $AntlrVersion + " .7z"
232
181
.\7z.exe a - r - mx9 $ArchivePath " .\Bootstrap\*"
0 commit comments