Skip to content

Check CouldNotFindPluginEntryClass when use dependency injection #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ private void Execute(SourceProductionContext spc,
var optimizationLevel = compilation.Options.OptimizationLevel;
var useDI = configOptions.GetFLLUseDependencyInjection();

PluginClassInfo pluginInfo = null;
if (!useDI)
{
pluginInfo = GetValidPluginInfo(pluginClasses, spc);
}
var pluginInfo = GetValidPluginInfo(pluginClasses, spc, useDI);

GenerateSource(
spc,
Expand Down Expand Up @@ -463,7 +459,8 @@ private static PluginClassInfo GetPluginClassInfo(GeneratorSyntaxContext context

private static PluginClassInfo GetValidPluginInfo(
ImmutableArray<PluginClassInfo> pluginClasses,
SourceProductionContext context)
SourceProductionContext context,
bool useDI)
{
// If p is null, this class does not implement IPluginI18n
var iPluginI18nClasses = pluginClasses.Where(p => p != null).ToArray();
Expand All @@ -476,6 +473,13 @@ private static PluginClassInfo GetValidPluginInfo(
return null;
}

// If we use dependency injection, we do not need to check if there is a valid plugin context
// Also we do not need to return the plugin info
if (useDI)
{
return null;
}

// If p.PropertyName is null, this class does not have PluginInitContext property
var iPluginI18nClassesWithContext = iPluginI18nClasses.Where(p => p.PropertyName != null).ToArray();
if (iPluginI18nClassesWithContext.Length == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ProjectReference Include="..\Flow.Launcher.Localization.Analyzers\Flow.Launcher.Localization.Analyzers.csproj">
<PrivateAssets>All</PrivateAssets>
</ProjectReference>
<ProjectReference Include="..\Flow.Launcher.Localization.Shared\Flow.Launcher.Localization.Shared.csproj" >
<ProjectReference Include="..\Flow.Launcher.Localization.Shared\Flow.Launcher.Localization.Shared.csproj">
<PrivateAssets>All</PrivateAssets>
</ProjectReference>
<ProjectReference Include="..\Flow.Launcher.Localization.SourceGenerators\Flow.Launcher.Localization.SourceGenerators.csproj">
Expand Down
Loading