Skip to content
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

versionPolicyReportDependencyIssues requires versionPolicyIntention to be set #229

Open
rtyley opened this issue Nov 22, 2024 · 1 comment

Comments

@rtyley
Copy link
Contributor

rtyley commented Nov 22, 2024

I think the versionPolicyReportDependencyIssues command is the only way to debug the reasons sbt-version-policy has for deciding that compatibility is broken by dependency changes, ie the reasons that require a major/minor version bump of releaseVersion when running in unconstrained compatibility mode without versionPolicyIntention set.

Unfortunately, versionPolicyReportDependencyIssues requires versionPolicyIntention is set, and will give this error if it's not set:

Please set the key versionPolicyIntention to declare the compatibility you want to check

val intention =
versionPolicyIntention.?.value
.getOrElse(throw new MessageOnlyException("Please set the key versionPolicyIntention to declare the compatibility you want to check"))

This is awkward for projects running in unconstrained compatibility mode - ie all projects using gha-scala-library-release-workflow! There is useful output of versionPolicyReportDependencyIssues that we'd like to see even if versionPolicyIntention is not set, like:

[error] Incompatibilities with dependencies of simple-configuration-s3:3.0.0
[error]   io.netty:netty-buffer: incompatible version change from 4.1.114.Final to 4.1.115.Final (compatibility: early semantic versioning)
[error]   io.netty:netty-codec: incompatible version change from 4.1.114.Final to 4.1.115.Final (compatibility: early semantic versioning)

Workaround

Temporarily set versionPolicyIntention on the sbt console, like this:

set ThisBuild / versionPolicyIntention := Compatibility.BinaryAndSourceCompatible ; versionPolicyReportDependencyIssues

Alternatives

You can use the versionPolicyCollectCompatibilityReports task, which doesn't require versionPolicyIntention, but the output isn't as user-friendly as versionPolicyReportDependencyIssues:

show versionPolicyCollectCompatibilityReports
[info] core / versionPolicyCollectCompatibilityReports
[info] 	CompatibilityReport(Some(CompatibilityModuleReport(com.gu:simple-configuration-core:3.0.0,None,DependencyCheckReport(Map(BinaryIncompatibility -> Map((com.typesafe,config) -> SameVersion(1.4.3), (io.netty,netty-resolver) -> IncompatibleVersion(4.1.115.Final,4.1.114.Final,EarlySemVer), (io.netty,netty-transport) -> IncompatibleVersion(4.1.115.Final,4.1.114.Final,EarlySemVer)
...
@julienrf
Copy link
Collaborator

julienrf commented Nov 22, 2024

Thank you for the detailed write up! How do you think the problem should be solved? My intuition is that we want versionPolicyAssessCompatibility to return more than just a Compatibility value for each module. It could report the found incompatibilities (see also #121 which implements something similar)

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

No branches or pull requests

2 participants