Skip to content
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
1 change: 0 additions & 1 deletion .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"enum": [
"Clean",
"Compile",
"CopyFiles",
"CreatePackage",
"Default",
"Package",
Expand Down
27 changes: 16 additions & 11 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,32 @@ The orchestrator is NUKE (`nuke/Build.cs`), bootstrapped by `build.ps1` / `build
```powershell
.\build.ps1 # restore, compile, run the full test suite
.\build.ps1 -Target Compile # other targets: Clean Restore Compile RunUnitTests
.\build.ps1 -Target Package # CopyFiles CreatePackage Package PrePublish Publish
.\build.ps1 -Target Package # CreatePackage Package PrePublish Publish
```

For the normal edit/test loop use the SDK directly — much faster than the NUKE bootstrap:

```powershell
dotnet build src/AngleSharp.Js.sln
dotnet test src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj -f net8.0
dotnet test src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj -f net8.0 --filter "FullyQualifiedName~InstanceOfTests"
dotnet test src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj -f net8.0 --filter "Name=WindowIsAnInstanceOfWindow"
dotnet test src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj -f net10.0
dotnet test src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj -f net10.0 --filter "FullyQualifiedName~InstanceOfTests"
dotnet test src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj -f net10.0 --filter "Name=WindowIsAnInstanceOfWindow"
```

- Always pass `-f net8.0` when iterating. On Windows both projects also target `net462` and
`net472`, so omitting it runs everything three times.
- Always pass `-f net10.0` when iterating. On Windows the test project also targets `net462`
and `net472`, so omitting it runs everything three times.
- `TreatWarningsAsErrors` is on (`src/Directory.Build.props`) — a warning breaks the build.
There is no separate lint step; the compiler is it.
- The package version is parsed from the top entry of `CHANGELOG.md` (`ReleaseNotesParser`),
not from a csproj property. Release-worthy changes get a `CHANGELOG.md` line.
- Package versions are centralized in `src/Directory.Packages.props` (CPM is on), so a
`PackageReference` in a csproj carries no `Version`. AngleSharp and Jint are deliberately
stated as ranges: `dotnet pack` publishes them verbatim as the package's dependency ranges.
- The package version is parsed from the top entry of `CHANGELOG.md` (`ReleaseNotesParser`)
and passed to the build as `-p:Version`. Release-worthy changes get a `CHANGELOG.md` line.
`AssemblyVersion` is pinned to `1.0.0.0` so the strong-name identity survives that.
- `RunUnitTests` runs the suite twice, differing only in a `prefetched` environment variable
that nothing in this repo currently reads — a single run is equivalent locally.
- There is no `global.json`; the bootstrap scripts use the STS channel, CI installs 10.0.x.
- There is deliberately no `global.json` — the repository does not restrict the SDK version. The
bootstrap scripts use the STS channel, CI installs 10.0.x.

## Architecture

Expand Down Expand Up @@ -154,8 +159,8 @@ Concrete .NET techniques that apply here:
caches, and `Engine.PrepareScript` moves parsing and static analysis off the run path.

Constraint worth knowing before reaching for a newer BCL API: the library targets
`netstandard2.0`, `net462`, `net472` and `net8.0`, and takes no dependency beyond AngleSharp
and Jint. `Span<T>`, `MemoryExtensions`, `ArrayPool<T>` and friends are therefore **not**
`netstandard2.0`, `net462`, `net472`, `net8.0` and `net10.0`, and takes no dependency beyond
AngleSharp and Jint. `Span<T>`, `MemoryExtensions`, `ArrayPool<T>` and friends are therefore **not**
available unconditionally — they would need a `System.Memory` package reference or a
`#if NET8_0_OR_GREATER` guard, so weigh that against the actual gain. `LangVersion` is
`latest`, so modern C# *syntax* is always fine.
Expand Down
55 changes: 23 additions & 32 deletions nuke/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitHub;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Utilities.Collections;
using Octokit;
using Octokit.Internal;
Expand All @@ -15,7 +14,6 @@
using System.IO;
using System.Linq;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.NuGet.NuGetTasks;
using Project = Nuke.Common.ProjectModel.Project;

class Build : NukeBuild
Expand Down Expand Up @@ -46,8 +44,6 @@ class Build : NukeBuild

AbsolutePath SourceDirectory => RootDirectory / "src";

AbsolutePath BuildDirectory => SourceDirectory / TargetProjectName / "bin" / Configuration;

AbsolutePath ResultDirectory => RootDirectory / "bin" / Version;

AbsolutePath NugetDirectory => ResultDirectory / "nuget";
Expand Down Expand Up @@ -141,6 +137,8 @@ protected override void OnBuildInitialized()
var settings = s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetVersion(Version)
.SetContinuousIntegrationBuild(IsServerBuild)
.EnableNoRestore();

if (!String.IsNullOrEmpty(AngleSharpVersion))
Expand All @@ -161,6 +159,7 @@ protected override void OnBuildInitialized()
var settings = s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetProperty("Version", Version)
.EnableNoRestore()
.EnableNoBuild();

Expand All @@ -173,39 +172,30 @@ protected override void OnBuildInitialized()
});
});

