Skip to content

Commit

Permalink
Merge pull request #786 from unoplatform/dev/jela/extless-compression
Browse files Browse the repository at this point in the history
fix: Ensure compression is enabled with nodots obfuscation
  • Loading branch information
jeromelaban authored Oct 12, 2023
2 parents 4ed8910 + ffda070 commit 4ba8661
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Uno.Wasm.Bootstrap/ShellTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,13 @@ private void TryCompressDist()
Log.LogMessage(MessageImportance.Low, $"Compressing {string.Join(", ", compressibleExtensions)}");

var filesToCompress = compressibleExtensions
.Select(e => {
if (_assembliesFileNameObfuscationMode == FileNameObfuscationMode.NoDots)
{
e = e.Replace(".", "_");
}
return e;
})
.SelectMany(e => Directory.GetFiles(_finalPackagePath, "*" + e, SearchOption.AllDirectories))
.Where(f => !Path.GetDirectoryName(f).Contains("_compressed_"))
.Distinct()
Expand Down
16 changes: 16 additions & 0 deletions src/Uno.Wasm.StaticLinking.Shared/Validations.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<PropertyGroup>
<!-- Used for validating file compression -->
<WasmShellCompressionLayoutMode>InPlace</WasmShellCompressionLayoutMode>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Web.Services.Description" Version="4.10.0" />
</ItemGroup>
Expand All @@ -17,6 +22,17 @@
<Error Condition="$(_duplicateValidation.Contains(';'))" Text="Duplicate System.Private.CoreLib.clr detected" />

<Message Importance="high" Text="Output dist validated" />

<ItemGroup>
<_compressedItems Include="$(WasmShellOutputPackagePath)\**\*.br" />
</ItemGroup>

<PropertyGroup>
<_compressedItemsValidation>@(_compressedItems)</_compressedItemsValidation>
</PropertyGroup>

<Error Condition="'$(WasmShellAssembliesFileNameObfuscationMode)'=='NoDots' and !$(_compressedItemsValidation.Contains(';'))"
Text="Compressed files cannot found found with obfuscation mode NoDots enabled" />
</Target>

</Project>

0 comments on commit 4ba8661

Please sign in to comment.