зеркало из https://github.com/microsoft/kiota.git
Revert "Merge pull request #5025 from microsoft/andrueastman/defaultIcons"
This reverts commit44d61a4645
, reversing changes made to1983ca4d02
.
This commit is contained in:
Родитель
3195be42d1
Коммит
de19798659
Двоичные данные
resources/color.png
Двоичные данные
resources/color.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 7.8 KiB |
Двоичные данные
resources/outline.png
Двоичные данные
resources/outline.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 512 B |
|
@ -29,7 +29,6 @@
|
|||
<AssemblyOriginatorKeyFile>..\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
|
||||
<IsTrimmable>true</IsTrimmable>
|
||||
<AnalysisMode>All</AnalysisMode>
|
||||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- the source generators emit warnings -->
|
||||
|
@ -50,8 +49,7 @@
|
|||
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.6.17" />
|
||||
<PackageReference Include="Microsoft.Plugins.Manifest" Version="0.0.7-preview" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.8" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.0.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="15.1.2" />
|
||||
<ProjectReference Include="..\Kiota.Generated\KiotaGenerated.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -60,8 +58,4 @@
|
|||
<ItemGroup>
|
||||
<None Include="../../README.md" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="../../resources/color.png" />
|
||||
<EmbeddedResource Include="../../resources/outline.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
@ -12,7 +11,6 @@ using Kiota.Builder.Configuration;
|
|||
using Kiota.Builder.Extensions;
|
||||
using Kiota.Builder.OpenApiExtensions;
|
||||
using Kiota.Builder.Plugins.Models;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Kiota.Abstractions.Extensions;
|
||||
using Microsoft.OpenApi.ApiManifest;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
@ -116,8 +114,6 @@ public partial class PluginsGenerationService
|
|||
}
|
||||
}
|
||||
|
||||
private const string ColorFileName = "color.png";
|
||||
private const string OutlineFileName = "outline.png";
|
||||
[GeneratedRegex(@"[^a-zA-Z0-9_]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, 2000)]
|
||||
private static partial Regex PluginNameCleanupRegex();
|
||||
|
||||
|
@ -159,16 +155,6 @@ public partial class PluginsGenerationService
|
|||
if (manifestModelFromFile != null)
|
||||
manifestModel = manifestModelFromFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The manifest file did not exist, so setup any dependencies needed.
|
||||
// If it already existed, the user has setup them up in another way.
|
||||
|
||||
// 1. Check if icons exist and write them out.
|
||||
var embeddedProvider = new EmbeddedFileProvider(Assembly.GetExecutingAssembly());
|
||||
await CopyResourceFileToDirectoryIfNotExistsAsync(ColorFileName, embeddedProvider, cancellationToken).ConfigureAwait(false);
|
||||
await CopyResourceFileToDirectoryIfNotExistsAsync(OutlineFileName, embeddedProvider, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
manifestModel.CopilotExtensions ??= new CopilotExtensions();// ensure its not null.
|
||||
|
||||
|
@ -189,18 +175,7 @@ public partial class PluginsGenerationService
|
|||
|
||||
return manifestModel;
|
||||
}
|
||||
private async Task CopyResourceFileToDirectoryIfNotExistsAsync(string fileName, EmbeddedFileProvider embeddedProvider, CancellationToken cancellationToken)
|
||||
{
|
||||
var targetPath = Path.Combine(Configuration.OutputPath, fileName);
|
||||
if (!File.Exists(targetPath))
|
||||
{
|
||||
#pragma warning disable CA2007
|
||||
await using var reader = embeddedProvider.GetFileInfo(fileName).CreateReadStream();
|
||||
await using var defaultColorFile = File.Open(targetPath, FileMode.Create);
|
||||
#pragma warning restore CA2007
|
||||
await reader.CopyToAsync(defaultColorFile, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
internal static readonly AppManifestModelGenerationContext AppManifestModelGenerationContext = new(new JsonSerializerOptions
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
|
|
|
@ -95,8 +95,6 @@ paths:
|
|||
Assert.True(File.Exists(Path.Combine(outputDirectory, OpenAIPluginFileName)));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, $"{expectedPluginName.ToLower()}-openapi.yml")));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, AppManifestFileName)));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, "color.png")));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, "outline.png")));
|
||||
|
||||
// Validate the v2 plugin
|
||||
var manifestContent = await File.ReadAllTextAsync(Path.Combine(outputDirectory, $"{expectedPluginName.ToLower()}-apiplugin.json"));
|
||||
|
@ -509,8 +507,6 @@ paths:
|
|||
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, ManifestFileName)));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, OpenApiFileName)));
|
||||
Assert.False(File.Exists(Path.Combine(outputDirectory, "color.png"))); // manifest already existed and specifed the path to a file, so we did not add it.
|
||||
Assert.False(File.Exists(Path.Combine(outputDirectory, "outline.png")));// manifest already existed and specifed the path to a file, so we did not add it.
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, "manifest.json")));// Assert manifest exists after generation
|
||||
|
||||
// Validate the manifest file
|
||||
|
@ -644,8 +640,6 @@ paths:
|
|||
Assert.True(File.Exists(Path.Combine(outputDirectory, ManifestFileName)));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, OpenApiFileName)));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, "manifest.json")));// Assert manifest exists after generation
|
||||
Assert.False(File.Exists(Path.Combine(outputDirectory, "color.png"))); // manifest already existed and specifed the path to a file, so we did not add it.
|
||||
Assert.False(File.Exists(Path.Combine(outputDirectory, "outline.png")));// manifest already existed and specifed the path to a file, so we did not add it.
|
||||
|
||||
// Validate the manifest file
|
||||
var appManifestFile = await File.ReadAllTextAsync(Path.Combine(outputDirectory, AppManifestFileName));
|
||||
|
@ -751,8 +745,6 @@ components:
|
|||
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, ManifestFileName)));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, OpenApiFileName)));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, "color.png")));
|
||||
Assert.True(File.Exists(Path.Combine(outputDirectory, "outline.png")));
|
||||
|
||||
// Validate the v2 plugin
|
||||
var manifestContent = await File.ReadAllTextAsync(Path.Combine(outputDirectory, ManifestFileName));
|
||||
|
|
Загрузка…
Ссылка в новой задаче