Skip to content

Commit

Permalink
VCI-688: Fix quality gate (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
krankenbro authored Sep 14, 2023
1 parent 828970c commit f07e392
Show file tree
Hide file tree
Showing 25 changed files with 104 additions and 293 deletions.
15 changes: 11 additions & 4 deletions src/VirtoCommerce.Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ public static Solution Solution
var testProjects = Solution.GetProjects("*.Test|*.Tests|*.Testing");
var outPath = RootDirectory / ".tmp";
foreach (var testProject in testProjects)
foreach (var testProjectPath in testProjects.Select(p=> p.Path).ToArray())
{
DotNet($"add \"{testProject.Path}\" package coverlet.collector");
DotNet($"add \"{testProjectPath}\" package coverlet.collector");
var testSetting = new DotNetTestSettings()
.SetProjectFile(testProject.Path)
.SetProjectFile(testProjectPath)
.SetConfiguration(Configuration)
.SetFilter(TestsFilter)
.SetNoBuild(true)
Expand Down Expand Up @@ -1172,7 +1172,14 @@ private void CompressExecuteMethod()
keepFiles = TextTasks.ReadAllLines(ModuleKeepFile).ToArray();
}

ArtifactPacker.CompressModule(ModuleOutputDirectory, ZipFilePath, ModuleManifest.Id, ModuleManifestFile, WebProject.Directory, ignoredFiles, keepFiles, _moduleContentFolders);
ArtifactPacker.CompressModule(options => options.WithSourceDirectory(ModuleOutputDirectory)
.WithOutputZipPath(ZipFilePath)
.WithModuleId(ModuleManifest.Id)
.WithModuleManifestPath(ModuleManifestFile)
.WithWebProjectDirectory(WebProject.Directory)
.WithIgnoreList(ignoredFiles)
.WithKeepList(keepFiles)
.WithModuleContentFolders(_moduleContentFolders));
}
else
{
Expand Down
84 changes: 0 additions & 84 deletions src/VirtoCommerce.Build/Cloud/Models/ArgoAppCustomAppSection.cs

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/ArgoAppIngressSection.cs

This file was deleted.

13 changes: 0 additions & 13 deletions src/VirtoCommerce.Build/Cloud/Models/ArgoAppPlatformSection.cs

This file was deleted.

15 changes: 0 additions & 15 deletions src/VirtoCommerce.Build/Cloud/Models/ArgoAppStorefrontSection.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/VirtoCommerce.Build/Cloud/Models/ArgoApplication.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Platform/Config.cs

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Platform/ImageTag.cs

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Platform/Secret.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Platform/SecretConfig.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Platform/Tier.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Storefront/Config.cs

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Storefront/ImageTag.cs

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Storefront/ThemeName.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/VirtoCommerce.Build/Cloud/Models/Storefront/ThemeUrl.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Stream OpenRead(Uri address)
}
finally
{
((IDisposable)client)?.Dispose();
client?.Dispose();
}
}
}
Expand Down
24 changes: 14 additions & 10 deletions src/VirtoCommerce.Build/Utils/ArtifactPacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,38 @@ public static void CompressPlatform(string sourceDirectory, string outputZipPath
CompressionTasks.CompressZip(sourceDirectory, outputZipPath);
}

public static void CompressModule(string sourceDirectory, string outputZipPath, string moduleId, string moduleManifestPath, string webProjectDirectory, IEnumerable<string> ignoreList, IEnumerable<string> keepList, string[] moduleContentFolders)
public static void CompressModule(Action<ModuleCompressionOptionsBuilder> optionsBuilderAction)
{
FileSystemTasks.CopyFileToDirectory(moduleManifestPath, sourceDirectory,
var optionsBuilder = new ModuleCompressionOptionsBuilder();
optionsBuilderAction(optionsBuilder);
var options = optionsBuilder.Build();

FileSystemTasks.CopyFileToDirectory(options.ModuleManifestPath, options.SourceDirectory,
FileExistsPolicy.Overwrite);

//Exclude all ignored files and *module files not related to compressed module
var ignoreModuleFilesRegex = new Regex(@".+Module\..*", RegexOptions.IgnoreCase);
var includeModuleFilesRegex =
new Regex(@$".*{moduleId}(Module)?\..*", RegexOptions.IgnoreCase);
new Regex(@$".*{options.ModuleId}(Module)?\..*", RegexOptions.IgnoreCase);

foreach (var folderName in moduleContentFolders)
foreach (var folderName in options.ModuleContentFolders)
{
var sourcePath = Path.Combine(webProjectDirectory, folderName);
var sourcePath = Path.Combine(options.WebProjectDirectory, folderName);

if (Directory.Exists(sourcePath))
{
FileSystemTasks.CopyDirectoryRecursively(sourcePath, Path.Combine(sourceDirectory, folderName),
FileSystemTasks.CopyDirectoryRecursively(sourcePath, Path.Combine(options.SourceDirectory, folderName),
DirectoryExistsPolicy.Merge, FileExistsPolicy.Overwrite);
}
}

bool FilesFilter(FileInfo x) =>
(!SkipFileByList(x.Name, ignoreList) &&
!SkipFileByRegex(x.Name, ignoreModuleFilesRegex)) || KeepFileByList(x.Name, keepList) ||
(!SkipFileByList(x.Name, options.IgnoreList) &&
!SkipFileByRegex(x.Name, ignoreModuleFilesRegex)) || KeepFileByList(x.Name, options.KeepList) ||
KeepFileByRegex(x.Name, includeModuleFilesRegex);

FileSystemTasks.DeleteFile(outputZipPath);
CompressionTasks.CompressZip(sourceDirectory, outputZipPath, FilesFilter);
FileSystemTasks.DeleteFile(options.OutputZipPath);
CompressionTasks.CompressZip(options.SourceDirectory, options.OutputZipPath, FilesFilter);
}


Expand Down
Loading

0 comments on commit f07e392

Please sign in to comment.