From 2decaae2c528ace1d5d342185a446d4050531f24 Mon Sep 17 00:00:00 2001 From: Jason Naylor Date: Tue, 24 Nov 2026 11:31:32 -0800 Subject: [PATCH] Target netstandard2.0 and net462; publish from CI Convert ExCSS.csproj to an SDK project that targets netstandard2.0 and net462, so SIL.ExCSS can be referenced from .NET Standard and .NET 8 projects. The net40, net45, and net451 assets are dropped. The assembly stays signed with ExCSS.snk and the version becomes 2.1.0. Package with dotnet pack. The SIL.ExCSS metadata moves from NuSpec/SIL.ExCSS.nuspec into the project file, and the .nuget folder and nuget.exe packing are removed. Convert the tests to an SDK project on net462 and net8.0 with NUnit 3. Remove the .NET 3.5 projects. Parser.generated.cs and ParserX.cs were never part of the old project file, so they are excluded from compilation. Add a GitHub Actions workflow that builds, tests, and packs on every push and pull request, and publishes to nuget.org when a tag named v is pushed. Co-Authored-By: Claude --- .github/workflows/build.yml | 56 ++++++ .gitignore | 3 +- .nuget/NuGet.Config | 6 - .nuget/NuGet.targets | 105 ---------- ExCSS.Tests/ExCSS.Tests.csproj | 102 ++-------- ExCSS.Tests/ExCSS.Tests.net35.csproj | 108 ---------- ExCSS.Tests/ExCSS.Tests.net35.t4properties | 10 - ExCSS.Tests/Properties/AssemblyInfo.cs | 35 ---- ExCSS.Tests/packages.config | 4 - ExCSS.sln | 50 +++-- ExCSS/ExCSS.csproj | 219 ++++----------------- ExCSS/ExCSS.net35.csproj | 131 ------------ ExCSS/Properties/AssemblyInfo.cs | 34 ---- NuSpec/SIL.ExCSS.nuspec | 22 --- readme.md | 9 + 15 files changed, 151 insertions(+), 743 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .nuget/NuGet.Config delete mode 100644 .nuget/NuGet.targets delete mode 100644 ExCSS.Tests/ExCSS.Tests.net35.csproj delete mode 100644 ExCSS.Tests/ExCSS.Tests.net35.t4properties delete mode 100644 ExCSS.Tests/Properties/AssemblyInfo.cs delete mode 100644 ExCSS.Tests/packages.config delete mode 100644 ExCSS/ExCSS.net35.csproj delete mode 100644 ExCSS/Properties/AssemblyInfo.cs delete mode 100644 NuSpec/SIL.ExCSS.nuspec diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..8c3aae6d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: build-test + +on: + push: + branches: + - master + tags: + - 'v*' + pull_request: + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + build: + timeout-minutes: 15 + permissions: + contents: read + # Windows is required to run the net462 tests. + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + # A release is a tag named v, where is the value in ExCSS.csproj. + - name: Check that the tag matches the package version + if: startsWith(github.ref, 'refs/tags/v') + run: | + version=$(dotnet msbuild ExCSS/ExCSS.csproj -getProperty:Version) + if [ "v$version" != "$GITHUB_REF_NAME" ]; then + echo "Tag $GITHUB_REF_NAME does not match package version $version" + exit 1 + fi + + - name: Build + run: dotnet build ExCSS.sln -c Release + + - name: Test + run: dotnet test ExCSS.sln -c Release --no-build + + - name: Pack + run: dotnet pack ExCSS/ExCSS.csproj -c Release --no-build --output ./artifacts + + - name: Upload NuGet package + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: NuGet package + path: ./artifacts/*.nupkg + + # The token behind this organization secret must cover the SIL.ExCSS package. + - name: Publish NuGet package + if: startsWith(github.ref, 'refs/tags/v') + run: dotnet nuget push artifacts/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} --skip-duplicate diff --git a/.gitignore b/.gitignore index 1bbf2832..b444f555 100644 --- a/.gitignore +++ b/.gitignore @@ -161,4 +161,5 @@ $RECYCLE.BIN/ .idea/ .vs/ .vscode/ -nuget.exe \ No newline at end of file +nuget.exe +artifacts/ diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config deleted file mode 100644 index 67f8ea04..00000000 --- a/.nuget/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets deleted file mode 100644 index 092337b6..00000000 --- a/.nuget/NuGet.targets +++ /dev/null @@ -1,105 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - $(NuGetToolsPath)\nuget.exe - $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) - $([System.IO.Path]::Combine($(SolutionDir), "packages")) - $(TargetDir.Trim('\\')) - - - "" - - - false - - - false - - - "$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)" - "$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(BuildDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - true - https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ExCSS.Tests/ExCSS.Tests.csproj b/ExCSS.Tests/ExCSS.Tests.csproj index 2b749822..c3db2753 100644 --- a/ExCSS.Tests/ExCSS.Tests.csproj +++ b/ExCSS.Tests/ExCSS.Tests.csproj @@ -1,98 +1,32 @@ - - + + - Debug - AnyCPU - 8.0.30703 - 2.0 - {5FBCD1EE-C5B6-4734-9FE0-3BA2CD14E85A} - Library - Properties - ExCSS.Tests + net462;net8.0 ExCSS.Tests - v4.0 - 512 - ..\..\ExCSS\ - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false + ExCSS.Tests + false + - - ..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll - - - - - - - - + + + + - - - - - + + + + + True True Resources.resx - - - - - + ResXFileCodeGenerator Resources.Designer.cs - Designer - - - {26881075-3F64-4825-A6B5-EAA0D5419D20} - ExCSS - - - - - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/ExCSS.Tests/ExCSS.Tests.net35.csproj b/ExCSS.Tests/ExCSS.Tests.net35.csproj deleted file mode 100644 index 6bbfdac4..00000000 --- a/ExCSS.Tests/ExCSS.Tests.net35.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {5FBCD1EE-C5B6-4734-9FE0-3BA2CD14E85A} - Library - Properties - ExCSS.Tests - ExCSS.Tests - v3.5 - 512 - ..\..\ExCSS\ - true - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET35 - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll - - - - - - - - - - - - T4GenCssTests.tt - - - - - - - - - - - - - - {26881075-3F64-4825-A6B5-EAA0D5419D20} - ExCSS - - - - - - - True - True - Stylesheets.tt - - - TextTemplatingFileGenerator - Stylesheets.generated.cs - - - True - True - T4GenCssTests.tt - - - TextTemplatingFileGenerator - T4GenCssTests.log - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ExCSS.Tests/ExCSS.Tests.net35.t4properties b/ExCSS.Tests/ExCSS.Tests.net35.t4properties deleted file mode 100644 index b55f7b7d..00000000 --- a/ExCSS.Tests/ExCSS.Tests.net35.t4properties +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Stylesheets.tt - Host - VisualStudio - - - \ No newline at end of file diff --git a/ExCSS.Tests/Properties/AssemblyInfo.cs b/ExCSS.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index fa92f968..00000000 --- a/ExCSS.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ExCSS.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ExCSS.Tests")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c42d4c3a-81dd-44a8-8f9e-8e3721212f6e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ExCSS.Tests/packages.config b/ExCSS.Tests/packages.config deleted file mode 100644 index a52628ba..00000000 --- a/ExCSS.Tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/ExCSS.sln b/ExCSS.sln index 4cc13e1a..62d08f7a 100644 --- a/ExCSS.sln +++ b/ExCSS.sln @@ -1,30 +1,46 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ED10223D-313C-4760-B378-2B3C7DCE3B94}" -ProjectSection(SolutionItems) = preProject - .nuget\NuGet.Config = .nuget\NuGet.Config - .nuget\NuGet.targets = .nuget\NuGet.targets -EndProjectSection +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExCSS", "ExCSS\ExCSS.csproj", "{F244AD87-D1DC-4105-BC57-90DC714CA61B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExCSS.Tests", "ExCSS.Tests\ExCSS.Tests.csproj", "{5FBCD1EE-C5B6-4734-9FE0-3BA2CD14E85A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExCSS", "ExCSS\ExCSS.csproj", "{26881075-3F64-4825-A6B5-EAA0D5419D20}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExCSS.Tests", "ExCSS.Tests\ExCSS.Tests.csproj", "{364EDCB9-29B1-4123-881F-AB17B8D8E856}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5FBCD1EE-C5B6-4734-9FE0-3BA2CD14E85A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5FBCD1EE-C5B6-4734-9FE0-3BA2CD14E85A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5FBCD1EE-C5B6-4734-9FE0-3BA2CD14E85A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5FBCD1EE-C5B6-4734-9FE0-3BA2CD14E85A}.Release|Any CPU.Build.0 = Release|Any CPU - {26881075-3F64-4825-A6B5-EAA0D5419D20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26881075-3F64-4825-A6B5-EAA0D5419D20}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26881075-3F64-4825-A6B5-EAA0D5419D20}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26881075-3F64-4825-A6B5-EAA0D5419D20}.Release|Any CPU.Build.0 = Release|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Debug|x64.ActiveCfg = Debug|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Debug|x64.Build.0 = Debug|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Debug|x86.ActiveCfg = Debug|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Debug|x86.Build.0 = Debug|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Release|Any CPU.Build.0 = Release|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Release|x64.ActiveCfg = Release|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Release|x64.Build.0 = Release|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Release|x86.ActiveCfg = Release|Any CPU + {F244AD87-D1DC-4105-BC57-90DC714CA61B}.Release|x86.Build.0 = Release|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Debug|Any CPU.Build.0 = Debug|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Debug|x64.ActiveCfg = Debug|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Debug|x64.Build.0 = Debug|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Debug|x86.ActiveCfg = Debug|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Debug|x86.Build.0 = Debug|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Release|Any CPU.ActiveCfg = Release|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Release|Any CPU.Build.0 = Release|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Release|x64.ActiveCfg = Release|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Release|x64.Build.0 = Release|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Release|x86.ActiveCfg = Release|Any CPU + {364EDCB9-29B1-4123-881F-AB17B8D8E856}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ExCSS/ExCSS.csproj b/ExCSS/ExCSS.csproj index e470c92d..3a9bcb6d 100644 --- a/ExCSS/ExCSS.csproj +++ b/ExCSS/ExCSS.csproj @@ -1,197 +1,44 @@ - - + + - Debug - AnyCPU - 8.0.30703 - 2.0 - {26881075-3F64-4825-A6B5-EAA0D5419D20} - Library - Properties - ExCSS + netstandard2.0;net462 ExCSS - v4.0 - - - - - 2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - ..\..\ExCSS\ - true + ExCSS + 2.1.0 + ExCSS Parser + ExCSS CSS Parser true - - - true - full - false - bin\Debug40\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - false - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - false - - ExCSS.snk + - OnBuildSuccess + SIL.ExCSS + ExCSS Stylesheet Parser + Tyler Brinks + ExCSS reads and parses stylesheets using CSS 3 and CSS 2 selector specifications, and is easily queryable from LINQ using its simple and readable object model. + ExCSS;CSS;Style;Stylesheet;Parse;Lexer;Scanner;Linq + MIT + https://github.com/sillsdev/ExCSS + https://github.com/sillsdev/ExCSS + git + readme.md + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - + + + + + - + + <_Parameter1>false + <_Parameter1_IsLiteral>true + + + <_Parameter1>eb4daa16-725f-4c8f-9d74-b9b569d57f42 + - - - - - - - - - - - - - - - - - - %(ExCSSAssemblyInfo.Version) - - - $(ExCSSAssemblyVersion.SubString(0, $(ExCSSAssemblyVersion.LastIndexOf('.')))) - - - - - \ No newline at end of file + + diff --git a/ExCSS/ExCSS.net35.csproj b/ExCSS/ExCSS.net35.csproj deleted file mode 100644 index 8c565f1b..00000000 --- a/ExCSS/ExCSS.net35.csproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {26881075-3F64-4825-A6B5-EAA0D5419D20} - Library - Properties - ExCSS - ExCSS - v3.5 - - - - - 2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - ..\..\ExCSS\ - true - - - true - full - false - bin\Debug35\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - false - - - pdbonly - true - bin\Release35\ - TRACE - prompt - 4 - AllRules.ruleset - - - true - - - ExCSS.snk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - - - - $(SolutionDir)Coco\Coco.exe $(SolutionDir)Coco\css.v3.02.1.atg -namespace "ExCSS" - -copy /y $(SolutionDir)Coco\Parser.cs $(ProjectDir)Parser.cs -copy /y $(SolutionDir)Coco\Scanner.cs $(ProjectDir)Scanner.cs - - - - \ No newline at end of file diff --git a/ExCSS/Properties/AssemblyInfo.cs b/ExCSS/Properties/AssemblyInfo.cs deleted file mode 100644 index e87d8833..00000000 --- a/ExCSS/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ExCSS Parser")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ExCSS CSS Parser")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("eb4daa16-725f-4c8f-9d74-b9b569d57f42")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("2.0.2")] -[assembly: AssemblyFileVersion("2.0.2")] diff --git a/NuSpec/SIL.ExCSS.nuspec b/NuSpec/SIL.ExCSS.nuspec deleted file mode 100644 index 9bbfc942..00000000 --- a/NuSpec/SIL.ExCSS.nuspec +++ /dev/null @@ -1,22 +0,0 @@ - - - - SIL.ExCSS - $version$ - ExCSS Stylesheet Parser - Tyler Brinks - Tyler Brinks - https://github.com/jasonleenaylor/ExCSS - MIT - false - ExCSS reads and parses stylesheets using CSS 3 and CSS 2 selector specifications, and is easily queryable from LINQ using its simple and readable object model. - Parse CSS 3 and CSS 2 stylesheets into an easily usable and LINQ-friendly object model. It's #BADA55! - en-US - ExCSS, CSS, Style, Stylesheet, Parse, Lexer, Scanner, Linq - - - - - - - \ No newline at end of file diff --git a/readme.md b/readme.md index c0d82458..ee1939db 100644 --- a/readme.md +++ b/readme.md @@ -38,3 +38,12 @@ fully queryable using Linq to objects. The project has a growing suite of tests. Currently the tests account for and pass all CSS Level 3 selector definitions found in [the W3 CSS 3 Release Candidate documentation](http://www.w3.org/TR/2001/CR-css3-selectors-20011113/) + + +## Building and releasing + + dotnet build ExCSS.sln -c Release + dotnet test ExCSS.sln -c Release + +The package is published to NuGet as `SIL.ExCSS`. To release, set `` in `ExCSS/ExCSS.csproj`, merge to +`master`, and push a tag named `v` (for example `v2.1.0`). The `build-test` workflow publishes tagged builds.