Fixed unnecessary invocation of TagHelper target

This commit is contained in:
Ajay Bhargav Baaskaran 2018-02-14 18:52:41 -08:00
parent a13a0aa8c4
commit c293267421
2 changed files with 65 additions and 5 deletions

View File

@ -60,11 +60,11 @@
-->
<Touch
Files="$(_RazorTagHelperInputCache)"
AlwaysCreate="true">
<Output
TaskParameter="TouchedFiles"
ItemName="FileWrites" />
</Touch>
AlwaysCreate="true" />
<ItemGroup>
<FileWrites Include="$(_RazorTagHelperInputCache)" />
</ItemGroup>
<RazorTagHelper
Debug="$(_RazorDebugTagHelperTask)"

View File

@ -0,0 +1,60 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
public class BuildIncrementalismTest : MSBuildIntegrationTestBase
{
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task BuildIncremental_SimpleMvc_PersistsTargetInputFile()
{
// Arrange
var thumbprintLookup = new Dictionary<string, FileThumbPrint>();
// Act 1
var result = await DotnetMSBuild("Build", $"/p:RazorCompileOnBuild=true");
var directoryPath = Path.Combine(result.Project.DirectoryPath, IntermediateOutputPath);
var filesToIgnore = new[]
{
// These files are generated on every build.
Path.Combine(directoryPath, "SimpleMvc.csproj.CopyComplete"),
Path.Combine(directoryPath, "SimpleMvc.csproj.FileListAbsolute.txt"),
};
var files = Directory.GetFiles(directoryPath).Where(p => !filesToIgnore.Contains(p));
foreach (var file in files)
{
var thumbprint = GetThumbPrint(file);
thumbprintLookup[file] = thumbprint;
}
// Assert 1
Assert.BuildPassed(result);
// Act & Assert 2
for (var i = 0; i < 2; i++)
{
// We want to make sure nothing changed between multiple incremental builds.
using (var razorGenDirectoryLock = LockDirectory(RazorIntermediateOutputPath))
{
result = await DotnetMSBuild("Build", $"/p:RazorCompileOnBuild=true");
}
Assert.BuildPassed(result);
foreach (var file in files)
{
var thumbprint = GetThumbPrint(file);
Assert.Equal(thumbprintLookup[file], thumbprint);
}
}
}
}
}