Skip to content

Framework-dependent System.Drawing.Common version#1310

Merged
swharden merged 22 commits intoScottPlot:masterfrom
Kritner:FEATURE/centralPackageVersioning
Oct 2, 2021
Merged

Framework-dependent System.Drawing.Common version#1310
swharden merged 22 commits intoScottPlot:masterfrom
Kritner:FEATURE/centralPackageVersioning

Conversation

@Kritner
Copy link
Contributor

@Kritner Kritner commented Oct 1, 2021

Purpose:

image

#1274, Closes #1311

* Think it's everything except the Version.bat tools, will get that in the next commit.
* As a result of https://blog.kritner.com/2021/10/01/dotnet-centralized-package-versioning/ and chatting with Scott on slack ;)
* I can't seem to build all of the projects, mostly around the pieces that require framework and/or windows based functionality.  I don't know if this is something you would be able to check off @swharden
….props

* Now uses a variable for the version across the other csproj files
…oke the previous xml traversal, corrected.

* There's gotta be a better way for identification of property groups and/or relying on the element we're looking for to be in the correct "ordinal" property group, but eh?
@swharden swharden linked an issue Oct 1, 2021 that may be closed by this pull request
@swharden
Copy link
Member

swharden commented Oct 1, 2021

Hi @Kritner, thanks for sharing this! See my notes in #1311

If you remove the draft status of this PR you can confirm the CI/tests pass and I won't merge it until you're ready

EDIT: my bad, I have to manually approve CI runs for first-time contributors

@swharden swharden requested a review from bclehmann October 1, 2021 23:22
…as per ScottPlot#1311

* You can upgrade a version for specified csproj files by utilizing "OverrideVersion" on the included package for the desired csproj file.
@swharden
Copy link
Member

swharden commented Oct 1, 2021

I can't seem to build all of the projects, mostly around the pieces that require framework and/or windows based functionality

This might make this difficult 😅

We exert a lot of effort to maintain cross-targeted builds across .NET Framework (back to 4.6.1), .NET Standard (2.0), and .NET 5 so the library runs on Windows, MacOS, and Linux.

If ManagePackageVersionsCentrally isn't supported with those earlier targets, a less fancy solution like csproj variables is still an improvement. I'm interested in learning more about this topic!

@swharden
Copy link
Member

swharden commented Oct 1, 2021

a less fancy solution like csproj variables is still an improvement

If this is the case I think we really only need to use central versioning for:

The rest can remain hard-coded in the csproj files.

@Kritner
Copy link
Contributor Author

Kritner commented Oct 1, 2021

I can't seem to build all of the projects, mostly around the pieces that require framework and/or windows based functionality

This might make this difficult 😅

We exert a lot of effort to maintain cross-targeted builds across .NET Framework (back to 4.6.1), .NET Standard (2.0), and .NET 5 so the library runs on Windows, MacOS, and Linux.

The only sandbox app I can't build is "WinFormsFrameworkApp". Here are outputs from the other demo apps:

WPF:
image

WinForms:
image

Console:
image

Avalonia Demo:
image


FWIW, I ran dotnet format but that seems to be failing the CI / Check Formatting step. Additionally all tests are passing locally, I'll look at which one failed in that part of the process.


Addressed in 2ccae4f

Puts the central version to 4.6.1, individual packages can be upgraded with OverrideVersion in their respective csproj file if desired. (I'm assuming no newer features were actually required, so I just kept everything at 4.6.1)

@swharden
Copy link
Member

swharden commented Oct 1, 2021

@swharden should the package version be revved within this PR to *.25? or is that a part of the build process and/or rollup of several features into a new version?

Let's leave all the ScottPlot versions what they are. After merging this PR I'll automate the process of bumping them using GitHub Actions 👍

@Kritner
Copy link
Contributor Author

Kritner commented Oct 1, 2021

@swharden should the package version be revved within this PR to *.25? or is that a part of the build process and/or rollup of several features into a new version?

Let's leave all the ScottPlot versions what they are. After merging this PR I'll automate the process of bumping them using GitHub Actions 👍

Sounds good, current branch is still set at version 4.1.24. I think that's everything, except for the CI / Check Formatting step (which I did run the formatting...) and The failing Test on Linux: https://github.com/ScottPlot/ScottPlot/pull/1310/checks?check_run_id=3773009138#step:6:23

@swharden
Copy link
Member

swharden commented Oct 1, 2021

The only sandbox app I can't build is "WinFormsFrameworkApp". Here are outputs from the other demo apps:

This is encouraging! As far as building/testing I'm happy to lean on the CI system.

Test_LettersDontRenderAsRectangles_SerifFont

Thanks again for your work on this PR! Sorry it got complicated by this 😝 This seems related to #1079 so let's disable this test to keep this PR moving and we can solve that issue before merging.

☠️ It looks like the Linux tests are failing due to font rendering issues. This may be because GitHub (the system that runs on the cloud) just today changed their default supported font set. To get this PR un-stuck you can either:

if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) Assert.Pass();
  • Option 2: In ci.yaml add an indented line after strategy: with fail-fast: false to allow the Windows tests to run even if the Linux tests fail.

