diff --git a/Rules/CompatibilityRules/CompatibilityRule.cs b/Rules/CompatibilityRules/CompatibilityRule.cs index 59215b478..0d4b52bd3 100644 --- a/Rules/CompatibilityRules/CompatibilityRule.cs +++ b/Rules/CompatibilityRules/CompatibilityRule.cs @@ -24,15 +24,9 @@ public abstract class CompatibilityRule : ConfigurableRule // The name of the directory where compatibility profiles are looked for by default. private const string PROFILE_DIR_NAME = "compatibility_profiles"; - // The name of the file to hydrate the compatibility profile assets from. - private const string PROFILE_ZIP_NAME = "compatibility_profiles.zip"; - // The full path of the directory where compatiblity profiles are looked for by default. private static readonly string s_defaultProfileDirPath; - // The full path of the file where the zipped compatibility profiles are. - private static readonly string s_profileZipPath; - // Memoized path to the module root of PSScriptAnalyzer. private static readonly Lazy s_moduleRootDirPath; @@ -45,10 +39,6 @@ static CompatibilityRule() { s_moduleRootDirPath = new Lazy(() => GetModuleRootDirPath()); s_defaultProfileDirPath = Path.Combine(s_moduleRootDirPath.Value, PROFILE_DIR_NAME); - s_profileZipPath = Path.Combine(s_moduleRootDirPath.Value, PROFILE_ZIP_NAME); - - // On first run, we need to make sure the profile assets have been hydrated from the zip - ExpandZipToDirectory(s_profileZipPath, s_defaultProfileDirPath); } private readonly CompatibilityProfileLoader _profileLoader; @@ -238,18 +228,6 @@ private static string GetModuleRootDirPath() return Path.GetFullPath(nonNormalizedRoot); } - private static void ExpandZipToDirectory(string zipPath, string destinationDirectoryPath) - { - // Assume that if the directory already exists, there is nothing to do. - // Profile unzipping can be forced by deleting the directory. - if (Directory.Exists(destinationDirectoryPath)) - { - return; - } - - // Note: This method will throw if the directory already exists - ZipFile.ExtractToDirectory(zipPath, destinationDirectoryPath, Encoding.UTF8); - } } /// diff --git a/build.psm1 b/build.psm1 index 3267ed04c..38b80d4a0 100644 --- a/build.psm1 +++ b/build.psm1 @@ -118,24 +118,9 @@ function Copy-CompatibilityProfiles } $profileDir = [System.IO.Path]::Combine($PSScriptRoot, 'PSCompatibilityAnalyzer', 'profiles') - $destinationDir = [System.IO.Path]::Combine($PSScriptRoot, 'out', 'PSScriptAnalyzer') - $destination = Join-Path $destinationDir 'compatibility_profiles.zip' + $destinationDir = [System.IO.Path]::Combine($PSScriptRoot, 'out', 'PSScriptAnalyzer', "compatibility_profiles") - if (Test-Path -LiteralPath $destinationDir -PathType Container) - { - Remove-Item -Force -Recurse $destination -ErrorAction Ignore - } - else - { - $null = New-Item -Path $destinationDir -ItemType Directory - } - - [System.IO.Compression.ZipFile]::CreateFromDirectory( - $profileDir, - $destination, - [System.IO.Compression.CompressionLevel]::Optimal, - <# includeBaseDirectory #> $false, - [System.Text.Encoding]::UTF8) + Copy-Item -Recurse $profileDir $destinationDir } # build script analyzer (and optionally build everything with -All)