3
3
4
4
using System . Security . Cryptography ;
5
5
using Microsoft . Build . Framework ;
6
- using Microsoft . Extensions . FileSystemGlobbing ;
7
6
8
7
namespace Microsoft . AspNetCore . StaticWebAssets . Tasks ;
9
8
@@ -60,12 +59,15 @@ public override bool Execute()
60
59
var includePatterns = SplitPattern ( IncludePatterns ) ;
61
60
var excludePatterns = SplitPattern ( ExcludePatterns ) ;
62
61
63
- var matcher = new Matcher ( ) ;
64
- matcher . AddIncludePatterns ( includePatterns ) ;
65
- matcher . AddExcludePatterns ( excludePatterns ) ;
62
+ var matcher = new StaticWebAssetGlobMatcherBuilder ( )
63
+ . AddIncludePatterns ( includePatterns )
64
+ . AddExcludePatterns ( excludePatterns )
65
+ . Build ( ) ;
66
66
67
67
var matchingCandidateAssets = new List < StaticWebAsset > ( ) ;
68
68
69
+ var matchContext = StaticWebAssetGlobMatcher . CreateMatchContext ( ) ;
70
+
69
71
// Add each candidate asset to each compression configuration with a matching pattern.
70
72
foreach ( var asset in candidates )
71
73
{
@@ -80,9 +82,10 @@ public override bool Execute()
80
82
}
81
83
82
84
var relativePath = asset . ComputePathWithoutTokens ( asset . RelativePath ) ;
83
- var match = matcher . Match ( relativePath ) ;
85
+ matchContext . SetPathAndReinitialize ( relativePath . AsSpan ( ) ) ;
86
+ var match = matcher . Match ( matchContext ) ;
84
87
85
- if ( ! match . HasMatches )
88
+ if ( ! match . IsMatch )
86
89
{
87
90
Log . LogMessage (
88
91
MessageImportance . Low ,
@@ -275,7 +278,7 @@ private bool TryCreateCompressedAsset(StaticWebAsset asset, string outputPath, s
275
278
OriginalItemSpec = asset . Identity ,
276
279
RelatedAsset = asset . Identity ,
277
280
AssetRole = "Alternative" ,
278
- AssetTraitName = "Content-Encoding" ,
281
+ AssetTraitName = "Content-Encoding" ,
279
282
AssetTraitValue = assetTraitValue ,
280
283
ContentRoot = outputPath ,
281
284
// Set integrity and fingerprint to null so that they get recalculated for the compressed asset.
0 commit comments