|
1 | 1 | <Project Sdk="Microsoft.NET.Sdk"> |
2 | | - <PropertyGroup> |
3 | | - <OutputType>Exe</OutputType> |
4 | | - <NoWarn>EPC12;CA1303;CA1515</NoWarn> |
5 | | - <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> |
6 | | - <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Example.ruleset</CodeAnalysisRuleSet> |
7 | | - <WarningsNotAsErrors>CA1303</WarningsNotAsErrors> |
8 | | - <EnableLqlTranspile>true</EnableLqlTranspile> |
9 | | - </PropertyGroup> |
| 2 | + <PropertyGroup> |
| 3 | + <OutputType>Exe</OutputType> |
| 4 | + <NoWarn>EPC12;CA1303;CA1515</NoWarn> |
| 5 | + <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> |
| 6 | + <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Example.ruleset</CodeAnalysisRuleSet> |
| 7 | + <WarningsNotAsErrors>CA1303</WarningsNotAsErrors> |
| 8 | + <EnableLqlTranspile>true</EnableLqlTranspile> |
| 9 | + </PropertyGroup> |
10 | 10 |
|
11 | | - <!-- Exclude Generated folder from default globbing - we include it explicitly in the target --> |
12 | | - <ItemGroup> |
13 | | - <Compile Remove="Generated/**" /> |
14 | | - </ItemGroup> |
| 11 | + <!-- Exclude Generated folder from default globbing - we include it explicitly in the target --> |
| 12 | + <ItemGroup> |
| 13 | + <Compile Remove="Generated/**" /> |
| 14 | + </ItemGroup> |
15 | 15 |
|
| 16 | + <ItemGroup> |
| 17 | + <ProjectReference Include="../DataProvider/DataProvider.csproj" /> |
| 18 | + <ProjectReference Include="../../Lql/Lql.SQLite/Lql.SQLite.csproj" /> |
| 19 | + <ProjectReference Include="../../Other/Selecta/Selecta.csproj" /> |
| 20 | + <ProjectReference Include="../../Migration/Migration/Migration.csproj" /> |
| 21 | + <ProjectReference Include="../../Migration/Migration.SQLite/Migration.SQLite.csproj" /> |
| 22 | + </ItemGroup> |
| 23 | + <ItemGroup> |
| 24 | + <PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.3" /> |
| 25 | + </ItemGroup> |
| 26 | + <ItemGroup> |
| 27 | + <AdditionalFiles Include="GetInvoices.sql" /> |
| 28 | + <AdditionalFiles Include="GetInvoices.grouping.json" /> |
| 29 | + <AdditionalFiles Include="GetOrders.sql" /> |
| 30 | + <AdditionalFiles Include="GetOrders.grouping.json" /> |
| 31 | + <AdditionalFiles Include="GetCustomersLql.lql" /> |
| 32 | + <AdditionalFiles Include="GetCustomersLql.grouping.json" /> |
| 33 | + <AdditionalFiles Include="DataProvider.json" /> |
| 34 | + </ItemGroup> |
| 35 | + |
| 36 | + <!-- YAML schema is source of truth, stored in git --> |
| 37 | + <ItemGroup> |
| 38 | + <Content Include="example-schema.yaml"> |
| 39 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| 40 | + </Content> |
| 41 | + </ItemGroup> |
| 42 | + |
| 43 | + <!-- Create database from YAML using Migration.Cli (YAML stored in git) --> |
| 44 | + <Target Name="CreateDatabaseSchema" BeforeTargets="TranspileLqlAndGenerateDataProvider"> |
| 45 | + <Exec |
| 46 | + Command="dotnet run --project "$(MSBuildThisFileDirectory)../../Migration/Migration.Cli/Migration.Cli.csproj" -- --schema "$(MSBuildProjectDirectory)/example-schema.yaml" --output "$(MSBuildProjectDirectory)/invoices.db" --provider sqlite" |
| 47 | + WorkingDirectory="$(MSBuildProjectDirectory)" |
| 48 | + StandardOutputImportance="High" |
| 49 | + StandardErrorImportance="High" |
| 50 | + /> |
| 51 | + </Target> |
| 52 | + |
| 53 | + <!-- Pre-compile: transpile LQL to SQL, then generate C# from SQL using external CLI --> |
| 54 | + <Target |
| 55 | + Name="TranspileLqlAndGenerateDataProvider" |
| 56 | + BeforeTargets="BeforeCompile;CoreCompile" |
| 57 | + Inputs="$(MSBuildProjectDirectory)/DataProvider.json;@(AdditionalFiles);@(LqlFiles)" |
| 58 | + Outputs="$(MSBuildProjectDirectory)/Generated/.timestamp" |
| 59 | + > |
| 60 | + <!-- Clean and recreate Generated folder to avoid stale files --> |
| 61 | + <RemoveDir Directories="$(MSBuildProjectDirectory)/Generated" /> |
| 62 | + <MakeDir Directories="$(MSBuildProjectDirectory)/Generated" /> |
| 63 | + <!-- Transpile each .lql to .sql into project directory (or Intermediate) --> |
16 | 64 | <ItemGroup> |
17 | | - <ProjectReference Include="../DataProvider/DataProvider.csproj" /> |
18 | | - <ProjectReference Include="../../Lql/Lql.SQLite/Lql.SQLite.csproj" /> |
19 | | - <ProjectReference Include="../../Other/Selecta/Selecta.csproj" /> |
20 | | - <ProjectReference Include="../../Migration/Migration/Migration.csproj" /> |
21 | | - <ProjectReference Include="../../Migration/Migration.SQLite/Migration.SQLite.csproj" /> |
22 | | - </ItemGroup> |
23 | | - <ItemGroup> |
24 | | - <PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.3" /> |
25 | | - </ItemGroup> |
26 | | - <ItemGroup> |
27 | | - <AdditionalFiles Include="GetInvoices.sql" /> |
28 | | - <AdditionalFiles Include="GetInvoices.grouping.json" /> |
29 | | - <AdditionalFiles Include="GetOrders.sql" /> |
30 | | - <AdditionalFiles Include="GetOrders.grouping.json" /> |
31 | | - <AdditionalFiles Include="GetCustomersLql.lql" /> |
32 | | - <AdditionalFiles Include="GetCustomersLql.grouping.json" /> |
33 | | - <AdditionalFiles Include="DataProvider.json" /> |
| 65 | + <LqlFiles Include="$(MSBuildProjectDirectory)/**/*.lql" /> |
34 | 66 | </ItemGroup> |
35 | | - |
36 | | - <!-- YAML schema is source of truth, stored in git --> |
| 67 | + <Message Importance="High" Text="Transpiling LQL files (@(LqlFiles))" /> |
| 68 | + <Exec |
| 69 | + Command="dotnet run --project $(MSBuildProjectDirectory)/../../Lql/LqlCli.SQLite/LqlCli.SQLite.csproj -- --input "%(LqlFiles.Identity)" --output "%(LqlFiles.RootDir)%(LqlFiles.Directory)%(LqlFiles.Filename).generated.sql"" |
| 70 | + Condition="'$(EnableLqlTranspile)' == 'true' and @(LqlFiles) != ''" |
| 71 | + WorkingDirectory="$(MSBuildProjectDirectory)" |
| 72 | + StandardOutputImportance="High" |
| 73 | + StandardErrorImportance="High" |
| 74 | + ContinueOnError="WarnAndContinue" |
| 75 | + /> |
| 76 | + <!-- Run SQLite generator CLI to emit .g.cs into Generated folder --> |
| 77 | + <Exec |
| 78 | + Command="dotnet run --project $(MSBuildThisFileDirectory)../DataProvider.SQLite.Cli/DataProvider.SQLite.Cli.csproj -- --project-dir "$(MSBuildProjectDirectory)" --config "$(MSBuildProjectDirectory)/DataProvider.json" --out "$(MSBuildProjectDirectory)/Generated"" |
| 79 | + WorkingDirectory="$(MSBuildProjectDirectory)" |
| 80 | + StandardOutputImportance="High" |
| 81 | + StandardErrorImportance="High" |
| 82 | + IgnoreExitCode="true" |
| 83 | + /> |
| 84 | + <Touch Files="$(MSBuildProjectDirectory)/Generated/.timestamp" AlwaysCreate="true" /> |
37 | 85 | <ItemGroup> |
38 | | - <Content Include="example-schema.yaml"> |
39 | | - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
40 | | - </Content> |
| 86 | + <Compile Include="$(MSBuildProjectDirectory)/Generated/**/*.g.cs" /> |
41 | 87 | </ItemGroup> |
42 | | - |
43 | | - <!-- Create database from YAML using Migration.Cli (YAML stored in git) --> |
44 | | - <Target Name="CreateDatabaseSchema" BeforeTargets="TranspileLqlAndGenerateDataProvider"> |
45 | | - <Exec Command='dotnet run --project "$(MSBuildThisFileDirectory)../../Migration/Migration.Cli/Migration.Cli.csproj" -- --schema "$(MSBuildProjectDirectory)/example-schema.yaml" --output "$(MSBuildProjectDirectory)/invoices.db" --provider sqlite' WorkingDirectory='$(MSBuildProjectDirectory)' StandardOutputImportance='High' StandardErrorImportance='High' /> |
46 | | - </Target> |
47 | | - |
48 | | - <!-- Pre-compile: transpile LQL to SQL, then generate C# from SQL using external CLI --> |
49 | | - <Target Name="TranspileLqlAndGenerateDataProvider" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildProjectDirectory)/DataProvider.json;@(AdditionalFiles);@(LqlFiles)" Outputs="$(MSBuildProjectDirectory)/Generated/.timestamp"> |
50 | | - <!-- Clean and recreate Generated folder to avoid stale files --> |
51 | | - <RemoveDir Directories="$(MSBuildProjectDirectory)/Generated" /> |
52 | | - <MakeDir Directories="$(MSBuildProjectDirectory)/Generated" /> |
53 | | - <!-- Transpile each .lql to .sql into project directory (or Intermediate) --> |
54 | | - <ItemGroup> |
55 | | - <LqlFiles Include="$(MSBuildProjectDirectory)/**/*.lql" /> |
56 | | - </ItemGroup> |
57 | | - <Message Importance="High" Text="Transpiling LQL files (@(LqlFiles))" /> |
58 | | - <Exec Command='dotnet run --project $(MSBuildProjectDirectory)/../../Lql/LqlCli.SQLite/LqlCli.SQLite.csproj -- --input "%(LqlFiles.Identity)" --output "%(LqlFiles.RootDir)%(LqlFiles.Directory)%(LqlFiles.Filename).generated.sql"' Condition="'$(EnableLqlTranspile)' == 'true' and @(LqlFiles) != ''" WorkingDirectory='$(MSBuildProjectDirectory)' StandardOutputImportance='High' StandardErrorImportance='High' ContinueOnError="WarnAndContinue" /> |
59 | | - <!-- Run SQLite generator CLI to emit .g.cs into Generated folder --> |
60 | | - <Exec Command='dotnet run --project $(MSBuildThisFileDirectory)../DataProvider.SQLite.Cli/DataProvider.SQLite.Cli.csproj -- --project-dir "$(MSBuildProjectDirectory)" --config "$(MSBuildProjectDirectory)/DataProvider.json" --out "$(MSBuildProjectDirectory)/Generated"' WorkingDirectory='$(MSBuildProjectDirectory)' StandardOutputImportance='High' StandardErrorImportance='High' IgnoreExitCode='true' /> |
61 | | - <Touch Files="$(MSBuildProjectDirectory)/Generated/.timestamp" AlwaysCreate="true" /> |
62 | | - <ItemGroup> |
63 | | - <Compile Include="$(MSBuildProjectDirectory)/Generated/**/*.g.cs" /> |
64 | | - </ItemGroup> |
65 | | - </Target> |
| 88 | + </Target> |
66 | 89 | </Project> |
0 commit comments