@@ -12,6 +12,7 @@ open Commandline
12
12
open Fake.Core
13
13
open Fake.IO
14
14
open Fake.IO .Globbing .Operators
15
+ open Fake.Tools .Git
15
16
open Newtonsoft.Json
16
17
17
18
module Versioning =
@@ -112,60 +113,7 @@ module Versioning =
112
113
| NoChange n -> n
113
114
| Update ( newVersion, _) -> newVersion
114
115
115
- let private sn () =
116
- match notWindows with
117
- | true -> " sn"
118
- | false ->
119
- let programFiles = Environment.environVar " PROGRAMFILES(X86)"
120
- if not ( Directory.Exists programFiles) then failwith " Can not locate 64 bit program files"
121
- let windowsSdks = [ " v10.0A" ; " v8.1A" ; " v8.1" ; " v8.0" ; " v7.0A" ;]
122
- let dotNetVersion = [ " 4.7.2" ; " 4.7.1" ; " 4.7" ; " 4.6.2" ; " 4.6.1" ; " 4.0" ]
123
- let combinations = List.allPairs windowsSdks dotNetVersion
124
- let winFolder w = Path.Combine( programFiles, " Microsoft SDKs" , " Windows" , w, " bin" )
125
- let sdkFolder w d =
126
- let folder = sprintf " NETFX %s Tools" d
127
- Path.Combine( winFolder w, folder)
128
- let snExe w d = Path.Combine( sdkFolder w d, " sn.exe" )
129
- let sn = combinations |> List.map ( fun ( w , d ) -> snExe w d) |> List.tryFind File.exists
130
- match sn with
131
- | Some sn -> sn
132
- | None -> failwithf " Could not locate sn.exe"
133
-
134
116
let private officialToken = " 96c599bbe3e70f5d"
135
- let private keyFile = Paths.Keys " keypair.snk"
136
-
137
- let private validate dll name =
138
- let sn = sn ()
139
- let out = Tooling.readQuiet sn [ " -v" ; dll;]
140
-
141
- // Mono StrongName - version 5.18.1.0
142
- // returns `is strongnamed`
143
- let valid = ( out.ExitCode, out.Output |> Seq.tryFindIndex( fun s -> s.Line.Contains( " is valid" ) || s.Line.Contains( " is strongnamed" )))
144
- match valid with
145
- | ( 0 , Some i) when i >= 0 -> printfn " %s is strongnamed" name
146
- | (_, _) -> failwithf " %s is NOT strongnamed" dll
147
-
148
- let out = Tooling.readQuiet sn [ " -T" ; dll;]
149
-
150
- let tokenMessage = ( out.Output |> Seq.tryFind( fun s -> s.Line.Contains( " Public key token" , StringComparison.OrdinalIgnoreCase)));
151
-
152
- // Mono StrongName - version 5.18.1.0
153
- // returns `Key Token:`
154
- let token =
155
- match tokenMessage with
156
- | Some s -> Some <| ( s.Line.Replace( " Public Key Token:" , " " ) .Replace( " Public key token is" , " " )) .Trim()
157
- | None -> None
158
-
159
- let valid = ( out.ExitCode, token)
160
- match valid with
161
- | ( 0 , Some t) when t = officialToken -> printfn " %s was signed with official key token %s " name t
162
- | (_, Some t) -> printfn " %s was not signed with the official token: %s but %s " name officialToken t
163
- | (_, None) -> printfn " %s was not signed at all" name
164
-
165
- let private validateDllStrongName dll name =
166
- match File.Exists dll with
167
- | true -> validate dll name
168
- | _ -> failwithf " Attempted to verify signature of %s but it was not found!" dll
169
117
170
118
let BuiltArtifacts ( version : AnchoredVersion ) =
171
119
let packages =
@@ -179,14 +127,25 @@ module Versioning =
179
127
packages
180
128
181
129
let ValidateArtifacts version =
182
- let fileVersion = version.AssemblyFile
183
130
let tmp = " build/output/_packages/tmp"
184
131
185
132
let packages = BuiltArtifacts version
186
133
printf " %O " packages
187
134
188
135
packages
136
+ // do not validate versioned packages for now
137
+ |> Seq.filter( fun f -> not <| f.NugetId.EndsWith( sprintf " .v%i " version.Assembly.Major))
189
138
|> Seq.iter( fun p ->
139
+ let v = sprintf " %O +%s " version.Full ( Information.getCurrentSHA1( " ." ))
140
+ // loading dlls is locked down on APPVEYOR so we can not assert release mode
141
+ let ciArgs =
142
+ let appVeyor = Environment.hasEnvironVar " APPVEYOR"
143
+ let azDevops = Environment.hasEnvironVar " TF_BUILD"
144
+ if appVeyor || azDevops then [ " -r" ; " true" ] else []
145
+ ReposTooling.PackageValidator
146
+ <| [ p.Package; " -v" ; v; " -a" ; p.AssemblyName; " -k" ; officialToken] @ ciArgs
147
+ |> ignore
148
+
190
149
Zip.unzip tmp p.Package
191
150
let nugetId = p.NugetId
192
151
@@ -200,22 +159,9 @@ module Versioning =
200
159
201
160
let command = [ sprintf " previous-nuget|%s |%s |%s " nugetId ( version.Full.ToString()) tfm;
202
161
sprintf " directory|%s " fullPath
203
- " -a" ; " -f" ; " github-comment" ;]
162
+ " -a" ; " -f" ; " github-comment" ; " --output " ; Paths.BuildOutput ]
204
163
205
164
ReposTooling.Differ command
206
165
)
207
-
208
- !! ( sprintf " %s /**/*.dll" tmp)
209
- |> Seq.iter( fun f ->
210
- let fv = FileVersionInfo.GetVersionInfo( f)
211
- let name = AssemblyName.GetAssemblyName( f)
212
- let a = name.Version
213
- printfn " Assembly: %A File: %s Product: %s => %s " a fv.FileVersion fv.ProductVersion f
214
- if ( a.Minor > 0 || a.Revision > 0 || a.Build > 0 ) then failwith ( sprintf " %s assembly version is not sticky to its major component" f)
215
- if ( parse ( fv.ProductVersion) <> version.Full) then
216
- failwith ( sprintf " Expected product info %s to match new version %O " fv.ProductVersion fileVersion)
217
-
218
- validateDllStrongName f f
219
- )
220
166
Directory.delete tmp
221
167
)
0 commit comments