From ce8f053af7e94643dc3dd486caa1bc4dc5e515bb Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Mon, 22 Apr 2019 11:15:54 -0700 Subject: [PATCH] Rename all the service reference things (#9559) - #7492 - remove document generation from client project; will be included in Web API project infrastructure (coming soon) - adjust eng/ProjectReferences.props to new project name - simplify item de-duplication in `_CreateCompileItemsForServiceFileReferences` target i.e. use `Remove` attribute - also handle `.tsx` files in this target - provide `%(FirstForGenerator)` metadata, #4916 - add `$(OpenApiGenerateAtDesignTime)` property (default `true` for now), #4944 - generate code in `obj` directory by default, #4945 - provide a default `%(CodeGenerator)` value, ##7491 1 of 2 (remainder will come in next milestone) nits: - remove a useless `StringBuilder.Append(...)` call - remove `%(OpenApiProjectReference.SourceProject)` metadata, duplicated `%(OriginalItemSpec)` - be more consistent about using element syntax for item metadata --- eng/ProjectReferences.props | 2 +- .../src/CSharpIdentifier.cs | 0 .../src/GetCurrentItems.cs | 0 .../src/GetFileReferenceMetadata.cs | 50 +-- .../src/MetadataSerializer.cs | 1 - ...t.Extensions.ApiDescription.Client.csproj} | 6 - ...t.Extensions.ApiDescription.Client.nuspec} | 4 - .../src/Properties/Resources.Designer.cs | 18 +- .../src/Resources.resx | 6 +- ...oft.Extensions.ApiDescription.Client.props | 67 ++++ ...t.Extensions.ApiDescription.Client.targets | 149 +++++++++ ....Extensions.ApiDescription.Client.targets} | 4 +- .../src/GetProjectReferenceMetadata.cs | 147 --------- ...oft.Extensions.ApiDescription.Design.props | 124 -------- ...t.Extensions.ApiDescription.Design.targets | 295 ------------------ src/Mvc/Mvc.sln | 4 +- 16 files changed, 254 insertions(+), 623 deletions(-) rename src/Mvc/{Extensions.ApiDescription.Design => Extensions.ApiDescription.Client}/src/CSharpIdentifier.cs (100%) rename src/Mvc/{Extensions.ApiDescription.Design => Extensions.ApiDescription.Client}/src/GetCurrentItems.cs (100%) rename src/Mvc/{Extensions.ApiDescription.Design => Extensions.ApiDescription.Client}/src/GetFileReferenceMetadata.cs (71%) rename src/Mvc/{Extensions.ApiDescription.Design => Extensions.ApiDescription.Client}/src/MetadataSerializer.cs (99%) rename src/Mvc/{Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.csproj => Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.csproj} (86%) rename src/Mvc/{Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.nuspec => Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.nuspec} (69%) rename src/Mvc/{Extensions.ApiDescription.Design => Extensions.ApiDescription.Client}/src/Properties/Resources.Designer.cs (66%) rename src/Mvc/{Extensions.ApiDescription.Design => Extensions.ApiDescription.Client}/src/Resources.resx (91%) create mode 100644 src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.props create mode 100644 src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets rename src/Mvc/{Extensions.ApiDescription.Design/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Design.targets => Extensions.ApiDescription.Client/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Client.targets} (67%) delete mode 100644 src/Mvc/Extensions.ApiDescription.Design/src/GetProjectReferenceMetadata.cs delete mode 100644 src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.props delete mode 100644 src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.targets diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index 60692756fa..e0f67e2974 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -8,7 +8,7 @@ - + diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/CSharpIdentifier.cs b/src/Mvc/Extensions.ApiDescription.Client/src/CSharpIdentifier.cs similarity index 100% rename from src/Mvc/Extensions.ApiDescription.Design/src/CSharpIdentifier.cs rename to src/Mvc/Extensions.ApiDescription.Client/src/CSharpIdentifier.cs diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/GetCurrentItems.cs b/src/Mvc/Extensions.ApiDescription.Client/src/GetCurrentItems.cs similarity index 100% rename from src/Mvc/Extensions.ApiDescription.Design/src/GetCurrentItems.cs rename to src/Mvc/Extensions.ApiDescription.Client/src/GetCurrentItems.cs diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/GetFileReferenceMetadata.cs b/src/Mvc/Extensions.ApiDescription.Client/src/GetFileReferenceMetadata.cs similarity index 71% rename from src/Mvc/Extensions.ApiDescription.Design/src/GetFileReferenceMetadata.cs rename to src/Mvc/Extensions.ApiDescription.Client/src/GetFileReferenceMetadata.cs index 7266f816ed..73f8d01495 100644 --- a/src/Mvc/Extensions.ApiDescription.Design/src/GetFileReferenceMetadata.cs +++ b/src/Mvc/Extensions.ApiDescription.Client/src/GetFileReferenceMetadata.cs @@ -10,8 +10,8 @@ using Microsoft.Build.Utilities; namespace Microsoft.Extensions.ApiDescription.Tasks { /// - /// Adds or corrects ClassName, Namespace and OutputPath metadata in ServiceFileReference items. Also stores final - /// metadata as SerializedMetadata. + /// Adds or corrects ClassName, FirstForGenerator, Namespace, and OutputPath metadata in OpenApiReference items. + /// Also stores final metadata as SerializedMetadata. /// public class GetFileReferenceMetadata : Task { @@ -35,13 +35,13 @@ namespace Microsoft.Extensions.ApiDescription.Tasks public string OutputDirectory { get; set; } /// - /// The ServiceFileReference items to update. + /// The OpenApiReference items to update. /// [Required] public ITaskItem[] Inputs { get; set; } /// - /// The updated ServiceFileReference items. Will include ClassName, Namespace and OutputPath metadata. + /// The updated OpenApiReference items. Will include ClassName, Namespace and OutputPath metadata. /// [Output] public ITaskItem[] Outputs{ get; set; } @@ -50,36 +50,45 @@ namespace Microsoft.Extensions.ApiDescription.Tasks public override bool Execute() { var outputs = new List(Inputs.Length); + var codeGenerators = new HashSet(); var destinations = new HashSet(); foreach (var item in Inputs) { + var codeGenerator = item.GetMetadata("CodeGenerator"); + if (string.IsNullOrEmpty(codeGenerator)) + { + // This case occurs when user overrides the required metadata with an empty string. + var type = string.IsNullOrEmpty(item.GetMetadata("SourceProject")) ? + "OpenApiReference" : + "OpenApiProjectReference"; + + Log.LogError( + Resources.FormatInvalidEmptyMetadataValue("CodeGenerator", "OpenApiReference", item.ItemSpec)); + continue; + } + var newItem = new TaskItem(item); outputs.Add(newItem); - var codeGenerator = item.GetMetadata("CodeGenerator"); - if (string.IsNullOrEmpty("CodeGenerator")) + if (codeGenerators.Add(codeGenerator)) { - // This case occurs when user forgets to specify the required metadata. We have no default here. - string type; - if (!string.IsNullOrEmpty(item.GetMetadata("SourceProject"))) - { - type = "ServiceProjectReference"; - } - else - { - type = "ServiceFileReference"; - } - - Log.LogError(Resources.FormatInvalidEmptyMetadataValue("CodeGenerator", type, item.ItemSpec)); + newItem.SetMetadata("FirstForGenerator", "true"); + } + else + { + newItem.SetMetadata("FirstForGenerator", "false"); } var outputPath = item.GetMetadata("OutputPath"); if (string.IsNullOrEmpty(outputPath)) { - // No need to further sanitize this path. + // No need to further sanitize this path because the file must exist. var filename = item.GetMetadata("Filename"); - var isTypeScript = codeGenerator.EndsWith(TypeScriptLanguageName, StringComparison.OrdinalIgnoreCase); + var isTypeScript = codeGenerator.EndsWith( + TypeScriptLanguageName, + StringComparison.OrdinalIgnoreCase); + outputPath = $"{filename}Client{(isTypeScript ? ".ts" : Extension)}"; } @@ -94,6 +103,7 @@ namespace Microsoft.Extensions.ApiDescription.Tasks // This case may occur when user is experimenting e.g. with multiple code generators or options. // May also occur when user accidentally duplicates OutputPath metadata. Log.LogError(Resources.FormatDuplicateFileOutputPaths(outputPath)); + continue; } MetadataSerializer.SetMetadata(newItem, "OutputPath", outputPath); diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/MetadataSerializer.cs b/src/Mvc/Extensions.ApiDescription.Client/src/MetadataSerializer.cs similarity index 99% rename from src/Mvc/Extensions.ApiDescription.Design/src/MetadataSerializer.cs rename to src/Mvc/Extensions.ApiDescription.Client/src/MetadataSerializer.cs index 331bac617a..32f7fbf832 100644 --- a/src/Mvc/Extensions.ApiDescription.Design/src/MetadataSerializer.cs +++ b/src/Mvc/Extensions.ApiDescription.Client/src/MetadataSerializer.cs @@ -115,7 +115,6 @@ namespace Microsoft.Extensions.ApiDescription.Tasks { if (string.IsNullOrEmpty(value)) { - builder.Append(value); return; } diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.csproj b/src/Mvc/Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.csproj similarity index 86% rename from src/Mvc/Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.csproj rename to src/Mvc/Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.csproj index e7b3a31179..56ef2bdc24 100644 --- a/src/Mvc/Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.csproj +++ b/src/Mvc/Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.csproj @@ -27,15 +27,9 @@ - - - id=$(PackageId); diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.nuspec b/src/Mvc/Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.nuspec similarity index 69% rename from src/Mvc/Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.nuspec rename to src/Mvc/Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.nuspec index 2e660f3d8b..7521110b6f 100644 --- a/src/Mvc/Extensions.ApiDescription.Design/src/Microsoft.Extensions.ApiDescription.Design.nuspec +++ b/src/Mvc/Extensions.ApiDescription.Client/src/Microsoft.Extensions.ApiDescription.Client.nuspec @@ -21,9 +21,5 @@ - - - - diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/Properties/Resources.Designer.cs b/src/Mvc/Extensions.ApiDescription.Client/src/Properties/Resources.Designer.cs similarity index 66% rename from src/Mvc/Extensions.ApiDescription.Design/src/Properties/Resources.Designer.cs rename to src/Mvc/Extensions.ApiDescription.Client/src/Properties/Resources.Designer.cs index 68b8789cd9..3e16c26c41 100644 --- a/src/Mvc/Extensions.ApiDescription.Design/src/Properties/Resources.Designer.cs +++ b/src/Mvc/Extensions.ApiDescription.Client/src/Properties/Resources.Designer.cs @@ -11,7 +11,7 @@ namespace Microsoft.Extensions.ApiDescription.Tasks = new ResourceManager("Microsoft.Extensions.ApiDescription.Tasks.Resources", typeof(Resources).GetTypeInfo().Assembly); /// - /// Multiple items have OutputPath='{0}'. All ServiceFileReference and ServiceProjectReference items must have unique OutputPath metadata. + /// Multiple items have OutputPath='{0}'. All OpenApiReference items must have unique OutputPath metadata. /// internal static string DuplicateFileOutputPaths { @@ -19,25 +19,11 @@ namespace Microsoft.Extensions.ApiDescription.Tasks } /// - /// Multiple items have OutputPath='{0}'. All ServiceFileReference and ServiceProjectReference items must have unique OutputPath metadata. + /// Multiple items have OutputPath='{0}'. All OpenApiReference items must have unique OutputPath metadata. /// internal static string FormatDuplicateFileOutputPaths(object p0) => string.Format(CultureInfo.CurrentCulture, GetString("DuplicateFileOutputPaths"), p0); - /// - /// Mutliple ServiceProjectReference items have DocumentPath='{0}'. ServiceProjectReference items must have unique DocumentPath metadata. - /// - internal static string DuplicateProjectDocumentPaths - { - get => GetString("DuplicateProjectDocumentPaths"); - } - - /// - /// Mutliple ServiceProjectReference items have DocumentPath='{0}'. ServiceProjectReference items must have unique DocumentPath metadata. - /// - internal static string FormatDuplicateProjectDocumentPaths(object p0) - => string.Format(CultureInfo.CurrentCulture, GetString("DuplicateProjectDocumentPaths"), p0); - /// /// Invalid {0} metadata value for {1} item '{2}'. {0} metadata must not be set to the empty string. /// diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/Resources.resx b/src/Mvc/Extensions.ApiDescription.Client/src/Resources.resx similarity index 91% rename from src/Mvc/Extensions.ApiDescription.Design/src/Resources.resx rename to src/Mvc/Extensions.ApiDescription.Client/src/Resources.resx index 261308c789..1da8a34684 100644 --- a/src/Mvc/Extensions.ApiDescription.Design/src/Resources.resx +++ b/src/Mvc/Extensions.ApiDescription.Client/src/Resources.resx @@ -118,11 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Multiple items have OutputPath='{0}'. All ServiceFileReference and ServiceProjectReference items must have unique OutputPath metadata. - ServiceProjectReference items become ServiceFileReference items and all ServiceFileReference items must have unique OutputPath metadata. - - - Mutliple ServiceProjectReference items have DocumentPath='{0}'. ServiceProjectReference items must have unique DocumentPath metadata. + Multiple items have OutputPath='{0}'. All OpenApiReference items must have unique OutputPath metadata. Invalid {0} metadata value for {1} item '{2}'. {0} metadata must not be set to the empty string. diff --git a/src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.props b/src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.props new file mode 100644 index 0000000000..5f5640bfd3 --- /dev/null +++ b/src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.props @@ -0,0 +1,67 @@ + + + + <_ApiDescriptionTasksAssemblyTarget + Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard2.0 + <_ApiDescriptionTasksAssemblyTarget + Condition="'$(MSBuildRuntimeType)' != 'Core'">net461 + <_ApiDescriptionTasksAssemblyPath>$(MSBuildThisFileDirectory)/../tasks/$(_ApiDescriptionTasksAssemblyTarget)/Microsoft.Extensions.ApiDescription.Tasks.dll + <_ApiDescriptionTasksAssemblyTarget /> + + + + + + + + + + true + + + $(BaseIntermediateOutputPath) + $([MSBuild]::EnsureTrailingSlash('$(OpenApiDefaultOutputDirectory)')) + + + + + + + + + + + + NSwagCSharp + + + + $(OpenApiDefaultGeneratorOptions) + + + + + diff --git a/src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets b/src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets new file mode 100644 index 0000000000..bd7006fc36 --- /dev/null +++ b/src/Mvc/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets @@ -0,0 +1,149 @@ + + + + + + _GetMetadataForOpenApiReferences; + _GenerateOpenApiReferenceCode; + _CreateCompileItemsForOpenApiReferences + + + _GenerateErrorsForOldItems; + _CreateOpenApiReferenceItemsForOpenApiProjectReferences; + GenerateOpenApiReferenceCode + + + + + + + + + NU1702 + false + + + true + + + + + + <_Temporary Remove="@(_Temporary)" /> + + + + + + + + + <_Temporary Remove="@(_Temporary)" /> + + + + + + + + <_Temporary Remove="@(_Temporary)" /> + + + + + + + + + + <_Temporary Remove="@(_Temporary)" /> + + + + + + + + + + + + + + + + + + <_Files Remove="@(_Files)" /> + <_Files Include="@(OpenApiReference -> '%(OutputPath)')" + Condition="$([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))"> + $([System.IO.Path]::GetExtension('%(OpenApiReference.OutputPath)')) + + <_Directories Remove="@(_Directories)" /> + <_Directories Include="@(OpenApiReference -> '%(OutputPath)')" + Condition="Exists('%(OpenApiReference.OutputPath)') AND ! $([System.IO.File]::Exists('%(OpenApiReference.OutputPath)'))" /> + + + + %(_Files.FullPath) + + + + %(OpenApiReference.FullPath) + + + + + %(_Directories.FullPath) + + + + %(_Directories.FullPath) + + + <_Files Remove="@(_Files)" /> + <_Directories Remove="@(_Directories)" /> + + + + + + + + + + + + + + + diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Design.targets b/src/Mvc/Extensions.ApiDescription.Client/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Client.targets similarity index 67% rename from src/Mvc/Extensions.ApiDescription.Design/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Design.targets rename to src/Mvc/Extensions.ApiDescription.Client/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Client.targets index af5d08a6bb..d085051f06 100644 --- a/src/Mvc/Extensions.ApiDescription.Design/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Design.targets +++ b/src/Mvc/Extensions.ApiDescription.Client/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Client.targets @@ -1,8 +1,8 @@  - + diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/GetProjectReferenceMetadata.cs b/src/Mvc/Extensions.ApiDescription.Design/src/GetProjectReferenceMetadata.cs deleted file mode 100644 index ff9ffcd780..0000000000 --- a/src/Mvc/Extensions.ApiDescription.Design/src/GetProjectReferenceMetadata.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace Microsoft.Extensions.ApiDescription.Tasks -{ - /// - /// Adds or corrects DocumentPath and project-related metadata in ServiceProjectReference items. Also stores final - /// metadata as SerializedMetadata. - /// - public class GetProjectReferenceMetadata : Task - { - private static readonly char[] InvalidFilenameCharacters = Path.GetInvalidFileNameChars(); - private static readonly string[] InvalidFilenameStrings = new[] { ".." }; - - /// - /// Default directory for DocumentPath values. - /// - public string DocumentDirectory { get; set; } - - /// - /// The ServiceFileReference items to update. - /// - [Required] - public ITaskItem[] Inputs { get; set; } - - /// - /// The updated ServiceFileReference items. Will include Namespace and OutputPath metadata. OutputPath metadata - /// will contain full paths. - /// - [Output] - public ITaskItem[] Outputs{ get; set; } - - /// - public override bool Execute() - { - var outputs = new List(Inputs.Length); - var destinations = new HashSet(); - - foreach (var item in Inputs) - { - var newItem = new TaskItem(item); - outputs.Add(newItem); - - var documentGenerator = item.GetMetadata("DocumentGenerator"); - if (string.IsNullOrEmpty(documentGenerator)) - { - // This case occurs when user overrides the default metadata. - Log.LogError(Resources.FormatInvalidEmptyMetadataValue( - "DocumentGenerator", - "ServiceProjectReference", - item.ItemSpec)); - } - - var documentName = item.GetMetadata("DocumentName"); - if (string.IsNullOrEmpty(documentName)) - { - documentName = "v1"; - MetadataSerializer.SetMetadata(newItem, "DocumentName", documentName); - } - - var documentPath = item.GetMetadata("DocumentPath"); - if (string.IsNullOrEmpty(documentPath)) - { - // No need to sanitize the filename since the project file exists. - var projectFilename = item.GetMetadata("Filename"); - - // Default document filename matches project filename unless given a non-default document name. - if (string.IsNullOrEmpty(documentName)) - { - // This is an odd (but allowed) case that would break the sanitize one-liner below. Also, - // ensure chosen name does not match the "v1" case. - documentPath = projectFilename + "_.json"; - } - else if (string.Equals("v1", documentName, StringComparison.Ordinal)) - { - documentPath = projectFilename + ".json"; - } - else - { - // Sanitize the document name because it may contain almost any character, including illegal - // filename characters such as '/' and '?'. (Do not treat slashes as folder separators.) - var sanitizedDocumentName = string.Join("_", documentName.Split(InvalidFilenameCharacters)); - while (sanitizedDocumentName.Contains(InvalidFilenameStrings[0])) - { - sanitizedDocumentName = string.Join( - ".", - sanitizedDocumentName.Split(InvalidFilenameStrings, StringSplitOptions.None)); - } - - documentPath = $"{projectFilename}_{sanitizedDocumentName}"; - - // Possible the document path already ends with .json. Don't duplicate that or a final period. - if (!documentPath.EndsWith(".json", StringComparison.OrdinalIgnoreCase)) - { - if (documentPath.EndsWith(".", StringComparison.Ordinal)) - { - documentPath += "json"; - } - else - { - documentPath += ".json"; - } - } - } - } - - documentPath = GetFullPath(documentPath); - if (!destinations.Add(documentPath)) - { - // This case may occur when user is experimenting e.g. with multiple generators or options. - // May also occur when user accidentally duplicates DocumentPath metadata. - Log.LogError(Resources.FormatDuplicateProjectDocumentPaths(documentPath)); - } - - MetadataSerializer.SetMetadata(newItem, "DocumentPath", documentPath); - - // Add metadata which may be used as a property and passed to an inner build. - newItem.SetMetadata("SerializedMetadata", MetadataSerializer.SerializeMetadata(newItem)); - } - - Outputs = outputs.ToArray(); - - return !Log.HasLoggedErrors; - } - - private string GetFullPath(string path) - { - if (!Path.IsPathRooted(path)) - { - if (!string.IsNullOrEmpty(DocumentDirectory)) - { - path = Path.Combine(DocumentDirectory, path); - } - - path = Path.GetFullPath(path); - } - - return path; - } - } -} diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.props b/src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.props deleted file mode 100644 index b07edc31d7..0000000000 --- a/src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.props +++ /dev/null @@ -1,124 +0,0 @@ - - - - <_ApiDescriptionTasksAssemblyTarget - Condition="'$(MSBuildRuntimeType)' == 'Core'">netstandard2.0 - <_ApiDescriptionTasksAssemblyTarget - Condition="'$(MSBuildRuntimeType)' != 'Core'">net461 - <_ApiDescriptionTasksAssemblyPath>$(MSBuildThisFileDirectory)/../tasks/$(_ApiDescriptionTasksAssemblyTarget)/Microsoft.Extensions.ApiDescription.Tasks.dll - <_ApiDescriptionTasksAssemblyTarget /> - - - - - - - - true - $([MSBuild]::EnsureTrailingSlash('$(ServiceProjectReferenceDirectory)')) - - true - $([MSBuild]::EnsureTrailingSlash('$(ServiceFileReferenceDirectory)')) - - - - - - - - - Default - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.targets b/src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.targets deleted file mode 100644 index 86d88c74f6..0000000000 --- a/src/Mvc/Extensions.ApiDescription.Design/src/build/Microsoft.Extensions.ApiDescription.Design.targets +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - _GetTargetFrameworkForServiceProjectReferences; - _GetTargetPathForServiceProjectReferences; - _GetMetadataForServiceProjectReferences; - _BuildServiceProjectReferences; - _GenerateServiceProjectReferenceDocuments; - _CreateFileItemsForServiceProjectReferences - - - GenerateServiceProjectReferenceDocuments; - _GetMetadataForServiceFileReferences; - _GenerateServiceFileReferenceCodes; - _CreateCompileItemsForServiceFileReferences - - - - - - - - - <_FullPath>%(ServiceProjectReference.FullPath) - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - <_TargetFrameworks>%(_Temporary.TargetFrameworks) - <_TargetFramework>$(_TargetFrameworks.Split(';')[0]) - - - - $(_TargetFramework) - - <_Temporary Remove="@(_Temporary)" /> - - - - <_FullPath /> - <_TargetFramework /> - <_TargetFrameworks /> - - - - - - - <_FullPath>%(ServiceProjectReference.FullPath) - <_TargetFramework>%(ServiceProjectReference.TargetFramework) - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - <_TargetPath>%(_Temporary.FullPath) - - - - $(_TargetPath) - - <_Temporary Remove="@(_Temporary)" /> - - - - <_FullPath /> - <_TargetPath /> - <_TargetFramework /> - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - - - - - - - - - - - - - - %(ServiceProjectReference.FullPath) - - - - - - - - - - - - - dotnet $(MSBuildThisFileDirectory)/../tools/dotnet-getdocument.dll --project "%(FullPath)" - $(Configuration) - $(GenerateDefaultDocumentDefaultOptions) - - - %(Command) --documentName "%(DocumentName)" --framework %(TargetFramework) --output "%(DocumentPath)" - - - %(Command) --method %(Method) - - - %(Command) --service %(Service) - - - %(Command) --projectExtensionsPath "%(ProjectExtensionsPath)" - - - %(Command) --configuration %(Configuration) %(GenerateDefaultDocumentOptions) - - - - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - <_Temporary Remove="@(_Temporary)" /> - - - - - - - - - - - - - - - - - - - <_Files Remove="@(_Files)" /> - <_Files Include="@(ServiceFileReference -> '%(OutputPath)')" - Condition="$([System.IO.File]::Exists('%(ServiceFileReference.OutputPath)'))"> - $([System.IO.Path]::GetExtension('%(ServiceFileReference.OutputPath)')) - - <_Directories Remove="@(_Directories)" /> - <_Directories Include="@(ServiceFileReference -> '%(OutputPath)')" - Condition="Exists('%(ServiceFileReference.OutputPath)') AND ! $([System.IO.File]::Exists('%(ServiceFileReference.OutputPath)'))" /> - - - - - %(_Files.FullPath) - - - - - %(ServiceFileReference.FullPath) - - - - - - %(_Directories.FullPath) - - - - - %(_Directories.FullPath) - - - <_Files Remove="@(_Files)" /> - <_Directories Remove="@(_Directories)" /> - - - - - diff --git a/src/Mvc/Mvc.sln b/src/Mvc/Mvc.sln index 0c31683b2e..a7f901a861 100644 --- a/src/Mvc/Mvc.sln +++ b/src/Mvc/Mvc.sln @@ -85,7 +85,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-getdocument", "dotne EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GetDocumentInsider", "GetDocumentInsider\src\GetDocumentInsider.csproj", "{2F683CF8-B055-46AE-BF83-9D1307F8D45F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ApiDescription.Design", "Extensions.ApiDescription.Design\src\Microsoft.Extensions.ApiDescription.Design.csproj", "{34E3C302-B767-40C8-B538-3EE2BD4000C4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ApiDescription.Client", "Extensions.ApiDescription.Client\src\Microsoft.Extensions.ApiDescription.Client.csproj", "{34E3C302-B767-40C8-B538-3EE2BD4000C4}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_dependencies", "_dependencies", "{5FE3048A-E96B-44F8-A7C4-FC590D7E04B4}" EndProject @@ -277,7 +277,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mvc.Analyzers", "Mvc.Analyz EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mvc.Api.Analyzers", "Mvc.Api.Analyzers", "{49887FD5-2E52-4567-929E-9151DC88E4D4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions.ApiDescription.Design", "Extensions.ApiDescription.Design", "{62CF82C1-B75D-4041-A7E9-EF39FF7B885F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions.ApiDescription.Client", "Extensions.ApiDescription.Client", "{62CF82C1-B75D-4041-A7E9-EF39FF7B885F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Core.TestCommon", "shared\Mvc.Core.TestCommon\Microsoft.AspNetCore.Mvc.Core.TestCommon.csproj", "{2906BF70-82BE-4427-870A-E87281D01008}" EndProject