Skip to content

Commit 6181263

Browse files
authored
Update SHFB tools (#48)
* Updates - update HelpFileBuilder - Fix some errors and warnings after update - improve ReadMe * update shfb tools path * Follow SHFB migration guide After update there were some breaking changes. Files were updated accordingly (see: https://ewsoftware.github.io/SHFB/html/bc933f8f-e792-45bf-afec-62aa2c46aa3b.htm) * use older NET SDK Since latest NET9 broke some NET8 features, try to use an older SDK * Pin SDK via global.json * correct NET version. the pinned didn't exist * Using different sdks for different projects * Set working directory for restoring workloads
1 parent 0afc1dc commit 6181263

File tree

16 files changed

+152
-87
lines changed

16 files changed

+152
-87
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,42 @@ jobs:
1414
- uses: actions/checkout@v2
1515
with:
1616
submodules: true
17+
18+
- name: Install .NET 8 SDK
19+
uses: actions/setup-dotnet@v3
20+
with:
21+
dotnet-version: '8.x'
22+
1723
- uses: actions/setup-dotnet@v3
1824
with:
19-
dotnet-version: '9.0.x'
25+
dotnet-version: '9.x'
26+
2027
- uses: actions/setup-node@v3
2128
with:
2229
node-version: 22.14
30+
2331
- uses: pnpm/action-setup@v4
2432
with:
2533
version: 10.8.0
34+
2635
- name: workloads 1
27-
run: dotnet workload restore ext/Avalonia/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj
36+
working-directory: ./ext/Avalonia/src/
37+
run: dotnet workload restore ./iOS/Avalonia.iOS/Avalonia.iOS.csproj
38+
2839
- name: workloads 2
29-
run: dotnet workload restore ext/Avalonia/src/Android/Avalonia.Android/Avalonia.Android.csproj
40+
working-directory: ./ext/Avalonia/src/
41+
run: dotnet workload restore ./Android/Avalonia.Android/Avalonia.Android.csproj
42+
3043
- name: Run build script
3144
run: ./build.ps1 -pack
32-
- name: find
33-
shell: bash
34-
run: find ./artifacts.zip
45+
3546
- name: Upload SFHB result temporarily as atifact
3647
uses: actions/upload-artifact@v4
3748
with:
3849
name: website-artifact
3950
path: ./artifacts.zip
4051
retention-days: 1
52+
4153
docusaurus_deploy_job:
4254
runs-on: ubuntu-latest
4355
name: Build website
@@ -48,20 +60,26 @@ jobs:
4860
with:
4961
name: website-artifact
5062
path: ./website/
63+
5164
- uses: actions/setup-node@v3
5265
with:
5366
node-version: 22.14
67+
5468
- uses: pnpm/action-setup@v4
5569
with:
5670
version: 10.8.0
71+
5772
- name: Run build script
5873
working-directory: ./website/
5974
run: bash ./build.sh --build
75+
6076
- name: Install dependencies
6177
run: sudo apt-get update; sudo apt-get install -y rsync
78+
6279
- name: Setup key
6380
working-directory: ./website/
6481
run: echo '${{ secrets.DEPLOY_KEY }}' > ./upload.key && chmod 700 ./upload.key
82+
6583
- name: Build And Deploy
6684
working-directory: ./website/
6785
run: ./deploy.sh ${{ vars.DEPLOY_HOST }} ${{ vars.DEPLOY_PORT }} ${{ vars.DEPLOY_USER }}

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@ It is important to mind the build order.
2020
> .\build.ps1 -preview
2121
> ```
2222
23+
## Updating the Sandcastle tools
24+
25+
> [WARNING] if you update the SHFB-nuget packages you also need to update the tools path in `build.ps1`
26+
> ```ps1
27+
> # set SHFBRoot
28+
> $env:SHFBRoot = ".\src\packages\ewsoftware.shfb\2025.9.30\tools\"
29+
> ```
30+
31+
2332
## Generate the API docs for newer Avalonia version
24-
Use the `set-version.ps1` script to update the version.
33+
Use the `update-submodule.ps1` script to update the version to the latest stable. if you need any other branch version, you need to link the branch name for the submodule by hand.
2534
26-
```ps1
27-
# -version: specify the Avalonia version to document. If this parameter is not set, `AvaloniaVersion.txt` will be used instead.
28-
.\set-version.ps1 11.2.0
29-
```
35+
> [!NOTE]
36+
> The file `./ext/Avalonia/build/SharedVersion.props` stores the current version info.
3037
3138
> [!WARNING]
3239
> Remember to commit all updates made to the submodule.

build.ps1

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ New-item ./website/AvaloniaVersion.txt -ItemType File -Value $version -Force
2020
Write-Host "Avalonia version is $version"
2121

2222
# set SHFBRoot
23-
$env:SHFBRoot = ".\src\packages\ewsoftware.shfb\2025.3.22\tools\"
23+
$env:SHFBRoot = ".\src\packages\ewsoftware.shfb\2025.9.30\tools\"
2424

2525
# Define a list of dotNET projects to build
2626
$projectsToBuild = @(
@@ -69,24 +69,49 @@ $projectsToBuild = @(
6969
"src/ApiDocumentation/ApiDocumentation.shfbproj"
7070
)
7171

72-
foreach ($proj in $projectsToBuild){
73-
dotnet build $proj -c Release
74-
Write-Host "`n built $proj" -ForegroundColor DarkGreen -BackgroundColor Gray
75-
Write-Host "`n"
72+
foreach ($proj in $projectsToBuild)
73+
{
74+
# Ensure dotnet resolves global.json relative to the project by changing into the project's directory
75+
$projDir = Split-Path $proj -Parent
76+
$projFile = Split-Path $proj -Leaf
77+
78+
if (-not [string]::IsNullOrEmpty($projDir))
79+
{
80+
Push-Location $projDir
81+
try
82+
{
83+
Write-Host "Building $projFile in directory $( Get-Location )..."
84+
dotnet build ".\$projFile" -c Release
85+
}
86+
finally
87+
{
88+
Pop-Location
89+
}
90+
}
91+
else
92+
{
93+
# project is in repository root
94+
Write-Information "Building $projFile in repository root..."
95+
dotnet build ".\$projFile" -c Release
96+
}
97+
98+
Write-Information "`n built $projFile"
99+
Write-Information "`n"
76100
}
77101

102+
78103
# preview the website if preview switch is on
79104
if($preview.IsPresent){
80-
pushd ./website
105+
Push-Location ./website
81106
./build.ps1 -preview
82-
popd
107+
Pop-Location
83108
}
84109

85110
# build the website if build switch is on
86111
if($build.IsPresent){
87-
pushd ./website
112+
Push-Location ./website
88113
./build.ps1 -build
89-
popd
114+
Pop-Location
90115
}
91116

92117
# pack the md-files and version settings if pack switch is on

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "9.*"
4+
}
5+
}

