Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go through View folders recursively #171

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions R4MVC.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29318.209
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".solution", ".solution", "{1E8F7AFD-5175-406A-9736-817C75DA1142}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -33,8 +33,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetSimple.Test", "test\A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleModels", "samples\SampleModels\SampleModels.csproj", "{8F6D7DDE-98A0-4808-BD91-C1CF2E0AAC69}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetSimple.NetCore2", "samples\AspNetSimple.NetCore2\AspNetSimple.NetCore2.csproj", "{4609AF1D-0942-43DA-9979-F92972A22A7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -73,10 +71,6 @@ Global
{8F6D7DDE-98A0-4808-BD91-C1CF2E0AAC69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F6D7DDE-98A0-4808-BD91-C1CF2E0AAC69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F6D7DDE-98A0-4808-BD91-C1CF2E0AAC69}.Release|Any CPU.Build.0 = Release|Any CPU
{4609AF1D-0942-43DA-9979-F92972A22A7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4609AF1D-0942-43DA-9979-F92972A22A7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4609AF1D-0942-43DA-9979-F92972A22A7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4609AF1D-0942-43DA-9979-F92972A22A7A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -90,7 +84,6 @@ Global
{86B3FF8A-284E-4070-9120-D343366B18E2} = {B9FF7D5E-784B-4C4A-B6E6-286C1E3D131E}
{75510011-133B-4A05-AD09-A399CDBFA3A5} = {30626644-0E8A-4610-A0A9-274E91F1A037}
{8F6D7DDE-98A0-4808-BD91-C1CF2E0AAC69} = {B9FF7D5E-784B-4C4A-B6E6-286C1E3D131E}
{4609AF1D-0942-43DA-9979-F92972A22A7A} = {B9FF7D5E-784B-4C4A-B6E6-286C1E3D131E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B90C19F2-2B5E-42AD-AE1D-27AD17E4DDB4}
Expand Down
2 changes: 1 addition & 1 deletion samples/AspNetFeatureFolders/AspNetFeatureFolders.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/R4Mvc.Tools.Cli/R4Mvc.Tools.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>r4mvc</AssemblyName>
<ContentTargetFolders>tools</ContentTargetFolders>
<PackAsTool>true</PackAsTool>
Expand Down
17 changes: 14 additions & 3 deletions src/R4Mvc.Tools/Locators/DefaultRazorViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,22 @@ protected virtual IEnumerable<View> FindViews(string projectRoot, string areaNam
yield return GetView(projectRoot, file, controllerName, areaName);
}

foreach (var directory in _fileLocator.GetDirectories(controllerPath))
foreach (var view in FindViewsRecursively(projectRoot, areaName, controllerName, controllerPath))
yield return view;

IEnumerable<View> FindViewsRecursively(string projectRoot, string areaName, string controllerName, string controllerPath)
{
foreach (var file in _fileLocator.GetFiles(directory, "*.cshtml"))
foreach (var directory in _fileLocator.GetDirectories(controllerPath))
{
yield return GetView(projectRoot, file, controllerName, areaName, Path.GetFileName(directory));
foreach (var file in _fileLocator.GetFiles(directory, "*.cshtml"))
{
yield return GetView(projectRoot, file, controllerName, areaName, Path.GetFileName(directory));
}

foreach (var file in FindViewsRecursively(projectRoot, areaName, controllerName, directory))
{
yield return file;
}
}
}
}
Expand Down
15 changes: 11 additions & 4 deletions src/R4Mvc.Tools/R4Mvc.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
<IncludeBuildOutput>False</IncludeBuildOutput>
</PropertyGroup>

<PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>


<PropertyGroup>
<PackageId>R4Mvc.Tools</PackageId>
<Authors>Kevin Kuszyk, Scott Mackay, Artiom Chilaru</Authors>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
Expand Down Expand Up @@ -49,12 +55,13 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.10.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.10.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="5.0.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/R4Mvc/R4Mvc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard1.6;netstandard2.0;net6.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions test/R4Mvc.Test/R4Mvc.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down