Target CopyFiles => _ => _
// The package is produced by `dotnet pack` straight from the project, so the dependency
// groups follow the actual TargetFrameworks instead of a hand-maintained nuspec.
Target CreatePackage => _ => _
.DependsOn(Compile)
.Executes(() =>
{
foreach (var item in TargetFrameworks)
DotNetPack(s =>
{
var targetDir = NugetDirectory / "lib" / item;
var srcDir = BuildDirectory / item;

(srcDir / $"{TargetProjectName}.dll").Copy(targetDir / $"{TargetProjectName}.dll", ExistsPolicy.FileOverwriteIfNewer);
(srcDir / $"{TargetProjectName}.pdb").Copy(targetDir / $"{TargetProjectName}.pdb", ExistsPolicy.FileOverwriteIfNewer);
(srcDir / $"{TargetProjectName}.xml").Copy(targetDir / $"{TargetProjectName}.xml", ExistsPolicy.FileOverwriteIfNewer);
}
var settings = s
.SetProject(TargetProject)
.SetConfiguration(Configuration)
.SetVersion(Version)
.SetOutputDirectory(NugetDirectory)
.SetContinuousIntegrationBuild(IsServerBuild)
.EnableNoRestore()
.EnableNoBuild();

(SourceDirectory / $"{TargetProjectName}.nuspec").Copy(NugetDirectory / $"{TargetProjectName}.nuspec", ExistsPolicy.FileOverwriteIfNewer);
(RootDirectory / "logo.png").Copy(NugetDirectory / "logo.png", ExistsPolicy.FileOverwriteIfNewer);
(RootDirectory / "README.md").Copy(NugetDirectory / "README.md", ExistsPolicy.FileOverwriteIfNewer);
});
if (!String.IsNullOrEmpty(AngleSharpVersion))
{
settings = settings.SetProperty("AngleSharpVersion", AngleSharpVersion);
}

Target CreatePackage => _ => _
.DependsOn(CopyFiles)
.Executes(() =>
{
var nuspec = NugetDirectory / $"{TargetProjectName}.nuspec";

NuGetPack(_ => _
.SetTargetPath(nuspec)
.SetVersion(Version)
.SetOutputDirectory(NugetDirectory)
.SetSymbols(true)
.SetSymbolPackageFormat("snupkg")
.AddProperty("Configuration", Configuration)
);
return settings;
});
});

Target PublishPackage => _ => _
Expand All @@ -221,9 +211,10 @@ protected override void OnBuildInitialized()
throw new BuildAbortedException("Could not resolve the NuGet API key.");
}

