diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 83a628f..29c138d 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -26,7 +26,6 @@ "enum": [ "Clean", "Compile", - "CopyFiles", "CreatePackage", "Default", "Package", diff --git a/AGENTS.md b/AGENTS.md index f78f1f2..4b369dd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 @@ -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`, `MemoryExtensions`, `ArrayPool` and friends are therefore **not** +`netstandard2.0`, `net462`, `net472`, `net8.0` and `net10.0`, and takes no dependency beyond +AngleSharp and Jint. `Span`, `MemoryExtensions`, `ArrayPool` 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. diff --git a/nuke/Build.cs b/nuke/Build.cs index 45b59dd..f1dc816 100644 --- a/nuke/Build.cs +++ b/nuke/Build.cs @@ -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; @@ -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 @@ -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"; @@ -141,6 +137,8 @@ protected override void OnBuildInitialized() var settings = s .SetProjectFile(Solution) .SetConfiguration(Configuration) + .SetVersion(Version) + .SetContinuousIntegrationBuild(IsServerBuild) .EnableNoRestore(); if (!String.IsNullOrEmpty(AngleSharpVersion)) @@ -161,6 +159,7 @@ protected override void OnBuildInitialized() var settings = s .SetProjectFile(Solution) .SetConfiguration(Configuration) + .SetProperty("Version", Version) .EnableNoRestore() .EnableNoBuild(); @@ -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 => _ => _ @@ -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)); diff --git a/nuke/_build.csproj b/nuke/_build.csproj index 5a0000d..0c61074 100644 --- a/nuke/_build.csproj +++ b/nuke/_build.csproj @@ -11,13 +11,10 @@ - + + - - - - diff --git a/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj b/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj index dcf1f90..3081f6f 100644 --- a/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj +++ b/src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj @@ -1,15 +1,13 @@ - net8.0 + net10.0 $(TargetFrameworks);net462;net472 false true - - netstandard2.0 - + @@ -17,16 +15,16 @@ - - + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - diff --git a/src/AngleSharp.Js.Tests/Properties/AssemblyInfo.cs b/src/AngleSharp.Js.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index adac18c..0000000 --- a/src/AngleSharp.Js.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyCopyright("Copyright © AngleSharp, 2013-2019.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/AngleSharp.Js.nuspec b/src/AngleSharp.Js.nuspec deleted file mode 100644 index 180ae03..0000000 --- a/src/AngleSharp.Js.nuspec +++ /dev/null @@ -1,45 +0,0 @@ - - - - AngleSharp.Js - $version$ - AngleSharp - Florian Rappl - MIT - - https://anglesharp.github.io - logo.png - README.md - false - Integrates a JavaScript engine to AngleSharp. - https://github.com/AngleSharp/AngleSharp.Js/blob/master/CHANGELOG.md - Copyright 2017-2026, AngleSharp - html html5 css css3 dom javascript scripting library js scripts runtime jint anglesharp angle - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AngleSharp.Js.sln b/src/AngleSharp.Js.sln index 4ef0c1c..d404747 100644 --- a/src/AngleSharp.Js.sln +++ b/src/AngleSharp.Js.sln @@ -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 diff --git a/src/AngleSharp.Js/AngleSharp.Js.csproj b/src/AngleSharp.Js/AngleSharp.Js.csproj index b5d6194..305b981 100644 --- a/src/AngleSharp.Js/AngleSharp.Js.csproj +++ b/src/AngleSharp.Js/AngleSharp.Js.csproj @@ -3,26 +3,37 @@ netstandard2.0;net8.0;net10.0 $(TargetFrameworks);net462;net472 true + + + + https://anglesharp.github.io + MIT + logo.png + README.md + html;html5;css;css3;dom;javascript;scripting;library;js;scripts;runtime;jint;anglesharp;angle + https://github.com/AngleSharp/AngleSharp.Js/blob/master/CHANGELOG.md https://github.com/AngleSharp/AngleSharp.Js git true true true snupkg - MIT - 1.* - + + - - + + - - false - - \ No newline at end of file + + + + <_Parameter1>false + + + diff --git a/src/AngleSharp.Js/Properties/AssemblyInfo.cs b/src/AngleSharp.Js/Properties/AssemblyInfo.cs deleted file mode 100644 index 68c4f10..0000000 --- a/src/AngleSharp.Js/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyCopyright("Copyright © AngleSharp, 2013-2019")] -[assembly: ComVisible(false)] -[assembly: InternalsVisibleToAttribute("AngleSharp.Js.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010001adf274fa2b375134e8e4558d606f1a0f96f5cd0c6b99970f7cce9887477209d7c29f814e2508d8bd2526e99e8cd273bd1158a3984f1ea74830ec5329a77c6ff201a15edeb8b36ab046abd1bce211fe8dbb076d7d806f46b15bfda44def04ead0669971e96c5f666c9eda677f28824fff7aa90d32929ed91d529a7a41699893")] diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f727b1f..af56551 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,11 +1,31 @@ - - Integrates a JavaScript engine to AngleSharp. + AngleSharp.Js + Integrates a JavaScript engine to AngleSharp. + AngleSharp + Copyright 2017-2026, AngleSharp + + + + 1.0.0 + + + latest - true true - $(MSBuildThisFileDirectory)\Key.snk + true + $(MSBuildThisFileDirectory)Key.snk + + + + + 1.5.0 - \ No newline at end of file + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props new file mode 100644 index 0000000..0d54606 --- /dev/null +++ b/src/Directory.Packages.props @@ -0,0 +1,23 @@ + + + true + + + + + + + + + + + + + + + + + + +