src/ApiDocumentation/ApiDocumentation.shfbproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@
135135
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' " />
136136
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' " />
137137
<ItemGroup>
138-
<PackageReference Include="EWSoftware.SHFB" Version="2025.03.22"/>
139-
<PackageReference Include="EWSoftware.SHFB.NET" Version="9.0.0"/>
138+
<PackageReference Include="EWSoftware.SHFB" Version="2025.9.30" />
139+
<PackageReference Include="EWSoftware.SHFB.NET" Version="10.0.0" />
140140
</ItemGroup>
141141
<!-- Import the common build targets during NuGet restore because before the packages are being installed, $(SHFBROOT) is not set yet -->
142142
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="'$(MSBuildRestoreSessionId)' != ''"/>

src/AvaloniaAttributesPlugin/AvaloniaAttributesPlugIn.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
using SandcastleBuilder.Utils.BuildComponent;
2-
using SandcastleBuilder.Utils.BuildEngine;
31
using System;
42
using System.Collections.Generic;
53
using System.IO;
64
using System.Linq;
75
using System.Text.RegularExpressions;
86
using System.Xml.Linq;
97
using System.Xml.XPath;
8+
using Sandcastle.Core.BuildEngine;
9+
using Sandcastle.Core.PlugIn;
1010

1111
namespace AvaloniaAttributes
1212
{
@@ -36,7 +36,7 @@ public sealed class AvaloniaAttributesPlugIn : IPlugIn
3636

3737
private List<ExecutionPoint>? _executionPoints;
3838

39-
private BuildProcess? _builder;
39+
private IBuildProcess? _builder;
4040

4141
//=====================================================================
4242

@@ -61,7 +61,7 @@ public IEnumerable<ExecutionPoint> ExecutionPoints
6161
/// </summary>
6262
/// <param name="buildProcess">A reference to the current build process</param>
6363
/// <param name="configuration">The configuration data that the plug-in should use to initialize itself</param>
64-
public void Initialize(BuildProcess buildProcess, XElement configuration)
64+
public void Initialize(IBuildProcess buildProcess, XElement configuration)
6565
{
6666
_builder = buildProcess;
6767

src/AvaloniaAttributesPlugin/AvaloniaAttributesPlugIn.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@
6262
</ItemGroup>
6363

6464
<ItemGroup>
65-
<PackageReference Include="System.ComponentModel.Composition" Version="9.0.3" />
66-
<PackageReference Include="EWSoftware.Sandcastle.Core" Version="2025.3.22" />
67-
<PackageReference Include="EWSoftware.SandcastleBuilder.Utils" Version="2025.3.22" />
65+
<PackageReference Include="System.ComponentModel.Composition" Version="9.0.10" />
66+
<PackageReference Include="EWSoftware.Sandcastle.Core" Version="2025.9.30" />
6867
</ItemGroup>
6968

7069
<!-- TODO: If you have a project with configuration forms, you can include it in this package by

src/DocusaurusExportPlugin/DocusaurusContentGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
using System.Xml;
2525
using System.Xml.Linq;
2626
using DocusaurusExportPlugin.Sidebar;
27-
using SandcastleBuilder.Utils.BuildEngine;
27+
using Sandcastle.Core.BuildEngine;
2828

2929
namespace DocusaurusExportPlugin
3030
{
@@ -40,7 +40,7 @@ public class DocusaurusContentGenerator
4040

4141
private static readonly MatchEvaluator MeDecodeEntities = m => WebUtility.HtmlDecode(m.Value);
4242

43-
private readonly BuildProcess _buildProcess;
43+
private readonly IBuildProcess _buildProcess;
4444
private readonly string _workingFolder;
4545

4646
//=====================================================================
@@ -49,7 +49,7 @@ public class DocusaurusContentGenerator
4949
/// Constructor
5050
/// </summary>
5151
/// <param name="buildProcess">The build process to use</param>
52-
public DocusaurusContentGenerator(BuildProcess buildProcess)
52+
public DocusaurusContentGenerator(IBuildProcess buildProcess)
5353
{
5454
_buildProcess = buildProcess ?? throw new ArgumentNullException(nameof(buildProcess));
5555

src/DocusaurusExportPlugin/DocusaurusExportPluginPlugIn.cs renamed to src/DocusaurusExportPlugin/DocusaurusExportPlugIn.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
using System.Linq;
55
using System.Text.Json;
66
using System.Xml.Linq;
7-
8-
using SandcastleBuilder.Utils.BuildComponent;
9-
using SandcastleBuilder.Utils.BuildEngine;
7+
using Sandcastle.Core.BuildEngine;
8+
using Sandcastle.Core.PlugIn;
109

1110
namespace DocusaurusExportPlugin
1211
{
@@ -30,13 +29,13 @@ namespace DocusaurusExportPlugin
3029
/// dispose of them when the container is disposed of.</remarks>
3130
[HelpFileBuilderPlugInExport("DocusaurusExport", Version = AssemblyInfo.ProductVersion,
3231
Copyright = AssemblyInfo.Copyright, Description = "DocusaurusExport plug-in")]
33-
public sealed class DocusaurusExportPluginPlugIn : IPlugIn
32+
public sealed class DocusaurusExportPlugIn : IPlugIn
3433
{
3534
//=====================================================================
3635

3736
private List<ExecutionPoint>? _executionPoints;
3837

39-
private BuildProcess? _builder;
38+
private IBuildProcess? _builder;
4039

4140
/// <summary>
4241
/// Gets a dictionary with the mapping between the AssemblyName and the nuget package
@@ -68,7 +67,7 @@ public IEnumerable<ExecutionPoint> ExecutionPoints
6867
/// </summary>
6968
/// <param name="buildProcess">A reference to the current build process</param>
7069
/// <param name="configuration">The configuration data that the plug-in should use to initialize itself</param>
71-
public void Initialize(BuildProcess buildProcess, XElement configuration)
70+
public void Initialize(IBuildProcess buildProcess, XElement configuration)
7271
{
7372
_builder = buildProcess;
7473

@@ -101,7 +100,7 @@ public void Execute(ExecutionContext context)
101100
/// This handles garbage collection to ensure proper disposal of the plug-in if not done explicitly
102101
/// with <see cref="Dispose()"/>.
103102
/// </summary>
104-
~DocusaurusExportPluginPlugIn()
103+
~DocusaurusExportPlugIn()
105104
{
106105
this.Dispose();
107106
}

src/DocusaurusExportPlugin/DocusaurusExportPlugin.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
</ItemGroup>
6464

6565
<ItemGroup>
66-
<PackageReference Include="System.ComponentModel.Composition" Version="9.0.3" />
67-
<PackageReference Include="EWSoftware.Sandcastle.Core" Version="2025.3.22" />
68-
<PackageReference Include="EWSoftware.SandcastleBuilder.Utils" Version="2025.3.22" />
66+
<PackageReference Include="System.ComponentModel.Composition" Version="9.0.10" />
67+
<PackageReference Include="System.Text.Json" Version="9.0.10" />
68+
<PackageReference Include="EWSoftware.Sandcastle.Core" Version="2025.9.30" />
6969
</ItemGroup>
7070

7171
<!-- TODO: If you have a project with configuration forms, you can include it in this package by

0 commit comments

Comments
 (0)