Skip to content

Commit 723ce63

Browse files
committed
remove embedded source gen since it behaves different on windows
1 parent 1834248 commit 723ce63

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<PackageVersion Include="AWSSDK.Core" Version="4.0.0.2" />
1717
<PackageVersion Include="AWSSDK.SQS" Version="4.0.0.1" />
1818
<PackageVersion Include="AWSSDK.S3" Version="4.0.0.1" />
19-
<PackageVersion Include="Chorn.EmbeddedResourceAccessGenerator" Version="1.1.5" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
2019
<PackageVersion Include="FakeItEasy" Version="8.3.0" />
2120
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.11.3" />
2221
<PackageVersion Include="Microsoft.OpenApi" Version="2.0.0-preview9" />

src/Elastic.Documentation.Configuration/ConfigurationFileProvider.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ namespace Elastic.Documentation.Configuration;
1010
public class ConfigurationFileProvider
1111
{
1212
private readonly IFileSystem _fileSystem;
13+
private readonly string _assemblyName;
1314

1415
public ConfigurationFileProvider(IFileSystem fileSystem)
1516
{
1617
_fileSystem = fileSystem;
18+
_assemblyName = typeof(ConfigurationFileProvider).Assembly.GetName().Name!;
1719
TemporaryDirectory = fileSystem.Directory.CreateTempSubdirectory("docs-builder-config");
1820

19-
VersionFile = CreateTemporaryConfigurationFile(EmbeddedResource.______config_versions_yml);
20-
AssemblerFile = CreateTemporaryConfigurationFile(EmbeddedResource.______config_assembler_yml);
21-
NavigationFile = CreateTemporaryConfigurationFile(EmbeddedResource.______config_navigation_yml);
22-
LegacyUrlMappingsFile = CreateTemporaryConfigurationFile(EmbeddedResource.______config_legacy_url_mappings_yml);
21+
VersionFile = CreateTemporaryConfigurationFile("versions.yml");
22+
AssemblerFile = CreateTemporaryConfigurationFile("assembler.yml");
23+
NavigationFile = CreateTemporaryConfigurationFile("navigation.yml");
24+
LegacyUrlMappingsFile = CreateTemporaryConfigurationFile("legacy-url-mappings.yml");
2325
}
2426

2527
private IDirectoryInfo TemporaryDirectory { get; }
@@ -32,30 +34,28 @@ public ConfigurationFileProvider(IFileSystem fileSystem)
3234

3335
public IFileInfo LegacyUrlMappingsFile { get; }
3436

35-
private IFileInfo CreateTemporaryConfigurationFile(EmbeddedResource resource)
37+
private IFileInfo CreateTemporaryConfigurationFile(string fileName)
3638
{
37-
var fileName = string.Join(".", resource.GetResourceName().Split('.')[^2..]);
38-
using var stream = GetLocalOrEmbedded(resource);
39+
using var stream = GetLocalOrEmbedded(fileName);
3940
var context = stream.ReadToEnd();
4041
var fi = _fileSystem.FileInfo.New(Path.Combine(TemporaryDirectory.FullName, fileName));
4142
_fileSystem.File.WriteAllText(fi.FullName, context);
4243
return fi;
4344
}
4445

45-
private StreamReader GetLocalOrEmbedded(EmbeddedResource resource)
46+
private StreamReader GetLocalOrEmbedded(string fileName)
4647
{
47-
var fileName = string.Join(".", resource.GetResourceName().Split('.')[^2..]);
4848
var configPath = GetLocalPath(fileName);
4949
if (!_fileSystem.File.Exists(configPath))
50-
return GetEmbeddedStream(resource);
50+
return GetEmbeddedStream(fileName);
5151
var reader = _fileSystem.File.OpenText(configPath);
5252
return reader;
5353
}
5454

55-
private static StreamReader GetEmbeddedStream(EmbeddedResource resource)
55+
private StreamReader GetEmbeddedStream(string fileName)
5656
{
57-
var name = resource.GetResourceName().Replace(".......config.", ".");
58-
var resourceStream = typeof(EmbeddedResource).Assembly.GetManifestResourceStream(name)!;
57+
var resourceName = $"{_assemblyName}.{fileName}";
58+
var resourceStream = typeof(ConfigurationFileProvider).Assembly.GetManifestResourceStream(resourceName)!;
5959
var reader = new StreamReader(resourceStream, leaveOpen: false);
6060
return reader;
6161
}

src/Elastic.Documentation.Configuration/Elastic.Documentation.Configuration.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Chorn.EmbeddedResourceAccessGenerator" />
1514
<PackageReference Include="DotNet.Glob" />
1615
<PackageReference Include="Samboy063.Tomlet" />
1716
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator"/>

0 commit comments

Comments
 (0)