@swharden

This comment has been minimized.

@Kritner

This comment has been minimized.

@Kritner Kritner marked this pull request as ready for review October 2, 2021 00:08
@swharden
Copy link
Member

swharden commented Oct 2, 2021

I think the new errors indicate the package versioning isn't working as expected 😅

The font rendering error was also a result of this actually... if the wrong version of System.Drawing.Common is installed on Linux, characters render as squares, and that test fails: #1079 (comment)

Let's ignore autoformatting for now

swharden and others added 2 commits October 1, 2021 20:30
… framework

* @swharden wants this to be an OS switch rather than framework switch, gotta get the kids to bed though!  I'll try to pick this up tomorrow
@swharden swharden changed the title Start of centralized package versioning Centralized package and dependency versioning Oct 2, 2021
when run on Windows the autoformatter didn't find any issues
Previously the format check was run on Linux which has more strict whitespace formatting requirements ScottPlot#1310
previously disabled because of System.Drawing.Common versioning issues ScottPlot#1310 ScottPlot#1311
previously the conditional logic only supported .NET 5 (not .NET 6+)
Copy link
Member

@bclehmann bclehmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, although that test does bug me. Especially as Linux font rendering on GDI+ seems to be more fragile than other OSes, and we're already rather dependent on bug reports to catch Linux issues.

.props files were stored in /dev for when central versioning tools mature to allow mixed-package solutions and version wildcards
an additional job builds the pages using the *.NUGET.csproj files instead of the default project files used by the solution file
@swharden
Copy link
Member

swharden commented Oct 2, 2021

Wow, this was a rollercoaster ride! 🎢🎃

I did not side with centralized dependency versioning

  • It couples packages more than I desire - the solution file is used for the convenience of the developer, but packages should be largely self-contained and isolated from the rest of the stuff in this repository.

  • Mixed projects are not supported - I wish I could centrally version just System.Drawing.Common but it doesn't look like that's possible without centrally versioning everything, or requiring building from the solution (I want the nuget packages to be independently buildable because it's often hard to build mixed-target solutions on cloud platforms)

  • Wildcard versioning is currently unsupported. Allowing a version like 0.10.* is pretty helpful.

I learned a lot through this experience, including not to rush to adopt preview features 😅

I moved the .props files to /dev/ so we might be able to use them later when the .NET tools mature

The CI pipeline improved

  • Tail-fast is now disabled, allowing more thorough assessments of whether failing tests fail on all operating systems or not

  • The nuget packages are built from separate csproj files than the ones used by the solution file, so a new job was added to test building those and storing them as artifacts so you can download/inspect/test them. They're only retained for 24 hours to keep storage utilization low.

Conditional System.Drawing.Common version

Unless I goofed and haven't realized it yet, I think this is a big win of this PR. The System.Drawing.Common versioning problems (#1004) are limited to what happens when .NET Framework users downgrade their package version. Before this PR we just targeted the lowest version, but that causes poor font rendering on linux (#1079). This new discussion led to the following in the nuget package csproj files, which I think solves the problem by allowing the latest version to be distributed to everyone except .NET Framework users (though they still have the ability to upgrade on their end if they wish).

<ItemGroup>
<!--
Logic here ensures .NET Framework apps get the older (4.6.1) package by default.
Upgrading may improve font rendering on Linux and MacOS, but upgrading then downgrading
is associated with assembly issues that break .NET Framework projects on Windows.
https://github.com/ScottPlot/ScottPlot/issues/1004
-->
<PackageVersion Condition="!$(TargetFramework.StartsWith('net4'))" Include="System.Drawing.Common" Version="5.0.2" />
<PackageVersion Condition="$(TargetFramework.StartsWith('net4'))" Include="System.Drawing.Common" Version="4.6.1" />
</ItemGroup>

@swharden swharden changed the title Centralized package and dependency versioning Framework-dependent System.Drawing.Common version in NuGet packages Oct 2, 2021
@swharden swharden merged commit fd746b0 into ScottPlot:master Oct 2, 2021
@swharden swharden changed the title Framework-dependent System.Drawing.Common version in NuGet packages Framework-dependent System.Drawing.Common version Oct 2, 2021
@swharden swharden mentioned this pull request Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Central version management

3 participants