From a1c4ccbea57d6a659e6efec6e762436b39a1fe16 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 3 Aug 2021 11:26:12 -0700 Subject: [PATCH] Scoped css back compat --- ...rosoft.NET.Sdk.Razor.ScopedCss.5_0.targets | 44 ++++ ....NET.Sdk.Razor.StaticWebAssets.5_0.targets | 12 +- .../ScopedCssIntegrationTests.cs | 92 ++++++++ ...ible_WithPreviousVersions.Build.files.json | 3 + ...reviousVersions.Build.staticwebassets.json | 220 ++++++++++++++++++ ...le_WithPreviousVersions.Publish.files.json | 17 ++ ...viousVersions.Publish.staticwebassets.json | 220 ++++++++++++++++++ 7 files changed, 602 insertions(+), 6 deletions(-) create mode 100644 src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.files.json create mode 100644 src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json create mode 100644 src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json create mode 100644 src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json diff --git a/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.ScopedCss.5_0.targets b/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.ScopedCss.5_0.targets index 005146b39360..7380ae975714 100644 --- a/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.ScopedCss.5_0.targets +++ b/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.ScopedCss.5_0.targets @@ -98,6 +98,11 @@ Integration with static web assets: _AddGeneratedScopedCssFilesForReference; + + $(GetCurrentProjectStaticWebAssetsV2DependsOn); + _UpdateScopedCssStaticWebAssetsForV2; + + + + + + <_AppBundleStaticWebAssetIdentity>@(_AppBundleStaticWebAsset) + <_ProjectBundleStaticWebAssetIdentity>@(_ProjectBundleStaticWebAsset) + + + + + <_CurrentProjectBundle Include="@(_ThisProjectStaticWebAssets)" Condition="'%(SourceId)' == '$(PackageId)' and '%(_ThisProjectStaticWebAssets.Identity)' == '$(_ProjectBundleStaticWebAssetIdentity)'"> + Reference + Primary + + ScopedCss + ProjectBundle + Never + PreserveNewest + + + <_ThisProjectStaticWebAssets Remove="@(_CurrentProjectBundle)" /> + <_ThisProjectStaticWebAssets Include="@(_CurrentProjectBundle)" /> + + + <_CurrentProjectAppBundle Include="@(_ThisProjectStaticWebAssets)" Condition="'%(SourceId)' == '$(PackageId)' and '%(Identity)' == '$(_AppBundleStaticWebAssetIdentity)'"> + CurrentProject + Primary + + ScopedCss + ApplicationBundle + Never + PreserveNewest + + + <_ThisProjectStaticWebAssets Remove="@(_CurrentProjectAppBundle)" /> + <_ThisProjectStaticWebAssets Include="@(_CurrentProjectAppBundle)" /> + + + diff --git a/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.StaticWebAssets.5_0.targets b/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.StaticWebAssets.5_0.targets index f13aae91a591..2f75e4aa8db9 100644 --- a/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.StaticWebAssets.5_0.targets +++ b/src/RazorSdk/Targets/Microsoft.NET.Sdk.Razor.StaticWebAssets.5_0.targets @@ -394,14 +394,14 @@ Copyright (c) .NET Foundation. All rights reserved. StaticWebAsset Project All - All - Primary - - - + All + Primary + + + Never PreserveNewest - %(Identity) + %(Identity) <_ThisProjectStaticWebAssetItems Include="$(PackageId)\wwwroot" Condition="Exists('$(MSBuildProjectDirectory)\wwwroot')"> StaticWebAssetDiscoveryPattern diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs index a21cf6c103d6..c36d1fdf5e2d 100644 --- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ScopedCssIntegrationTests.cs @@ -3,10 +3,13 @@ using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Reflection.Metadata; using System.Text.RegularExpressions; using System.Xml.Linq; using FluentAssertions; using Microsoft.AspNetCore.Razor.Tasks; +using Microsoft.Build.Evaluation; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; using Microsoft.NET.TestFramework.Commands; @@ -437,5 +440,94 @@ public void BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles() appBundle.Should().Contain("_content/ClassLibrary/ClassLibrary.bundle.scp.css"); appBundle.Should().Contain("_content/PackageLibraryDirectDependency/PackageLibraryDirectDependency.bundle.scp.css"); } + + [Fact] + public void ScopedCss_IsBackwardsCompatible_WithPreviousVersions() + { + var testAsset = "RazorAppWithPackageAndP2PReference"; + ProjectDirectory = CreateAspNetSdkTestAsset(testAsset) + .WithProjectChanges((project, document) => + { + if (Path.GetFileName(project) == "AnotherClassLib.csproj") + { + document.Descendants("TargetFramework").Single().ReplaceNodes("netcoreapp3.1"); + document.Descendants("PropertyGroup").First().Add(new XElement("RazorLangVersion", "3.0")); + } + if (Path.GetFileName(project) == "ClassLibrary.csproj") + { + document.Descendants("TargetFramework").Single().ReplaceNodes("netcoreapp3.0"); + document.Descendants("PropertyGroup").First().Add(new XElement("RazorLangVersion", "3.0")); + } + }); + + var build = new BuildCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); + build.WithWorkingDirectory(ProjectDirectory.TestRoot); + build.Execute("/bl").Should().Pass(); + + var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); + var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); + + // GenerateStaticWebAssetsManifest should copy the file to the output folder. + var finalPath = Path.Combine(outputPath, "AppWithPackageAndP2PReference.staticwebassets.json"); + new FileInfo(finalPath).Should().Exist(); + AssertManifest( + StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath)), + LoadBuildManifest()); + + AssertBuildAssets( + StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath)), + outputPath, + intermediateOutputPath); + + var appBundle = new FileInfo(Path.Combine(intermediateOutputPath, "scopedcss", "bundle", "AppWithPackageAndP2PReference.styles.css")); + appBundle.Should().Exist(); + + appBundle.Should().Contain("_content/ClassLibrary/ClassLibrary.bundle.scp.css"); + appBundle.Should().Contain("_content/PackageLibraryDirectDependency/PackageLibraryDirectDependency.bundle.scp.css"); + } + + [Fact] + public void ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions() + { + var testAsset = "RazorAppWithPackageAndP2PReference"; + ProjectDirectory = CreateAspNetSdkTestAsset(testAsset) + .WithProjectChanges((project, document) => + { + if (Path.GetFileName(project) == "AnotherClassLib.csproj") + { + document.Descendants("TargetFramework").Single().ReplaceNodes("netcoreapp3.1"); + document.Descendants("PropertyGroup").First().Add(new XElement("RazorLangVersion", "3.0")); + } + if (Path.GetFileName(project) == "ClassLibrary.csproj") + { + document.Descendants("TargetFramework").Single().ReplaceNodes("netcoreapp3.0"); + document.Descendants("PropertyGroup").First().Add(new XElement("RazorLangVersion", "3.0")); + } + }); + + var build = new PublishCommand(ProjectDirectory, "AppWithPackageAndP2PReference"); + build.WithWorkingDirectory(ProjectDirectory.TestRoot); + build.Execute("/bl").Should().Pass(); + + var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); + var outputPath = build.GetOutputDirectory(DefaultTfm, "Debug").ToString(); + + var finalPath = Path.Combine(intermediateOutputPath, "StaticWebAssets.publish.json"); + new FileInfo(finalPath).Should().Exist(); + AssertManifest( + StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath)), + LoadPublishManifest()); + + AssertBuildAssets( + StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(finalPath)), + outputPath, + intermediateOutputPath); + + var appBundle = new FileInfo(Path.Combine(outputPath, "wwwroot", "AppWithPackageAndP2PReference.styles.css")); + appBundle.Should().Exist(); + + appBundle.Should().Contain("_content/ClassLibrary/ClassLibrary.bundle.scp.css"); + appBundle.Should().Contain("_content/PackageLibraryDirectDependency/PackageLibraryDirectDependency.bundle.scp.css"); + } } } diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.files.json b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.files.json new file mode 100644 index 000000000000..cc9447726914 --- /dev/null +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.files.json @@ -0,0 +1,3 @@ +[ + "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css" +] \ No newline at end of file diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json new file mode 100644 index 000000000000..40343c0eea06 --- /dev/null +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json @@ -0,0 +1,220 @@ +{ + "Version": 1, + "Hash": "__hash__", + "Source": "AppWithPackageAndP2PReference", + "BasePath": "_content/AppWithPackageAndP2PReference", + "Mode": "Default", + "ManifestType": "Build", + "ReferencedProjectsConfiguration": [ + { + "Identity": "${ProjectRoot}\\AnotherClassLib\\AnotherClassLib.csproj", + "Version": 1, + "Source": "AnotherClassLib", + "GetPublishAssetsTargets": "", + "AdditionalPublishProperties": ";", + "AdditionalPublishPropertiesToRemove": ";WebPublishProfileFile", + "GetBuildAssetsTargets": "GetCurrentProjectStaticWebAssetsV2", + "AdditionalBuildProperties": ";", + "AdditionalBuildPropertiesToRemove": ";WebPublishProfileFile" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\ClassLibrary.csproj", + "Version": 1, + "Source": "ClassLibrary", + "GetPublishAssetsTargets": "", + "AdditionalPublishProperties": ";", + "AdditionalPublishPropertiesToRemove": ";WebPublishProfileFile", + "GetBuildAssetsTargets": "GetCurrentProjectStaticWebAssetsV2", + "AdditionalBuildProperties": ";", + "AdditionalBuildPropertiesToRemove": ";WebPublishProfileFile" + } + ], + "DiscoveryPatterns": [ + { + "Name": "AnotherClassLib\\wwwroot", + "Source": "AnotherClassLib", + "ContentRoot": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\", + "BasePath": "_content/AnotherClassLib", + "Pattern": "**" + }, + { + "Name": "ClassLibrary\\wwwroot", + "Source": "ClassLibrary", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\wwwroot\\", + "BasePath": "_content/ClassLibrary", + "Pattern": "**" + } + ], + "Assets": [ + { + "Identity": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\css\\site.css", + "SourceId": "AnotherClassLib", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\", + "BasePath": "_content/AnotherClassLib", + "RelativePath": "css/site.css", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\css\\site.css" + }, + { + "Identity": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", + "SourceId": "AnotherClassLib", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\", + "BasePath": "_content/AnotherClassLib", + "RelativePath": "js/project-direct-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js" + }, + { + "Identity": "${ProjectRoot}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", + "SourceId": "AppWithPackageAndP2PReference", + "SourceType": "Computed", + "ContentRoot": "${ProjectRoot}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\", + "BasePath": "_content/AppWithPackageAndP2PReference", + "RelativePath": "AppWithPackageAndP2PReference.styles.css", + "AssetKind": "All", + "AssetMode": "CurrentProject", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "ScopedCss", + "AssetTraitValue": "ApplicationBundle", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\obj\\Debug\\netcoreapp3.0\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", + "SourceId": "ClassLibrary", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\obj\\Debug\\netcoreapp3.0\\scopedcss\\projectbundle\\", + "BasePath": "_content/ClassLibrary", + "RelativePath": "ClassLibrary.bundle.scp.css", + "AssetKind": "All", + "AssetMode": "Reference", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "ScopedCss", + "AssetTraitValue": "ProjectBundle", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\ClassLibrary\\obj\\Debug\\netcoreapp3.0\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", + "SourceId": "ClassLibrary", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\wwwroot\\", + "BasePath": "_content/ClassLibrary", + "RelativePath": "js/project-transitive-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", + "SourceId": "ClassLibrary", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\wwwroot\\", + "BasePath": "_content/ClassLibrary", + "RelativePath": "js/project-transitive-dep.v4.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js" + }, + { + "Identity": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\PackageLibraryDirectDependency.bundle.scp.css", + "SourceId": "PackageLibraryDirectDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryDirectDependency", + "RelativePath": "PackageLibraryDirectDependency.bundle.scp.css", + "AssetKind": "All", + "AssetMode": "Reference", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "ScopedCss", + "AssetTraitValue": "ProjectBundle", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\PackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Identity": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\css\\site.css", + "SourceId": "PackageLibraryDirectDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryDirectDependency", + "RelativePath": "css/site.css", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\css\\site.css" + }, + { + "Identity": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\js\\pkg-direct-dep.js", + "SourceId": "PackageLibraryDirectDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryDirectDependency", + "RelativePath": "js/pkg-direct-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\js\\pkg-direct-dep.js" + }, + { + "Identity": "${RestorePath}\\packagelibrarytransitivedependency\\1.0.0\\staticwebassets\\js\\pkg-transitive-dep.js", + "SourceId": "PackageLibraryTransitiveDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarytransitivedependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryTransitiveDependency", + "RelativePath": "js/pkg-transitive-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarytransitivedependency\\1.0.0\\staticwebassets\\js\\pkg-transitive-dep.js" + } + ] +} \ No newline at end of file diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json new file mode 100644 index 000000000000..b445674c9e8d --- /dev/null +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json @@ -0,0 +1,17 @@ +[ + "${OutputPath}\\wwwroot\\AppWithPackageAndP2PReference.styles.css", + "${OutputPath}\\wwwroot\\_content\\AnotherClassLib\\css\\site.css", + "${OutputPath}\\wwwroot\\_content\\AnotherClassLib\\js\\project-direct-dep.js", + "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\ClassLibrary.bundle.scp.css", + "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.js", + "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", + "${OutputPath}\\wwwroot\\_content\\PackageLibraryDirectDependency\\PackageLibraryDirectDependency.bundle.scp.css", + "${OutputPath}\\wwwroot\\_content\\PackageLibraryDirectDependency\\css\\site.css", + "${OutputPath}\\wwwroot\\_content\\PackageLibraryDirectDependency\\js\\pkg-direct-dep.js", + "${OutputPath}\\wwwroot\\_content\\PackageLibraryTransitiveDependency\\js\\pkg-transitive-dep.js", + "${OutputPath}\\wwwroot\\css\\site.css", + "${OutputPath}\\wwwroot\\js\\project-direct-dep.js", + "${OutputPath}\\wwwroot\\js\\project-transitive-dep.js", + "${OutputPath}\\wwwroot\\js\\project-transitive-dep.v4.js", + "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css" +] \ No newline at end of file diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json new file mode 100644 index 000000000000..722c57cebcb0 --- /dev/null +++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json @@ -0,0 +1,220 @@ +{ + "Version": 1, + "Hash": "__hash__", + "Source": "AppWithPackageAndP2PReference", + "BasePath": "_content/AppWithPackageAndP2PReference", + "Mode": "Default", + "ManifestType": "Publish", + "ReferencedProjectsConfiguration": [ + { + "Identity": "${ProjectRoot}\\AnotherClassLib\\AnotherClassLib.csproj", + "Version": 1, + "Source": "AnotherClassLib", + "GetPublishAssetsTargets": "", + "AdditionalPublishProperties": ";", + "AdditionalPublishPropertiesToRemove": ";WebPublishProfileFile", + "GetBuildAssetsTargets": "GetCurrentProjectStaticWebAssetsV2", + "AdditionalBuildProperties": ";", + "AdditionalBuildPropertiesToRemove": ";WebPublishProfileFile" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\ClassLibrary.csproj", + "Version": 1, + "Source": "ClassLibrary", + "GetPublishAssetsTargets": "", + "AdditionalPublishProperties": ";", + "AdditionalPublishPropertiesToRemove": ";WebPublishProfileFile", + "GetBuildAssetsTargets": "GetCurrentProjectStaticWebAssetsV2", + "AdditionalBuildProperties": ";", + "AdditionalBuildPropertiesToRemove": ";WebPublishProfileFile" + } + ], + "DiscoveryPatterns": [ + { + "Name": "AnotherClassLib\\wwwroot", + "Source": "AnotherClassLib", + "ContentRoot": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\", + "BasePath": "_content/AnotherClassLib", + "Pattern": "**" + }, + { + "Name": "ClassLibrary\\wwwroot", + "Source": "ClassLibrary", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\wwwroot\\", + "BasePath": "_content/ClassLibrary", + "Pattern": "**" + } + ], + "Assets": [ + { + "Identity": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\css\\site.css", + "SourceId": "AnotherClassLib", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\", + "BasePath": "_content/AnotherClassLib", + "RelativePath": "css/site.css", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\css\\site.css" + }, + { + "Identity": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", + "SourceId": "AnotherClassLib", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\", + "BasePath": "_content/AnotherClassLib", + "RelativePath": "js/project-direct-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js" + }, + { + "Identity": "${ProjectRoot}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", + "SourceId": "AppWithPackageAndP2PReference", + "SourceType": "Computed", + "ContentRoot": "${ProjectRoot}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\", + "BasePath": "_content/AppWithPackageAndP2PReference", + "RelativePath": "AppWithPackageAndP2PReference.styles.css", + "AssetKind": "All", + "AssetMode": "CurrentProject", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "ScopedCss", + "AssetTraitValue": "ApplicationBundle", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\AppWithPackageAndP2PReference\\obj\\Debug\\net6.0\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\obj\\Debug\\netcoreapp3.0\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", + "SourceId": "ClassLibrary", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\obj\\Debug\\netcoreapp3.0\\scopedcss\\projectbundle\\", + "BasePath": "_content/ClassLibrary", + "RelativePath": "ClassLibrary.bundle.scp.css", + "AssetKind": "All", + "AssetMode": "Reference", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "ScopedCss", + "AssetTraitValue": "ProjectBundle", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\ClassLibrary\\obj\\Debug\\netcoreapp3.0\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", + "SourceId": "ClassLibrary", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\wwwroot\\", + "BasePath": "_content/ClassLibrary", + "RelativePath": "js/project-transitive-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js" + }, + { + "Identity": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", + "SourceId": "ClassLibrary", + "SourceType": "Project", + "ContentRoot": "${ProjectRoot}\\ClassLibrary\\wwwroot\\", + "BasePath": "_content/ClassLibrary", + "RelativePath": "js/project-transitive-dep.v4.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${ProjectRoot}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js" + }, + { + "Identity": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\PackageLibraryDirectDependency.bundle.scp.css", + "SourceId": "PackageLibraryDirectDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryDirectDependency", + "RelativePath": "PackageLibraryDirectDependency.bundle.scp.css", + "AssetKind": "All", + "AssetMode": "Reference", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "ScopedCss", + "AssetTraitValue": "ProjectBundle", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\PackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Identity": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\css\\site.css", + "SourceId": "PackageLibraryDirectDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryDirectDependency", + "RelativePath": "css/site.css", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\css\\site.css" + }, + { + "Identity": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\js\\pkg-direct-dep.js", + "SourceId": "PackageLibraryDirectDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryDirectDependency", + "RelativePath": "js/pkg-direct-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarydirectdependency\\1.0.0\\staticwebassets\\js\\pkg-direct-dep.js" + }, + { + "Identity": "${RestorePath}\\packagelibrarytransitivedependency\\1.0.0\\staticwebassets\\js\\pkg-transitive-dep.js", + "SourceId": "PackageLibraryTransitiveDependency", + "SourceType": "Package", + "ContentRoot": "${RestorePath}\\packagelibrarytransitivedependency\\1.0.0\\staticwebassets\\", + "BasePath": "_content/PackageLibraryTransitiveDependency", + "RelativePath": "js/pkg-transitive-dep.js", + "AssetKind": "All", + "AssetMode": "All", + "AssetRole": "Primary", + "RelatedAsset": "", + "AssetTraitName": "", + "AssetTraitValue": "", + "CopyToOutputDirectory": "Never", + "CopyToPublishDirectory": "PreserveNewest", + "OriginalItemSpec": "${RestorePath}\\packagelibrarytransitivedependency\\1.0.0\\staticwebassets\\js\\pkg-transitive-dep.js" + } + ] +} \ No newline at end of file