Commit Graph

935 Commits

Author SHA1 Message Date
Pranav K 8938f6c8c2 Change the default extension for Razor views to .Views.dll 2018-02-21 11:48:31 -08:00
Pranav K fed0970b33 Revert "Update to the latest Sdk and cleanup projects"
This reverts commit 1c9088087b.
2018-02-21 11:26:04 -08:00
N. Taylor Mullen c5e83c61f8 Changed AddDefaultImports to take strings instead of project items.
- Strings here was important because any import added to the system dynamically needs to eventually make its way back to being a project item. With strings we can state that they do exist (have content) but do not have any file paths associated.
- Updated all call sites to use the new AddDefaultImports string based api.

#2080
2018-02-21 09:42:40 -08:00
Pranav K 1c9088087b Update to the latest Sdk and cleanup projects 2018-02-21 06:49:53 -08:00
Pranav K 9a9a2cf66a Make content files work better in class library projects referencing Razor Sdk
* Include cshtml files as content when referencing Razor Sdk
* Exclude cshtml files added by default from being packed

Fixes #1980
2018-02-20 14:15:19 -08:00
Ryan Nowak 43f8108ac3 Merge branch 'rel/vs15.7' into dev 2018-02-19 16:45:49 -08:00
Ryan Nowak 59a1cf9293 Add support for method parameters to Razor IR 2018-02-19 14:38:03 -08:00
Nate McMaster 13824c418e Catch 15.7 up with dev
This change integrates most of the non-breaking work that we did in 2.1
including the updates to make Razor less coupled to MVC.
2018-02-19 10:46:16 -08:00
Ryan Nowak 45148142ea Fix broken build 2018-02-16 09:43:33 -08:00
Ajay Bhargav Baaskaran c293267421 Fixed unnecessary invocation of TagHelper target 2018-02-15 15:31:54 -08:00
Pranav K a13a0aa8c4
WebSdk transitions (#2078)
* WebSdk transitions

* Add a reference to Microsoft.Net.Sdk if it wasn't previously referenced
* Move PreserveCompilationContext in to our target
* Remove use of transition property
2018-02-15 15:09:05 -08:00
Ryan Nowak 56ead8118a Decouple Razor tools from MVC
Adds a loader (with shadow copying in server mode) based on the Roslyn
Analyzer loader design.

Adds some targets to the Razor SDK that we can use to compute the
configuration and extensions.

Passes all of the metadata through to the command line tools so they can
deal with extensions.
2018-02-15 13:31:31 -08:00
Pranav K 16bcd8871e WebSdk transitions
* Add a reference to Microsoft.Net.Sdk if it wasn't previously referenced
* Move PreserveCompilationContext in to our target
* Remove use of transition property
2018-02-15 12:08:18 -08:00
N. Taylor Mullen e200b69511 Change IImportProjectFeature to consume RazorProjectItems.
- Updated all implementations of `IImportProjectFeature`; for MVC I went ahead and made a single project item that's always returned for MVC scenarios. That project item is smart about returning its content in a light-weight stream fashion.
- Had to add a `RazorProjectItem` => `RazorSourceDocument` conversion mechanic into `DefaultRazorProjectEngine`.
- Added tests for `DefaultRazorProjectItem.ConvertToSourceDocument`.
- Removed the `ProjectEngine` API from `VisualStudioRazorParser`. This was unrelated but was missed feedback.

#2068
2018-02-15 11:31:18 -08:00
N. Taylor Mullen 133eff3119 Move to RazorProjectEngine.
- Instead of using Razor/Mvc TemplateEngine use `RazorProjectEngine`. This involved changing several locations (each of which used `RazorTemplateEngine` in an entirely different way) to use the RazorProjectEngine's two Process methods.
- Changed an unused public API `VisualStudioRazorParser.TemplateEngine` to `VisualStudioRazorParser.RazorProjectEngine`.
- Ported the remainder of `RazorEngineBuilder`'s extension methods over to `RazorProjectEngineBuilder`. These were used in tests and our `RazorGenerate` tool.
- Added a few test helper methods/classes to enable simple testing of the `RazorProjectEngine`.
- Resolved several test hacks that were working around little discrepancies each of the `RazorTemplateEngine` APIs.
- Changed the template engine factory service to be a project engine factory service.
2018-02-14 12:40:23 -08:00
Ryan Nowak 82579b6333 Get rid of RazorConfiguration.DesignTime
This change makes it so that we no longer create 'design time' engines.
The choice of design time or runtime is made when we initiate a code
generation operation.

Options instances are now created as part of the CodeDocument
initialization. Our existing code can still be created using a
RazorEngine so our passes that initialize the options still support the
old code path.
2018-02-13 16:21:18 -08:00
N. Taylor Mullen 3375fc8b99 Change RazorProjectEngine to operate on RazorProjectItems.
- Removed the `Process(string)` overload to make it extra clear that you must operate on project items. This way we also don't need to worry about the various formats of paths that can flow through the system.
- Updated tests to use the new project item format.
- Did a few formatting fixes on unrealted files.

#2049
2018-02-09 17:24:27 -08:00
Ryan Nowak 0c6aadb897 Add a test for design time builds #1846
This change adds a test to verify that Razor targets don't show up in
design time builds when RazorCompileOnBuild=true

We don't want to add a significant perf cost to design time builds since
they affect project load.
2018-02-09 15:33:19 -08:00
N. Taylor Mullen 84bc74ea9f Move to RazorProjectFileSystem.
- Changed all existing APIs to utilize `RazorProjectFileSystem`. This was possible because `RazorProjectFileSystem` inherits from RazorProject.
- Renamed `FileSystemRazorProject` to `DefaultRazorProjectFileSystem`.
- Renamed FileSystemRazorProjectItem` to `DefaultRazorProjectItem`.
- Obsoleted `RazorProject.Create`

#1828
2018-02-09 11:49:31 -08:00
Ajay Bhargav Baaskaran 8b78b4f421 Cleaned up logging in build server 2018-02-07 23:52:54 -08:00
Ryan Nowak 6d757988c9 Integrate new Sdk
The project file change is a workaround for
https://github.com/Microsoft/msbuild/issues/2874
2018-02-06 15:41:31 -08:00
Ajay Bhargav Baaskaran 0a7edd665e Added another integration test 2018-02-06 14:33:47 -08:00
Ajay Bhargav Baaskaran ba7f955afa Split arguments for the build server properly 2018-02-06 11:32:48 -08:00
Pranav K 84beb5985f Add support for relative paths
* Move path munging in to Razor SDK
* Use AssignTargetPath to determine the target path for outputs and embedded resources

Fixes #1829
Fixes #1847
Fixes #1999
2018-02-05 14:19:52 -08:00
Pranav K 0df6bfb839 Change the casing of Sdk to match other Sdks 2018-02-05 11:20:18 -08:00
Ryan Nowak 5b28c06d64
Add prelimianry support for extensions to Razor (#2012)
* Add prelimianry support for extensions to Razor

This PR adds MSBuild insfrastructure to the SDK that can understand
concepts we need to expose to the project, code generator and runtime
like:
- Language version
- Configuration
- Extensions (plugins)

As an example of how this works, I've done the wireup for MVC. This will
now generate assembly attributes in your application that can act as a
source-of-truth for what should be included in runtime compilation, and
it's all based on the project-file. This means that it can be delivered
and configured by packages.

The next step here is to implement a loader for RazorProjectEngine based
on these primitives, and then use it in our CLI tools and MVC.

The next step after that is to expose it in VS and VS4Mac through the
project system.
2018-02-02 17:41:14 -08:00
Ryan Brandenburg 8c328edfb2 Skip flaky test 2018-02-02 16:23:38 -08:00
Pranav K 35779abd9a Rename Microsoft.AspNetCore.Razor.Sdk to Microsoft.NET.Sdk.Razor 2018-02-02 13:12:29 -08:00
N. Taylor Mullen 4eea2f6992 Change DefaultTagHelperFactsService to not expect a primary workspace.
- Removed `TagHelperFactsServiceInternal` since we had no way of retrieving the internal Workspace service given the exposed public API. Not to mention I think the `TagHelperFactsService` made more sense as a MEF service anyhow.
- Moved `TagHelperFactsServiceInternal` tests to `Microsoft.VisualStudio.Editor.Razor.Test` project and changed them to utilize the non-"internal" version.
- Updated completion service API to rely on non-`TagHelperFactsServiceInternal` pieces.

#2004
2018-02-02 12:02:45 -08:00
N. Taylor Mullen fff1c01aa0 Add Mac implementation of VisualStudioWorkspaceAccessor new APIs.
- The Mac implementation does not have fallback logic like the windows variant because Workspaces in VS mac world are spun up / torn down regularly. We don't want to be tracking down bugs that involve us adding services or Razor logic to Workspaces that have nothing to do with Razor.
- Added a test for the `DefaultVisualStudioWorkspaceAccessor`. Could not add other tests due to limitations of MonoDevelop's abstractions.

#1989
2018-02-01 14:51:23 -08:00
N. Taylor Mullen 6d2460ae7f Update DefaultRazorEditorFactoryService to be per-workspace.
- Updated the a `VisualStudioWorkspaceAccessor` API in windows to enable the factory to retrieve a workspace given a text buffer.
- Added a way to add test services to `AdhocWorkspace` so we can test against services being retrieved from a `Workspace`. This will be much more common once we rely on services coming from `TextBuffer`s in our other tooling pieces.
- Added tests for the default workspace provider.

#1989
2018-02-01 14:51:23 -08:00
Ryan Nowak e3932aa1ec Merge remote-tracking branch 'origin/release/2.1' into dev 2018-02-01 13:36:07 -08:00
Ryan Nowak 818d4256aa Fix #1999
The fix for this for preview1 is to ignore any files with an absolute path. MvcPrecompilation
ignores files outside the project root, and we're aiming for parity.

This will have a proper fix in preview2
2018-02-01 13:05:45 -08:00
Ajay Bhargav Baaskaran 4f5a5854b6 Skipping flaky tests on windows as well 2018-01-31 11:28:07 -08:00
N. Taylor Mullen 99010aaea4 Change EditorSettingsManager to not be per-workspace.
- Lifted `DefaultEditorSettingsManagerInternal`s state / event handling functionality into its `DefaultEditorSettingsManager`.
- Re-purposed `EditorSettingsManagerInternal` into a less-API heavy middleman `WorkspaceEditorSettings` for any workspace services concerned with editor settings to consume.
- Moved `DefaultEditorSettingsManagerInternal` into the Editor.Razor assembly and renamed it to `DefaultWorkspaceEditorSettings` since it needed the `EditorSettingsManager` API to function properly. The contract still exists at the `CodeAnalysis.Razor.Workspace` level.

#1982
2018-01-30 16:01:55 -08:00
Ajay Bhargav Baaskaran 9244383ec7 Modified integration test infrastructure to test build server 2018-01-30 15:55:17 -08:00
Ajay Bhargav Baaskaran b677a9e43f Skip only on non-windows 2018-01-29 18:56:18 -08:00
Ajay Bhargav Baaskaran 399216730a Temporarily skip tests 2018-01-29 18:27:45 -08:00
Pranav K 13388ca6ae Make testapps run without deployment 2018-01-29 18:12:35 -08:00
N. Taylor Mullen c0cb8f009c Update RazorProjectEngine to use RazorConfiguration.
- In this PR we do away with `CreateDesignTime` on the `RazorProjectEngine`. Instead we now have an overload that takes in a configuration and does the right thing.
- Updated `RazorProjectEngineBuilder` to have a configuration.
- Updated `RazorConfiguration` to only have a `Default`. Setting up a razor configuration for design time now requires calling code to construct the configuration manually.
2018-01-29 16:08:17 -08:00
N. Taylor Mullen 80f943caef Flow RazorLanguageVersion to RazorEngine.
- Restructured RazorLanguageVersion to be a sealed concrete type to enable things like `RazorLanguageVersion.Latest`; it also allows us to make broader changes in the future. Also, in the future if we want to add support for overriding operators to enable greater than comparisons we can as well.
- Removed version validity checks because we restrict who can construct a `RazorLanguageVersion` now. This way we don't have to check for valid versions all throughout our code.
- Added a simple `ProjectExtensibilityConfiguration` => `RazorLanguageVersion` method in the `DefaultProjectExtensibilityConfigurationFactory` to temporarily enable letting the system operate on the `RazorLanguageVersion`. Eventually that entire class will change.

#1961
2018-01-29 16:08:17 -08:00
Ajay Bhargav Baaskaran 004ff204aa Refactoring, naming cleanup and tests for build server
- Multiple renames and cleanup
- Added tests for ServerProtocol and RequestDispatcher
- Added ServerLifecycleTest
2018-01-26 16:19:22 -08:00
Pranav K 04bf7eec0f Introduce a Razor SDK package
Move parts of Razor.Design in to an SDK that ship with the CLI.
2018-01-25 14:26:30 -08:00
N. Taylor Mullen 771a7e35a4 Add MVC support for RazorProjectEngine.
- Make `RazorProjectEngine` call paths for all feature registrations.
- Add `DefaultMvcImportFeature` for latest and 1.X MVC.
- Ported `AddTargetExtension` and `AddDirective` to `RazorProjectEngineBuilderExtensions`.
- Added tests and a test file system project type.
- Moved obsolete `IRazorEngineBuilder` methods to the bottom of each file. Will actually obsolete the methods once `RazorProjectEngine` is working end-to-end.

#1828
2018-01-25 12:26:11 -08:00
N. Taylor Mullen a01fa1c5b6 Flow RazorLanguageVersion to RazorEngine.
- Restructured RazorLanguageVersion to be a sealed concrete type to enable things like `RazorLanguageVersion.Latest`; it also allows us to make broader changes in the future. Also, in the future if we want to add support for overriding operators to enable greater than comparisons we can as well.
- Removed version validity checks because we restrict who can construct a `RazorLanguageVersion` now. This way we don't have to check for valid versions all throughout our code.
- Added a simple `ProjectExtensibilityConfiguration` => `RazorLanguageVersion` method in the `DefaultProjectExtensibilityConfigurationFactory` to temporarily enable letting the system operate on the `RazorLanguageVersion`. Eventually that entire class will change.

#1961
2018-01-25 09:17:37 -08:00
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