Skip to content

Commit 275bbd7

Browse files
authored
Convert HotChocolate.Templates to csproj-based template package (#9769)
1 parent ac520a9 commit 275bbd7

11 files changed

Lines changed: 54 additions & 42 deletions

.build/Build.Environment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ partial class Build
1919
AbsolutePath CoverageReportDirectory => OutputDirectory / "coverage-reports";
2020
AbsolutePath PackageDirectory => OutputDirectory / "packages";
2121
AbsolutePath HotChocolateDirectoryBuildProps => SourceDirectory / "HotChocolate" / "Directory.Build.Props";
22-
AbsolutePath TemplatesNuSpec => RootDirectory / "templates" / "HotChocolate.Templates.nuspec";
22+
AbsolutePath TemplatesProj => RootDirectory / "templates" / "HotChocolate.Templates.csproj";
2323
AbsolutePath EmptyServer12Proj => RootDirectory / "templates" / "server" / "HotChocolate.Template.Server.csproj";
2424
AbsolutePath EmptyAzf12Proj => RootDirectory / "templates" / "azure-function" / "HotChocolate.Template.AzureFunctions.csproj";
2525
AbsolutePath Gateway13Proj => RootDirectory / "templates" / "gateway" / "HotChocolate.Template.Gateway.csproj";

.build/Build.Publish.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
using Nuke.Common.IO;
55
using Nuke.Common.Tooling;
66
using Nuke.Common.Tools.DotNet;
7-
using Nuke.Common.Tools.NuGet;
87
using static Nuke.Common.Tools.DotNet.DotNetTasks;
98
using static Helpers;
10-
using static Nuke.Common.Tools.NuGet.NuGetTasks;
119

1210
partial class Build
1311
{
@@ -68,14 +66,14 @@ partial class Build
6866
.Produces(PackageDirectory / "*.snupkg")
6967
.Executes(() =>
7068
{
71-
var projFile = File.ReadAllText(EmptyServer12Proj);
72-
File.WriteAllText(EmptyServer12Proj, projFile.Replace("14.0.0-preview.build.0", SemVersion));
73-
74-
projFile = File.ReadAllText(EmptyAzf12Proj);
75-
File.WriteAllText(EmptyAzf12Proj, projFile.Replace("14.0.0-preview.build.0", SemVersion));
69+
var projFile = File.ReadAllText(EmptyAzf12Proj);
70+
File.WriteAllText(EmptyAzf12Proj, projFile.Replace("0.0.0-placeholder", SemVersion));
7671

7772
projFile = File.ReadAllText(Gateway13Proj);
78-
File.WriteAllText(Gateway13Proj, projFile.Replace("14.0.0-preview.build.0", SemVersion));
73+
File.WriteAllText(Gateway13Proj, projFile.Replace("0.0.0-placeholder", SemVersion));
74+
75+
projFile = File.ReadAllText(EmptyServer12Proj);
76+
File.WriteAllText(EmptyServer12Proj, projFile.Replace("0.0.0-placeholder", SemVersion));
7977

8078
DotNetBuildSonarSolution(
8179
PackSolutionFile,
@@ -108,11 +106,11 @@ partial class Build
108106
.SetAssemblyVersion(Version)
109107
.SetVersion(SemVersion));
110108

111-
NuGetPack(c => c
112-
.SetVersion(SemVersion)
113-
.SetOutputDirectory(PackageDirectory)
109+
DotNetPack(c => c
110+
.SetProject(TemplatesProj)
114111
.SetConfiguration(Configuration)
115-
.CombineWith(t => t.SetTargetPath(TemplatesNuSpec)));
112+
.SetOutputDirectory(PackageDirectory)
113+
.SetVersion(SemVersion));
116114
});
117115

118116
Target Publish => _ => _

.build/Build.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
</ItemGroup>
2121

2222
<ItemGroup>
23-
<PackageDownload Include="NuGet.CommandLine" Version="[6.5.0]" />
2423
<PackageDownload Include="dotnet-sonarscanner" Version="[5.13.0]" />
2524
<PackageDownload Include="OpenCover" Version="[4.7.1221]" />
2625
<PackageDownload Include="ReportGenerator" Version="[5.1.20]" />
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PackageType>Template</PackageType>
5+
<PackageId>HotChocolate.Templates</PackageId>
6+
<Description>Hot Chocolate GraphQL templates.</Description>
7+
<Authors>Michael Staib</Authors>
8+
<PackageIcon>hotchocolate-signet.png</PackageIcon>
9+
10+
<TargetFramework>netstandard2.0</TargetFramework>
11+
12+
<IncludeContentInPack>true</IncludeContentInPack>
13+
<IncludeBuildOutput>false</IncludeBuildOutput>
14+
<ContentTargetFolders>content</ContentTargetFolders>
15+
<NoWarn>$(NoWarn);NU5128</NoWarn>
16+
<NoDefaultExcludes>true</NoDefaultExcludes>
17+
18+
<GenerateDocumentationFile>false</GenerateDocumentationFile>
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<Compile Remove="**\*" />
23+
<Content Include="azure-function\**\*;gateway\**\*;server\**\*"
24+
Exclude="**\bin\**;**\obj\**" />
25+
<None Include="..\website\static\resources\hotchocolate-signet.png"
26+
Pack="true"
27+
PackagePath=""
28+
Visible="false" />
29+
</ItemGroup>
30+
31+
</Project>

templates/HotChocolate.Templates.nuspec

Lines changed: 0 additions & 16 deletions
This file was deleted.

templates/azure-function/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"description": "Target .NET 10"
3333
}
3434
],
35-
"replaces": "net8.0",
35+
"replaces": "net10.0",
3636
"defaultValue": "net10.0"
3737
}
3838
},

templates/azure-function/HotChocolate.Template.AzureFunctions.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net10.0</TargetFramework>
44
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
55
<OutputType>Exe</OutputType>
66
<Nullable>enable</Nullable>
@@ -18,8 +18,8 @@
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
1919
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
2020
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
21-
<PackageReference Include="HotChocolate.AzureFunctions.IsolatedProcess" Version="14.0.0-preview.build.0" />
22-
<PackageReference Include="HotChocolate.Types.Analyzers" Version="14.0.0-preview.build.0">
21+
<PackageReference Include="HotChocolate.AzureFunctions.IsolatedProcess" Version="0.0.0-placeholder" />
22+
<PackageReference Include="HotChocolate.Types.Analyzers" Version="0.0.0-placeholder">
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2424
<PrivateAssets>all</PrivateAssets>
2525
</PackageReference>

templates/gateway/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"description": "Target .NET 10"
3333
}
3434
],
35-
"replaces": "net8.0",
35+
"replaces": "net10.0",
3636
"defaultValue": "net10.0"
3737
}
3838
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="HotChocolate.Fusion.AspNetCore" Version="14.0.0-preview.build.0" />
10+
<PackageReference Include="HotChocolate.Fusion.AspNetCore" Version="0.0.0-placeholder" />
1111
</ItemGroup>
1212

1313
</Project>

templates/server/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"description": "Target .NET 10"
3333
}
3434
],
35-
"replaces": "net8.0",
35+
"replaces": "net10.0",
3636
"defaultValue": "net10.0"
3737
}
3838
},

0 commit comments

Comments
 (0)