Skip to content

Commit fe7a3a2

Browse files
committed
Cleanups and test fixes
1 parent 04f22f6 commit fe7a3a2

7 files changed

+17
-200
lines changed

src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Compression.targets

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,6 @@ Copyright (c) .NET Foundation. All rights reserved.
238238
<_CompressionCurrentProjectBuildAssets Include="@(StaticWebAsset)" />
239239
</ItemGroup>
240240

241-
<!-- <ComputeStaticWebAssetsForCurrentProject
242-
Assets="@(StaticWebAsset)"
243-
ProjectMode="$(StaticWebAssetProjectMode)"
244-
AssetKind="Build"
245-
IncludeReferenceAssets="true"
246-
Source="$(PackageId)"
247-
>
248-
<Output TaskParameter="StaticWebAssets" ItemName="_CompressionCurrentProjectBuildAssets" />
249-
</ComputeStaticWebAssetsForCurrentProject> -->
250-
251241
<ApplyCompressionNegotiation
252242
CandidateEndpoints="@(StaticWebAssetEndpoint)"
253243
CandidateAssets="@(_CompressionCurrentProjectBuildAssets)"
@@ -330,16 +320,6 @@ Copyright (c) .NET Foundation. All rights reserved.
330320
<_CompressionCurrentProjectPublishAssets Include="@(StaticWebAsset)" Condition="'%(AssetKind)' != 'Build'" />
331321
</ItemGroup>
332322

333-
<!-- <ComputeStaticWebAssetsForCurrentProject
334-
Assets="@(StaticWebAsset)"
335-
ProjectMode="$(StaticWebAssetProjectMode)"
336-
AssetKind="Publish"
337-
IncludeReferenceAssets="true"
338-
Source="$(PackageId)"
339-
>
340-
<Output TaskParameter="StaticWebAssets" ItemName="_CompressionCurrentProjectPublishAssets" />
341-
</ComputeStaticWebAssetsForCurrentProject> -->
342-
343323
<ApplyCompressionNegotiation
344324
CandidateEndpoints="@(StaticWebAssetEndpoint)"
345325
CandidateAssets="@(_CompressionCurrentProjectPublishAssets)"

src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.targets

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,10 @@ Copyright (c) .NET Foundation. All rights reserved.
2727
AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)"
2828
Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" />
2929

30-
<UsingTask
31-
TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ComputeEndpointsForReferenceStaticWebAssets"
32-
AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)"
33-
Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" />
34-
35-
<UsingTask
36-
TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ComputeEndpointsForCurrentProjectStaticWebAssets"
37-
AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)"
38-
Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" />
30+
<UsingTask
31+
TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.ComputeEndpointsForReferenceStaticWebAssets"
32+
AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)"
33+
Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" />
3934

4035
<UsingTask
4136
TaskName="Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssetEndpoints"

src/StaticWebAssetsSdk/Tasks/ComputeEndpointsForCurrentProjectStaticWebAssets.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsForCurrentProject.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public class ComputeStaticWebAssetsForCurrentProject : Task
1616
[Required]
1717
public string AssetKind { get; set; }
1818

19-
public bool IncludeReferenceAssets { get; set; }
20-
2119
[Required]
2220
public string Source { get; set; }
2321

@@ -52,7 +50,7 @@ public override bool Execute()
5250
}
5351
}
5452

55-
if (!selected.IsForReferencedProjectsOnly() || IncludeReferenceAssets)
53+
if (!selected.IsForReferencedProjectsOnly())
5654
{
5755
resultAssets.Add(selected);
5856
}

src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssetEndpoints.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,6 @@ public override bool Execute()
5656
{
5757
var asset = kvp.Value;
5858
StaticWebAssetEndpoint endpoint = null;
59-
//if (!asset.IsDiscovered() && !asset.IsComputed())
60-
//{
61-
// // If the asset is not for the current project, we skip it.
62-
// // Package endpoints are already defined in the package Endpoints.props file.
63-
// // Referenced project endpoints are retrieved from the call to GetCurrentProjectBuildStaticWebAssetItems and
64-
// // GetCurrentProjectPublishStaticWebAssetItems respectively.
65-
// Log.LogMessage(MessageImportance.Low, $"Skipping asset {asset.Identity} because it is not for the current project.");
66-
// continue;
67-
//}
6859

6960
// StaticWebAssets has this behavior where the base path for an asset only gets applied if the asset comes from a
7061
// package or a referenced project and ignored if it comes from the current project.

test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIncrementalismTest.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,30 @@ public void Build_IsIncremental()
1818
var projectDirectory = CreateAspNetSdkTestAsset(testAsset);
1919

2020
var build = new BuildCommand(projectDirectory, "blazorwasm");
21-
build.Execute()
21+
build.WithWorkingDirectory(projectDirectory.TestRoot);
22+
build.Execute("/bl")
2223
.Should()
2324
.Pass();
2425

2526
var buildOutputDirectory = build.GetOutputDirectory(DefaultTfm).ToString();
2627

28+
var filesToIgnore = new[]
29+
{
30+
Path.Combine(buildOutputDirectory, "RazorClassLibrary.staticwebassets.endpoints.json"),
31+
Path.Combine(buildOutputDirectory, "blazorwasm.staticwebassets.endpoints.json")
32+
};
33+
2734
// Act
28-
var thumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, buildOutputDirectory);
35+
var thumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, buildOutputDirectory, filesToIgnore);
2936

3037
// Assert
3138
for (var i = 0; i < 3; i++)
3239
{
3340
build = new BuildCommand(projectDirectory, "blazorwasm");
34-
build.Execute().Should().Pass();
41+
build.WithWorkingDirectory(projectDirectory.TestRoot);
42+
build.Execute($"/bl:msbuild{i}.binlog").Should().Pass();
3543

36-
var newThumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, buildOutputDirectory);
44+
var newThumbPrint = FileThumbPrint.CreateFolderThumbprint(projectDirectory, buildOutputDirectory, filesToIgnore);
3745
newThumbPrint.Count.Should().Be(thumbPrint.Count);
3846
for (var j = 0; j < thumbPrint.Count; j++)
3947
{

test/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/ComputeEndpointsForCurrentProjectStaticWebAssetsTest.cs

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)