Skip to content

Pinned versions of dependent packages for the next major release #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

bkoelman
Copy link
Member

@bkoelman bkoelman commented Apr 6, 2022

This prevents future minor/patch releases from unintendedly requiring higher versions of dependent packages, caused by ongoing package updates in the JADNC solution.

How NuGet package dependencies in .NET work:

  • Package references are transient, which means that projects inherit package references from their dependent projects. Therefore there's no need to repeat dependencies in child project files. For example, when project X references package P, and project Y depends on project X, then project Y implicitly references package P (except when P was referenced using PrivateAssets in X).
  • To use the latest version of a dependent package, it must be referenced explicitly. For example, when package A v1.0.3 references package B v1.0.0, while the latest version of package B is v1.0.2, package B must be referenced explicitly to use its latest version.

The rationale here is as follows:

  • JsonApiDotNetCore* projects (our NuGets) require a pinned version of dependent packages. Currently, these are Microsoft.EntityFrameworkCore and Humanizer.Core. The rest are dev-only dependencies.
  • Example and test projects explicitly depend on the latest release of EF Core and Npgsql, so we're always building against the latest versions. This enables us to notice breaking changes in patch releases of dependent packages before we release a new version.
  • Because Microsoft.EntityFrameworkCore* packages are always published together, there's no need to explicitly reference its core package. For example, by referencing just Microsoft.EntityFrameworkCore.Sqlite v6.0.3, we can trust that it depends on Microsoft.EntityFrameworkCore v6.0.3 and nothing else, so there's no reason to explicitly reference Microsoft.EntityFrameworkCore as well.
  • Npgsql.EntityFrameworkCore.PostgreSQL is maintained by another team, and there's usually a small window of divergence. Therefore we do reference both Microsoft.EntityFrameworkCore* and Npgsql.EntityFrameworkCore.PostgreSQL explicitly.

QUALITY CHECKLIST

  • Changes implemented in code
  • Complies with our contributing guidelines
  • N/A: Adapted tests
  • N/A: Documentation updated

This prevents future minor/patch releases from unintendedly requiring higher versions of dependent packages, caused by ongoing package updates in the JADNC solution.

How NuGet package dependencies in .NET work:
- Package references are transient, which means that projects inherit package references from their dependent projects. Therefore there's no need to repeat dependencies in child project files. For example, when project X references package P, and project Y depends on project X, then project Y implicitly references package P (except when P was referenced using PrivateAssets in X).
- To use the latest version of a dependent package, it must be referenced explicitly. For example, when package A v1.0.3 references package B v1.0.0, while the latest version of package B is v1.0.2, package B must be referenced explicitly to use its latest version.

The rationale here is as follows:
- JsonApiDotNetCore* projects (our NuGets) require a pinned version of dependent packages. Currently, these are Microsoft.EntityFrameworkCore and Humanizer.Core. The rest are dev-only dependencies.
- Example and test projects explicitly depend on the latest release of EF Core and Npgsql, so we're always building against the latest versions. This enables us to notice breaking changes in patch releases of dependent packages before we release a new version.
- Because Microsoft.EntityFrameworkCore* packages are always published together, there's no need to explicitly reference its core package. For example, by referencing just Microsoft.EntityFrameworkCore.Sqlite v6.0.3, we can trust that it depends on Microsoft.EntityFrameworkCore v6.0.3 and nothing else, so there's no reason to explicitly reference Microsoft.EntityFrameworkCore as well.
- Npgsql.EntityFrameworkCore.PostgreSQL is maintained by another team, and there's usually a small window of divergence. Therefore we do reference both Microsoft.EntityFrameworkCore* and Npgsql.EntityFrameworkCore.PostgreSQL explicitly.
@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #1148 (80c0ce5) into master (a3a9389) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1148   +/-   ##
=======================================
  Coverage   92.58%   92.58%           
=======================================
  Files         241      241           
  Lines        7700     7700           
=======================================
  Hits         7129     7129           
  Misses        571      571           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3a9389...80c0ce5. Read the comment docs.

@bkoelman bkoelman requested a review from maurei April 6, 2022 03:24
@maurei maurei merged commit 4c5d065 into master Apr 6, 2022
@maurei maurei deleted the pin-pkg-versions branch April 6, 2022 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants