Skip to content

Commit 91df44d

Browse files
committed
fix: unfuck template and example run process
1 parent b9ccaa9 commit 91df44d

11 files changed

Lines changed: 34 additions & 73 deletions

File tree

Directory.Build.targets

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<!-- Remove Flowthru PackageReferences -->
2020
<PackageReference Remove="Flowthru" />
2121
<PackageReference Remove="Flowthru.Extensions.Python" />
22+
<PackageReference Remove="Flowthru.Extensions.EFCore" />
2223
<PackageReference Remove="Flowthru.Misc.ML" />
2324

2425
<!-- Add Flowthru ProjectReferences -->
@@ -43,10 +44,14 @@
4344
to Flowthru.Extensions.Python get a ProjectReference to the local source instead.
4445
We match on directory path so the condition is explicit, not inferred.
4546
-->
46-
<ItemGroup Condition="$(MSBuildProjectDirRelativePath.StartsWith('examples\starter\KedroIrisPython')) OR $(MSBuildProjectDirRelativePath.StartsWith('examples\starter\KedroSpaceflightsPython'))">
47+
<ItemGroup Condition="$(MSBuildProjectDirRelativePath.Contains('KedroIrisPython')) OR $(MSBuildProjectDirRelativePath.Contains('KedroSpaceflightsPython'))">
4748
<ProjectReference Include="$(RepoRoot)src\extensions\Flowthru.Extensions.Python\Flowthru.Extensions.Python.csproj" />
4849
</ItemGroup>
4950

51+
<ItemGroup Condition="$(MSBuildProjectDirRelativePath.Contains('SpaceflightsEFCore'))">
52+
<ProjectReference Include="$(RepoRoot)src\extensions\Flowthru.Extensions.EFCore\Flowthru.Extensions.EFCore.csproj" />
53+
</ItemGroup>
54+
5055
<!-- Special case for Flowthru.Tests.Common: also convert PackageReference but keep existing SourceGenerators ProjectReference -->
5156
<ItemGroup Condition="'$(MSBuildProjectName)' == 'Flowthru.Tests.Common'">
5257
<PackageReference Remove="Flowthru" />
@@ -64,8 +69,9 @@
6469
</ItemGroup>
6570

6671
<ItemGroup Condition="($(MSBuildProjectDirRelativePath.StartsWith('examples')) OR $(MSBuildProjectDirRelativePath.StartsWith('tests'))) AND Exists('$(RepoRoot)src\core\Flowthru.FUnit\Flowthru.FUnit.csproj') AND '$(MSBuildProjectName)' != 'Flowthru.FUnit'">
67-
<!-- Replace PackageReference to Flowthru.FUnit with in-repo sources where applicable.
68-
The Exists() on the PackageReference Remove above gates whether any replacement is needed. -->
72+
<!-- Replace PackageReference to Flowthru.FUnit with in-repo sources where applicable. -->
73+
<ProjectReference Include="$(RepoRoot)src\core\Flowthru.FUnit\Flowthru.FUnit.csproj"
74+
Condition="$(MSBuildProjectDirRelativePath.Contains('FUnit'))" />
6975
<ProjectReference Include="$(RepoRoot)src\core\Flowthru.FUnit.SourceGenerators\Flowthru.FUnit.SourceGenerators.csproj"
7076
ReferenceOutputAssembly="false"
7177
OutputItemType="Analyzer"

examples/starter/KedroIris/KedroIris.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>
99

10-
<!-- Flowthru reference: ProjectReference when building from source, PackageReference for templates -->
11-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
12-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
13-
</ItemGroup>
14-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
10+
<ItemGroup>
1511
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
1612
</ItemGroup>
1713

examples/starter/KedroIrisFUnit/KedroIrisFUnit.csproj

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,8 @@
1515
<DefineConstants>$(DefineConstants);FUNIT_ENABLED</DefineConstants>
1616
</PropertyGroup>
1717

18-
<!-- Flowthru core reference: ProjectReference when building from source, PackageReference for templates -->
19-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
20-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
21-
</ItemGroup>
22-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
18+
<ItemGroup>
2319
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
24-
</ItemGroup>
25-
26-
<!-- FUnit: step testing library — source generator and code fixes are wired
27-
automatically via Flowthru.FUnit.targets when referencing from source,
28-
or via the NuGet analyzers/dotnet/cs layout when using the package. -->
29-
<ItemGroup Condition="Exists('../../../src/core/Flowthru.FUnit/Flowthru.FUnit.csproj')">
30-
<ProjectReference Include="../../../src/core/Flowthru.FUnit/Flowthru.FUnit.csproj" />
31-
</ItemGroup>
32-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru.FUnit/Flowthru.FUnit.csproj')">
3320
<PackageReference Include="Flowthru.FUnit" Version="FlowthruVersion" />
3421
</ItemGroup>
3522

examples/starter/KedroIrisPython/KedroIrisPython.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
<RootNamespace>KedroIrisPython</RootNamespace>
1111
</PropertyGroup>
1212

