Commit Graph

1045 Commits

Author SHA1 Message Date
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
Ajay Bhargav Baaskaran 5a93f68ccc Pass through DebugTool to to debug build server creation 2018-02-05 14:10:32 -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
N. Taylor Mullen ca15840d05 Remove VisualStudioWorkspaceAccessor.Workspace.
- This property used to represent a "primary Workspace". Now that we're moving away from having a "primary Workspace" this needs to go away.

#2001
2018-02-02 15:35:07 -08:00
N. Taylor Mullen ea9a74ee3c Change RazorTextViewConnectionListener to not depend on a primary workspace.
- Updated the `DefaultRazorDocumentManager` to also not be a workspace service. It didn't end up having any workspace specific logic so it made sense to have the lifetime of the IDE.

#2010
2018-02-02 14:04:35 -08:00
Pranav K 8461158306 Use consistent file casing for Razor Sdk 2018-02-02 13:42:14 -08:00
Ryan Nowak 07f3c5cb50 Merge branch 'rel/vs15.7' into dev 2018-02-02 13:17:27 -08:00
Ryan Nowak eb5abc6ac5 Add CPS dependencies
Getting this in to avoid pain when rebasing/merging.
2018-02-02 13:16:24 -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 64f9474eb1 Change RazorCodeDocumentProvider to not be per-workspace.
- Changed the `RazorCodeDocumentProvider` and its `TextBufferCodeDocumentProvider` dependency to be MEF services. This changes their lifetimes from per-workspace to per-IDE.
- Updated `RazorDirectiveCompletionProvider` to get the code document provider via MEF instead of the old primary workspace".
- Removed language service factory types.

#2007
2018-02-01 17:59:23 -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
N. Taylor Mullen 5e454a36fa Change TextBufferProjectService to not be per-workspace.
- Updated impacted code to now expect this from MEF.

#1997
2018-02-01 14:51:23 -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
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
Pranav K ee9f9225c3 Remove unused property 2018-01-29 07:45:46 -08:00
N. Taylor Mullen 84bc0fa4c9 Change ForegroundDispatcher to be a MEF service.
- The `ForegroundDispatcher` needed to be accessible by services without requiring a workspace; given that it doesn't have any ties to the `Workspace` other than being a service of one I was able to move it into a MEF service.
- Updated all workspace inclusions of the dispatcher to use importing constructors instead.
- Updated the Mac + Windows implementations to be exported as MEF pieces.

#1979
2018-01-26 17:14:40 -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 42c3102cd4 Changes per PR comments 2018-01-26 11:04:24 -08:00
Pranav K bd72b1bac9 Don't import the SDK when cross-targeting 2018-01-26 11:04:24 -08:00
Pranav K 44f102d6ff Remove multitargeting target 2018-01-25 16:07:44 -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
Ajay Bhargav Baaskaran d9b7ff238f Unified cli tools
- Removed GenerateTool and TagHelperTool
- rzc now handles four commands (server, shutdown, discover and
generate)
- Removed RequestCommand
2018-01-24 15:38:11 -08:00
Ajay Bhargav Baaskaran 4500de5862 Build server working end to end
- Added a UseServer switch
- Updated tasks to use the build server in enabled
2018-01-24 15:30: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
Pranav K a00569249b Fix broken build 2018-01-19 13:48:14 -08:00
Pranav K 5232d2352b Use unique names for commonly used properties
Fixes #1948
2018-01-19 11:10:52 -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 d4ed8a7b77 Prefer BeforeTargets/AfterTargets over evaluation
We can't rely on property evaluation to attach targets to the build
lifecycle, as we rely on the web sdk to set these properties and they
run after us.
2018-01-18 18:37:54 -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 d1cfc51c9d Add a property so the web sdk can know that the Razor compiler is available. 2018-01-17 17:21:20 -08:00
Ryan Nowak 0584fe3ecf Make RazorCompileOnPublish the default 2018-01-17 13:06:20 -08:00
Ryan Nowak 627696677c
Split up Razor SDK logic (#1934)
* Split up Razor SDK logic

Splitting the fragile parts of code generation into its own file. We're
possibly separating the Razor SDK into a part that ships in the dotnet
SDK and part that ships in a nupkg with the compiler.

This means defining more of a fixed lifecycle in the main file, and
treating our actual work as more like extensibility.
2018-01-17 12:52:17 -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
N. Taylor Mullen 92111ea515 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 20:53:35 -08:00
Pranav K 50fa43d35b Replace aspnetcore-ci-dev feed with aspnetcore-dev 2018-01-16 20:19:11 -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 d1984aa44b Add hook for precompilation 2018-01-12 21:24:15 -08:00
Ryan Nowak 14cea3c1b9 Move properties 2018-01-12 21:11:28 -08:00
Ryan Nowak f0c3843a5b Implment support for publish 2018-01-12 21:11:28 -08:00
Ajay Bhargav Baaskaran d238c0dcfc Some pre-requisites for for Razor build server 2018-01-12 17:42:52 -08:00