Skip to content

Commit 035fc2d

Browse files
authored
Changing back to non-zipped compatibility profiles (#1179)
* Changing back to non-zipped compatibility profiles The size savings aren't there, as the gallery stores modules as nuget files. Also, there was an issue that if you installed into the public location as administrator and then ran as a regular user, a catastrophic failure in analyzer occurred. * Update build script to copy profiles into place * Fix build by correcting typo in compatibility_profiles directory
1 parent 39b389e commit 035fc2d

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

Rules/CompatibilityRules/CompatibilityRule.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,9 @@ public abstract class CompatibilityRule : ConfigurableRule
2424
// The name of the directory where compatibility profiles are looked for by default.
2525
private const string PROFILE_DIR_NAME = "compatibility_profiles";
2626

27-
// The name of the file to hydrate the compatibility profile assets from.
28-
private const string PROFILE_ZIP_NAME = "compatibility_profiles.zip";
29-
3027
// The full path of the directory where compatiblity profiles are looked for by default.
3128
private static readonly string s_defaultProfileDirPath;
3229

33-
// The full path of the file where the zipped compatibility profiles are.
34-
private static readonly string s_profileZipPath;
35-
3630
// Memoized path to the module root of PSScriptAnalyzer.
3731
private static readonly Lazy<string> s_moduleRootDirPath;
3832

@@ -45,10 +39,6 @@ static CompatibilityRule()
4539
{
4640
s_moduleRootDirPath = new Lazy<string>(() => GetModuleRootDirPath());
4741
s_defaultProfileDirPath = Path.Combine(s_moduleRootDirPath.Value, PROFILE_DIR_NAME);
48-
s_profileZipPath = Path.Combine(s_moduleRootDirPath.Value, PROFILE_ZIP_NAME);
49-
50-
// On first run, we need to make sure the profile assets have been hydrated from the zip
51-
ExpandZipToDirectory(s_profileZipPath, s_defaultProfileDirPath);
5242
}
5343

5444
private readonly CompatibilityProfileLoader _profileLoader;
@@ -238,18 +228,6 @@ private static string GetModuleRootDirPath()
238228
return Path.GetFullPath(nonNormalizedRoot);
239229
}
240230

241-
private static void ExpandZipToDirectory(string zipPath, string destinationDirectoryPath)
242-
{
243-
// Assume that if the directory already exists, there is nothing to do.
244-
// Profile unzipping can be forced by deleting the directory.
245-
if (Directory.Exists(destinationDirectoryPath))
246-
{
247-
return;
248-
}
249-
250-
// Note: This method will throw if the directory already exists
251-
ZipFile.ExtractToDirectory(zipPath, destinationDirectoryPath, Encoding.UTF8);
252-
}
253231
}
254232

255233
/// <summary>

build.psm1

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,9 @@ function Copy-CompatibilityProfiles
118118
}
119119

120120
$profileDir = [System.IO.Path]::Combine($PSScriptRoot, 'PSCompatibilityAnalyzer', 'profiles')
121-
$destinationDir = [System.IO.Path]::Combine($PSScriptRoot, 'out', 'PSScriptAnalyzer')
122-
$destination = Join-Path $destinationDir 'compatibility_profiles.zip'
121+
$destinationDir = [System.IO.Path]::Combine($PSScriptRoot, 'out', 'PSScriptAnalyzer', "compatibility_profiles")
123122

124-
if (Test-Path -LiteralPath $destinationDir -PathType Container)
125-
{
126-
Remove-Item -Force -Recurse $destination -ErrorAction Ignore
127-
}
128-
else
129-
{
130-
$null = New-Item -Path $destinationDir -ItemType Directory
131-
}
132-
133-
[System.IO.Compression.ZipFile]::CreateFromDirectory(
134-
$profileDir,
135-
$destination,
136-
[System.IO.Compression.CompressionLevel]::Optimal,
137-
<# includeBaseDirectory #> $false,
138-
[System.Text.Encoding]::UTF8)
123+
Copy-Item -Recurse $profileDir $destinationDir
139124
}
140125

141126
# build script analyzer (and optionally build everything with -All)

0 commit comments

Comments
 (0)