13-
<!-- Flowthru reference: ProjectReference when building from source, PackageReference for templates -->
14-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
15-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
16-
<ProjectReference Include="../../../src/extensions/Flowthru.Extensions.Python/Flowthru.Extensions.Python.csproj" />
17-
</ItemGroup>
18-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
13+
<ItemGroup>
1914
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
2015
<PackageReference Include="Flowthru.Extensions.Python" Version="FlowthruVersion" />
2116
</ItemGroup>

examples/starter/KedroSpaceflights/KedroSpaceflights.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

10-
<!-- Flowthru reference: ProjectReference when building from source, PackageReference for templates -->
11-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
12-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
13-
</ItemGroup>
14-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
10+
<ItemGroup>
1511
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
1612
</ItemGroup>
1713

examples/starter/KedroSpaceflightsFUnit/KedroSpaceflightsFUnit.csproj

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,8 @@
1515
<DefineConstants>$(DefineConstants);FUNIT_ENABLED</DefineConstants>
1616
</PropertyGroup>
1717

18-
<!-- Flowthru core reference: ProjectReference when building from source, PackageReference for templates -->
19-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
20-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
21-
</ItemGroup>
22-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
18+
<ItemGroup>
2319
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
24-
</ItemGroup>
25-
26-
<!-- FUnit: step testing library — source generator and code fixes are wired
27-
automatically via Flowthru.FUnit.targets when referencing from source,
28-
or via the NuGet analyzers/dotnet/cs layout when using the package. -->
29-
<ItemGroup Condition="Exists('../../../src/core/Flowthru.FUnit/Flowthru.FUnit.csproj')">
30-
<ProjectReference Include="../../../src/core/Flowthru.FUnit/Flowthru.FUnit.csproj" />
31-
</ItemGroup>
32-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru.FUnit/Flowthru.FUnit.csproj')">
3320
<PackageReference Include="Flowthru.FUnit" Version="FlowthruVersion" />
3421
</ItemGroup>
3522

examples/starter/KedroSpaceflightsPython/KedroSpaceflightsPython.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
<RootNamespace>KedroSpaceflightsPython</RootNamespace>
1111
</PropertyGroup>
1212

13-
<!-- Flowthru reference: ProjectReference when building from source, PackageReference for templates -->
14-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
15-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
16-
<ProjectReference Include="../../../src/extensions/Flowthru.Extensions.Python/Flowthru.Extensions.Python.csproj" />
17-
</ItemGroup>
18-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
13+
<ItemGroup>
1914
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
2015
<PackageReference Include="Flowthru.Extensions.Python" Version="FlowthruVersion" />
2116
</ItemGroup>

examples/starter/Minimal/Minimal.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>
99

10-
<!-- Flowthru reference: ProjectReference when building from source, PackageReference for templates -->
11-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
12-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
13-
</ItemGroup>
14-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
10+
<ItemGroup>
1511
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
1612
</ItemGroup>
1713

examples/starter/SpaceflightsEFCore/SpaceflightsEFCore.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

10-
<!-- Flowthru reference: ProjectReference when building from source, PackageReference for templates -->
11-
<ItemGroup Condition="Exists('../../../src/core/Flowthru/Flowthru.csproj')">
12-
<ProjectReference Include="../../../src/core/Flowthru/Flowthru.csproj" />
13-
<ProjectReference Include="../../../src/extensions/Flowthru.Extensions.EFCore/Flowthru.Extensions.EFCore.csproj" />
14-
</ItemGroup>
15-
<ItemGroup Condition="!Exists('../../../src/core/Flowthru/Flowthru.csproj')">
10+
<ItemGroup>
1611
<PackageReference Include="Flowthru" Version="FlowthruVersion" />
1712
<PackageReference Include="Flowthru.Extensions.EFCore" Version="FlowthruVersion" />
1813
</ItemGroup>

src/extensions/Flowthru.Extensions.Python.SourceGenerators/PythonStepGenerator.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,23 @@ public class PythonStepGenerator : IIncrementalGenerator
2828
/// <inheritdoc/>
2929
public void Initialize(IncrementalGeneratorInitializationContext context)
3030
{
31-
// Run for any project that references Flowthru.Extensions.Python
32-
// (unlike FlowBuilderGenerator which only runs for the core Flowthru assembly)
33-
context.RegisterPostInitializationOutput(ctx => GenerateAddPythonStep(ctx));
31+
// These overloads are pre-compiled into Flowthru.Extensions.Python.dll, so they must
32+
// only be generated during the extension's own build — not for consumer projects.
33+
// Re-emitting them via the analyzer on consumers produces duplicate partial-class
34+
// declarations that cause CS0121 (ambiguous call) at every AddPythonStep call site.
35+
context.RegisterSourceOutput(
36+
context.CompilationProvider,
37+
(ctx, compilation) =>
38+
{
39+
if (compilation.AssemblyName != "Flowthru.Extensions.Python")
40+
return;
41+
42+
GenerateAddPythonStep(ctx);
43+
}
44+
);
3445
}
3546

36-
private static void GenerateAddPythonStep(IncrementalGeneratorPostInitializationContext context)
47+
private static void GenerateAddPythonStep(SourceProductionContext context)
3748
{
3849
var sb = new StringBuilder();
3950

0 commit comments

Comments
 (0)