// Pushing the .nupkg also uploads the matching .snupkg next to it.
foreach (var nupkg in NugetDirectory.GlobFiles("*.nupkg"))
{
NuGetPush(s => s
DotNetNuGetPush(s => s
.SetTargetPath(nupkg)
.SetSource("https://api.nuget.org/v3/index.json")
.SetApiKey(apiKey));
Expand Down
7 changes: 2 additions & 5 deletions nuke/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="10.0.0" />
<PackageReference Include="Nuke.Common" Version="10.1.0" />
<!-- Transitive pins for advisories in Nuke.Common's dependency graph. -->
<PackageReference Include="NuGet.Packaging" Version="6.12.5" PrivateAssets="All" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.10" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageDownload Include="NuGet.CommandLine" Version="[6.12.5]" />
</ItemGroup>

</Project>
22 changes: 10 additions & 12 deletions src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net462;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <!-- https://github.com/Tyrrrz/GitHubActionsTestLogger/issues/5 -->
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\AngleSharp.Js\AngleSharp.Js.csproj">
<TargetFramework>netstandard2.0</TargetFramework>
</ProjectReference>
<ProjectReference Include="..\AngleSharp.Js\AngleSharp.Js.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Fixtures\Html5Test\**\*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AngleSharp.Io" Version="1.0.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1">
<PackageReference Include="AngleSharp.Css" />
<PackageReference Include="AngleSharp.Io" />
<PackageReference Include="AngleSharp.Xml" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="GitHubActionsTestLogger">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="AngleSharp.Css" Version="1.0.0" />
<PackageReference Include="AngleSharp.Xml" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>
</Project>
7 changes: 0 additions & 7 deletions src/AngleSharp.Js.Tests/Properties/AssemblyInfo.cs

This file was deleted.

45 changes: 0 additions & 45 deletions src/AngleSharp.Js.nuspec

This file was deleted.

16 changes: 0 additions & 16 deletions src/AngleSharp.Js.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,10 @@ Global
{4ED5A0B3-AE7A-40B6-BBAC-FF408D6C6BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4ED5A0B3-AE7A-40B6-BBAC-FF408D6C6BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4ED5A0B3-AE7A-40B6-BBAC-FF408D6C6BC3}.Release|Any CPU.Build.0 = Release|Any CPU
{73856B9E-967D-44AA-A644-91CBBE75BF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73856B9E-967D-44AA-A644-91CBBE75BF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73856B9E-967D-44AA-A644-91CBBE75BF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73856B9E-967D-44AA-A644-91CBBE75BF9D}.Release|Any CPU.Build.0 = Release|Any CPU
{9136D59F-9F50-4E02-96B2-3EAC114B95FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9136D59F-9F50-4E02-96B2-3EAC114B95FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9136D59F-9F50-4E02-96B2-3EAC114B95FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9136D59F-9F50-4E02-96B2-3EAC114B95FA}.Release|Any CPU.Build.0 = Release|Any CPU
{18B0B97B-8795-4DC2-A1E7-8070255BE718}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18B0B97B-8795-4DC2-A1E7-8070255BE718}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18B0B97B-8795-4DC2-A1E7-8070255BE718}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18B0B97B-8795-4DC2-A1E7-8070255BE718}.Release|Any CPU.Build.0 = Release|Any CPU
{2BEBF4AD-1660-43A6-B452-109716F42FA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BEBF4AD-1660-43A6-B452-109716F42FA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BEBF4AD-1660-43A6-B452-109716F42FA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BEBF4AD-1660-43A6-B452-109716F42FA6}.Release|Any CPU.Build.0 = Release|Any CPU
{14AC7A32-E4E4-4ADF-A81A-030FC90E1BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14AC7A32-E4E4-4ADF-A81A-030FC90E1BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14AC7A32-E4E4-4ADF-A81A-030FC90E1BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14AC7A32-E4E4-4ADF-A81A-030FC90E1BB6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
29 changes: 20 additions & 9 deletions src/AngleSharp.Js/AngleSharp.Js.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,37 @@
<TargetFrameworks>netstandard2.0;net8.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net462;net472</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Label="Packaging">
<PackageProjectUrl>https://anglesharp.github.io</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>html;html5;css;css3;dom;javascript;scripting;library;js;scripts;runtime;jint;anglesharp;angle</PackageTags>
<PackageReleaseNotes>https://github.com/AngleSharp/AngleSharp.Js/blob/master/CHANGELOG.md</PackageReleaseNotes>
<RepositoryUrl>https://github.com/AngleSharp/AngleSharp.Js</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<AngleSharpVersion>1.*</AngleSharpVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="AngleSharp" />
<PackageReference Include="Jint" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AngleSharp" Version="$(AngleSharpVersion)" />
<PackageReference Include="Jint" Version="4.15.3" />
<None Include="$(MSBuildThisFileDirectory)..\..\logo.png" Pack="true" PackagePath="\" Visible="false" />
<None Include="$(MSBuildThisFileDirectory)..\..\README.md" Pack="true" PackagePath="\" Visible="false" />
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<DelaySign>false</DelaySign>
</PropertyGroup>
</Project>
<ItemGroup>
<InternalsVisibleTo Include="AngleSharp.Js.Tests" Key="002400000480000094000000060200000024000052534131000400000100010001adf274fa2b375134e8e4558d606f1a0f96f5cd0c6b99970f7cce9887477209d7c29f814e2508d8bd2526e99e8cd273bd1158a3984f1ea74830ec5329a77c6ff201a15edeb8b36ab046abd1bce211fe8dbb076d7d806f46b15bfda44def04ead0669971e96c5f666c9eda677f28824fff7aa90d32929ed91d529a7a41699893" />
<AssemblyAttribute Include="System.Runtime.InteropServices.ComVisibleAttribute">
<_Parameter1>false</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Project>
7 changes: 0 additions & 7 deletions src/AngleSharp.Js/Properties/AssemblyInfo.cs

This file was deleted.

Loading
Loading