Skip to content

Commit cce8bba

Browse files
mmitcheKevinRansom
andauthored
Exclude VMR package cache from assembly scanning (#16958)
When building in the VMR, the per-repo package cache is placed under the repo's artifacts directory. Exclude this when doing the assembly scan. In addition, fix up the file to be compatible with non-windows systems. Co-authored-by: Kevin Ransom (msft) <codecutter@hotmail.com>
1 parent c4905b1 commit cce8bba

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

buildtools/AssemblyCheck/AssemblyCheck.fs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ module AssemblyCheck =
6464

6565
let verifyAssemblies (binariesPath:string) =
6666

67+
// When building in the VMR, the package cache directory is under artifacts and should not be scanned.
68+
let vmrPackageCacheDirectory = $"{Path.DirectorySeparatorChar}package-cache{Path.DirectorySeparatorChar}"
69+
6770
let excludedAssemblies =
6871
[ ] |> Set.ofList
6972

@@ -84,7 +87,13 @@ module AssemblyCheck =
8487

8588
let fsharpExecutingWithEmbeddedPdbs =
8689
fsharpAssemblies
87-
|> List.filter (fun p -> not (p.Contains(@"\Proto\") || p.Contains(@"\Bootstrap\") || p.Contains(@".resources.") || p.Contains(@"\FSharpSdk\") || p.Contains(@"\tmp\") || p.Contains(@"\obj\")))
90+
|> List.filter (fun p -> not (p.Contains($"{Path.DirectorySeparatorChar}Proto{Path.DirectorySeparatorChar}") ||
91+
p.Contains($"{Path.DirectorySeparatorChar}Bootstrap{Path.DirectorySeparatorChar}") ||
92+
p.Contains(".resources.") ||
93+
p.Contains($"{Path.DirectorySeparatorChar}FSharpSdk{Path.DirectorySeparatorChar}") ||
94+
p.Contains($"{Path.DirectorySeparatorChar}tmp{Path.DirectorySeparatorChar}") ||
95+
p.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}") ||
96+
p.Contains(vmrPackageCacheDirectory)))
8897

8998
// verify that all assemblies have a version number other than 0.0.0.0 or 1.0.0.0
9099
let failedVersionCheck =
@@ -99,21 +108,22 @@ module AssemblyCheck =
99108

100109
if failedVersionCheck.Length > 0 then
101110
printfn "The following assemblies had a version of %A or %A" versionZero versionOne
102-
printfn "%s\r\n" <| String.Join("\r\n", failedVersionCheck)
111+
printfn "%s" <| String.Join(Environment.NewLine, failedVersionCheck)
103112
else
104113
printfn "All shipping assemblies had an appropriate version number."
105114

106115
// verify that all assemblies have a commit hash
107116
let failedCommitHash =
108117
fsharpAssemblies
109-
|> List.filter (fun p -> not (p.Contains(@"\FSharpSdk\")))
118+
|> List.filter (fun p -> not (p.Contains($"{Path.DirectorySeparatorChar}FSharpSdk{Path.DirectorySeparatorChar}") ||
119+
p.Contains(vmrPackageCacheDirectory)))
110120
|> List.filter (fun a ->
111121
let fileProductVersion = FileVersionInfo.GetVersionInfo(a).ProductVersion
112122
not (commitHashPattern.IsMatch(fileProductVersion) || devVersionPattern.IsMatch(fileProductVersion)))
113123

114124
if failedCommitHash.Length > 0 then
115125
printfn "The following assemblies don't have a commit hash set"
116-
printfn "%s\r\n" <| String.Join("\r\n", failedCommitHash)
126+
printfn "%s%s" (String.Join(Environment.NewLine, failedCommitHash)) Environment.NewLine
117127
else
118128
printfn "All shipping assemblies had an appropriate commit hash."
119129

@@ -124,7 +134,7 @@ module AssemblyCheck =
124134

125135
if failedVerifyEmbeddedPdb.Length > 0 then
126136
printfn "The following assemblies don't have an embedded pdb"
127-
printfn "%s\r\n" <| String.Join("\r\n", failedVerifyEmbeddedPdb)
137+
printfn "%s%s" (String.Join(Environment.NewLine, failedVerifyEmbeddedPdb)) Environment.NewLine
128138
else
129139
printfn "All shipping assemblies had an embedded PDB."
130140

0 commit comments

Comments
 (0)