Commit Graph

889 Commits

Author SHA1 Message Date
N. Taylor Mullen aa3fb32220 Revert "Revert "Add contracts for RazorProjectEngine.""
This reverts commit f301d92332.
2018-01-24 11:20:18 -08:00
N. Taylor Mullen f301d92332 Revert "Add contracts for RazorProjectEngine."
This reverts commit 59f2cf8e66.
2018-01-23 11:42:38 -08:00
N. Taylor Mullen 59f2cf8e66 Add contracts for RazorProjectEngine.
- These contracts introduce a new `RazorProjectEngine` concept which allows for users to configure 1 entity that's responsible for the RazorEngine and project.
- The `RazorProjectEngineBuilder` has a collection of features that are dispersed on the created `RazorEngine` and the `RazorProjectEngine`.
- Included a complete implementation of `RazorProjectEngine` it introduces the extension points for the project engine. The primary one includes the `IRazorImportFeature`, the default behavior is to return 0 imports.
- Included a complete project engine builder implementation.

#1828
2018-01-22 17:05:43 -08:00
Ryan Nowak 2d87bdf565
Add support for MvcPrecompilation settings (#1956)
* Add support for MvcPrecompilation settings

Adds support to the Razor SDK for various legacy features of the MVC
Precompilation tool.

- MvcRazorCompileOnPublish
- MvcRazorExcludeViewFilesFromPublish
- MvcRazorExcludeRefAssembliesFromPublish
- MvcRazorOutputPath
- MvcRazorEmbedViewSources
- MvcRazorFilesToCompile
2018-01-22 16:56:58 -08:00
Ryan Nowak 233e67d0e0 Prepare for Web SDK changes
The Web SDK is going to set a new msbuild property to tell us that the
Razor SDK should be active. This hasn't been integrated into our build
system yet, so I'm temporarily hacking it until we get that change. At
that time I'll remove the special cases in these projects.
2018-01-18 19:23:34 -08:00
Ryan Nowak eaa201703d Fix build break
We didn't have a test for the case where RazorCompileOnPublish is false
and Publish is being called. This is breaking the precompilation repo.
2018-01-17 18:12:24 -08:00
Ryan Nowak 0584fe3ecf Make RazorCompileOnPublish the default 2018-01-17 13:06:20 -08:00
N. Taylor Mullen 968e033e4b Make Block and Span cache Length.
- Part of caching length required the `Span`'s `ReplaceWith` method to propagate its changes to its parent so that it can propogate the change to invalidate all parent length caches.
- Added Span and Block tests to validate the interaction of caching.

#1927
2018-01-16 21:14:46 -08:00
Ryan Nowak e8af1141cb Attempt to fix Razor CI flakiness
We're seeing some test failures on the CI where the build has no output.
Sure enough, using Process.Exited is trap. It doesn't guarantee that all
of the output has been written when it's trigger.

This is a different approach that shouldn't suffer from the same
problem.
2018-01-16 17:18:44 -08:00
Ryan Nowak b5554a8038 Make Razor SDK support refs and views on publish
These are default behaviors for precompilation.
2018-01-14 11:43:01 -08:00
Ryan Nowak f0c3843a5b Implment support for publish 2018-01-12 21:11:28 -08:00
Ryan Nowak 07a63d2ddd Add tests for RazorCompile target
This target should be callable on its own without using Build so it
deserves a few tests.
2018-01-12 21:11:28 -08:00
Ryan Nowak e0d876deb9 Skip flaky test on OSX 2018-01-12 21:01:12 -08:00
Ryan Nowak 2555c5bab1 WIP 2018-01-12 19:05:46 -08:00
N. Taylor Mullen f025a27f04 Unify how AdhocWorkspace is constructed.
- Created a new `TestWorkspace` type to lock on `AdhocWorkspace` construction. This type can't be constructed/changed in parallel.
- Updated test usages of `AdhocWorkspace` to make use of `TestWorkspace`.
- Added a `Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common` project to have the `TestWorkspace` type.

#1913
2018-01-12 17:54:53 -08:00
Pranav K ecb323b5dc Use FilePath if RelativePhysicalPath on RazorProjectItem is null 2018-01-12 15:19:01 -08:00
Ryan Nowak 6bab1c682d Fix a build break introduced by new SDK
This is failing on the CI due to an issue with a newer build of the SDK.
I opened https://github.com/dotnet/sdk/issues/1854 to track the SDK bug.

- update korebuild
- upgrade deps
- remove System.Diagnostics.DiagnosticSource from test projects
2018-01-12 14:22:00 -08:00
Ryan Nowak 5f501710aa Make Razor targets noop with no razor files 2018-01-11 13:59:25 -08:00
Ryan Nowak bb0aa9464a Add support and tests for Pack and P2P reference 2018-01-10 18:09:05 -08:00
N. Taylor Mullen 8d6b86c76a Add `RazorLanguage.CoreContentType`.
#1852
2018-01-09 14:59:01 -08:00
Ryan Nowak 03dea86c4e Adding more tests and clarity around file paths
I noticed we were really undertesting all of the things that handle
paths and file names. I gave this some love and a little clean up where
we weren't doing the right thing in RazorSourceDocument.

Also changed the template engine tests to use the
FileSystemRazorProject. These tests are already using the files on disk
as inputs. I turned off checksums for these since they now have the full
file path, and that would not be portable.
2018-01-08 22:53:49 -08:00
Ryan Nowak b7415502bf Add RelativePhysicalPath
The FilePath property on RPI isn't what we want for use in the compiler,
it's more of a view engine concept. Adding a property that does what we
want.
2018-01-08 19:37:54 -08:00
Pranav K bf52e0dbf0 Add support for CopyBuildOutputToOutputDirectory and CopyOutputSymbolsToOutputDirectory
Fixes #1896
2018-01-07 19:16:46 -08:00
Ryan Nowak 16324c3126 Add an Identifier by default
Using the MVC view engine convention for identifiers seems to make the
most sense, and we already use that convention for RazorProject so I
guess we're stuck with it.
2018-01-06 18:43:01 -08:00
Ryan Nowak b93bab9c04 Remove Get/SetRelativePath 2018-01-05 21:52:59 -08:00
Ryan Nowak d602f9d770 Add relative path to source document
Adding this via a properties object that encompasses all of the optional
properties. This way if we need to add more items that are optional we
can continue to do so without overload explosion.
2018-01-05 18:15:06 -08:00
Pranav K 1849056093 Add support for running tests using desktop msbuild 2018-01-05 12:52:01 -08:00
Ajay Bhargav Baaskaran 988d1b3c34 Use common BDN runner and config 2018-01-04 14:35:38 -08:00
Ryan Nowak 6fc028afb0 Attempt to fix travis again 2018-01-02 16:45:32 -08:00
Ryan Nowak 186e5733c0
Add metadata to Razor (#1894)
* Add metadata to Razor

This PR introduces standard metadata to Razor. This change begins to
formalize the contract between generated code produced by Razor and
runtimes that want to load and interact with this code.

This is a step on making MVC a 'plugin' to Razor rather than the only
possible implementation. Since we're doing MSBuild work - this is the
right time to designate the current interaction between Razor and MVC as
'legacy' and move forward.

Additionally, we need the source thumbprinting to make re-compilation of
Razor a thing.

-----

Also I noticed that our source document doesn't expose the hash
algorithm by name. We really should have this, so I added it and
hardened the code that deals with checksums in c# generation.
2018-01-02 13:30:50 -08:00
Ryan Nowak 2717cf8e77 Fix #1893 - fix formatting of RazorCompile 2018-01-02 10:54:59 -08:00
Pranav K 3ae601e4df
Prevent type name collisions when file hierarchy + namespace is identical (#1881)
* Prevent type name collisions when file hierarchy + namespace is identical
2018-01-02 09:41:10 -08:00
Ajay Bhargav Baaskaran 52a06e93bc Added test for DefaultRazorSyntaxFactsService 2017-12-29 17:02:35 -08:00
Pranav K b2e2719e43 Make AspNetCoreSettings actually work 2017-12-28 09:40:21 -08:00
Ajay Bhargav Baaskaran 34fe4099c2 Removed LegacyRazorDiagnostic and RazorError 2017-12-27 11:43:19 -08:00
Ajay Bhargav Baaskaran 439c742dec Removed LegacyResources.resx 2017-12-22 15:59:35 -08:00
N. Taylor Mullen 66d244aafc Make unit test work on linux 2017-12-22 14:33:08 -08:00
N. Taylor Mullen d4994eb4a4 Added DefaultRazorIndentationFactsService unit tests.
- Already had a good variety of integration tests so refactored the service to properly unit test each piece.
- Found several pieces of unneeded code (wasn't being used) so removed it.
- Removed the `LocateOwner` logic that was embedded in the service. We already have an equivalent locate owner on our `SyntaxTreeNode` items.

#1698
2017-12-22 14:31:14 -08:00
Ajay Bhargav Baaskaran 80af17fc4b Moved TagHelperParseTreeRewriter out of LegacyRazorDiagnostic 2017-12-22 12:33:28 -08:00
N. Taylor Mullen 63aceea121 Change TagHelperBlockRewriter's error usage to use RazorDiagnosticFactory.
- Changed `DefaultRazorDiagnostic` to expose a little more information for tests. This info is only available when casted to the `DefaultRazorDiagnostic` type and only available internally.
- Changed parameter order of a `DefaultTagHelperTargetExtension` diagnostic.
- Updated baselines of files in `Razor.Language.Test`.
- Added a new convenience constructor on `SourceSpan`. The ctor is equivalent to calling the class with a SourceLocation.

#1827
2017-12-22 09:38:31 -08:00
Pranav K bd03c16ee7 Ensure test apps use the same SDK as Razor 2017-12-22 07:34:22 -08:00
Pranav K 14fc427068 Make RazorCodeGen track file renames \ deletes
Fixes #1810
2017-12-22 07:13:53 -08:00
Ryan Nowak 3f948ad3c5
Verify support for reporting errors using MSBuild (#1867)
* Verify support for reporting errors using MSBuild
* Verifies that CSC errors get mapped to the right place

Resolves #1850
2017-12-20 16:08:35 -08:00
Ajay Bhargav Baaskaran d419566534 Revert "Revert "Include LineIndex and CharacterIndex when comparing SourceLocation""
This reverts commit bace4a3818.
2017-12-20 15:27:15 -08:00
Ryan Nowak 2c27272e4d Adding a basic test for RazorGenerate
Lotsa cleanup
2017-12-20 12:27:57 -08:00
Ajay Bhargav Baaskaran b3be0ebb91 Moved TokenizerBackerParser out of LegacyRazorDiagnostic 2017-12-20 11:21:05 -08:00
Ajay Bhargav Baaskaran 7d4fb5dcab Moved HtmlMarkupParser out of LegacyRazorDiagnostic 2017-12-19 18:07:23 -08:00
Ajay Bhargav Baaskaran bace4a3818 Revert "Include LineIndex and CharacterIndex when comparing SourceLocation"
This reverts commit 0e20ea5178.
2017-12-19 18:04:18 -08:00
Ajay Bhargav Baaskaran 0e20ea5178 Include LineIndex and CharacterIndex when comparing SourceLocation 2017-12-19 15:59:45 -08:00
Ajay Bhargav Baaskaran 808f539297 Moved CSharpCodeParser out of LegacyRazorDiagnostic 2017-12-19 15:59:37 -08:00