Skip to content

Commit

Permalink
fix: only consider .json additionalfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
kl1mm committed Mar 31, 2022
1 parent b668d87 commit cd7d136
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/kli.Localize.Example/kli.Localize.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions src/kli.Localize.Generator/LocalizeCodeGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using kli.Localize.Generator.Internal;
using System;
using System.Linq;
using kli.Localize.Generator.Internal;
using Microsoft.CodeAnalysis;

namespace kli.Localize.Generator
Expand All @@ -20,7 +22,8 @@ public void Execute(GeneratorExecutionContext context)

var translationReader = new TranslationReader(context.ReportDiagnostic);
var codeGenerator = new LocalizeCodeGeneratorCore(translationReader);
foreach (var file in context.AdditionalFiles)
var additionalFiles = context.AdditionalFiles.Where(af => af.Path.EndsWith(".json", StringComparison.OrdinalIgnoreCase));
foreach (var file in additionalFiles)
{
var namespaceResolver = new NamespaceResolver(file.Path, context.Compilation.AssemblyName,
context.AnalyzerConfigOptions.GlobalOptions.TryGetValue);
Expand Down
2 changes: 1 addition & 1 deletion src/kli.Localize.Test/kli.Localize.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down

0 comments on commit cd7d136

Please sign in to comment.