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

[pub] Fix update fails when project contains dependency from Dart SDK #10947

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

chika3742
Copy link
Contributor

@chika3742 chika3742 commented Nov 17, 2024

What are you trying to accomplish?

I have noticed that under certain conditions, Dependabot fails to create updates with the following logs:

updater | 2024/11/15 12:51:41 INFO <job_917330574> Checking if custom_lint 0.6.8 needs updating
updater | 2024/11/15 12:51:41 INFO <job_917330574> Latest version is 0.7.0
updater | 2024/11/15 12:51:41 INFO <job_917330574> Requirements to unlock update_not_possible
updater | 2024/11/15 12:51:41 INFO <job_917330574> Requirements update strategy 
2024/11/15 12:51:41 INFO <job_917330574> No update possible for custom_lint 0.6.8

Upon investigation, I found that the following error occurred in dependency_services internal, interrupting the update resolution. (different dependency, but same cause.)

Because every version of flutter from sdk depends on collection 1.18.0 and analyzer >=6.8.0 depends on collection ^1.19.0, flutter from sdk is incompatible with
  analyzer >=6.8.0.
And because analyzer >=6.6.0 <6.9.0 depends on macros >=0.1.2-main.3 <0.1.3, if flutter from sdk and analyzer >=6.6.0 then macros >=0.1.2-main.3 <0.1.3.
And because macros >=0.1.2-main.2 <0.1.2-main.4 depends on _macros 0.3.1 from sdk and macros >=0.1.2-main.4 <0.1.3-main.0 depends on _macros 0.3.2 from sdk, if flutter
  from sdk and analyzer >=6.6.0 then _macros 0.3.1 or 0.3.2 from sdk.
And because _macros from sdk doesn't exist (could not find package _macros in the Dart SDK) and riverpod_lint >=2.6.1 <3.0.0-dev.0 depends on analyzer ^6.7.0, flutter
  from sdk is incompatible with riverpod_lint >=2.6.1 <3.0.0-dev.0.
So, because my_project depends on both flutter from sdk and riverpod_lint ^2.6.1, version solving failed.

(Excerpt)

_macros from sdk doesn't exist (could not find package _macros in the Dart SDK) 

Packages such as analyzer depend on macros package, which depends on _macros which is included in the Dart SDK. When the project depends on such packages, Dependabot will no longer create any PRs because dependency_services cannot find _macros package.

This PR passes the DART_ROOT environment variable to dependency_services so that it can find the Dart SDK.

Related Issue

Anything you want to highlight for special attention from reviewers?

How will you know you've accomplished your goal?

pubspec.yaml

name: foo
environment:
  sdk: '^3.5.0'

dev_dependencies:
  riverpod_lint: 2.6.1

(riverpod_lint depends on analyzer)

Command Line

$ dependabot update pub _ --local .

Result

(before)

...
updater | 2024/11/17 12:14:27 INFO Finished job processing
  proxy | 2024/11/17 12:14:29 Skipping sending metrics because api endpoint is empty
  proxy | 2024/11/17 12:14:29 34/239 calls cached (14%)

(after)

...
updater | 2024/11/17 12:08:16 INFO Finished job processing
updater | 2024/11/17 12:08:16 INFO Results:
updater | +-------------------------------------------------+
updater | |       Changes to Dependabot Pull Requests       |
updater | +---------+---------------------------------------+
updater | | created | riverpod_lint ( from 2.6.1 to 2.6.2 ) |
updater | +---------+---------------------------------------+
  proxy | 2024/11/17 12:08:18 Skipping sending metrics because api endpoint is empty
  proxy | 2024/11/17 12:08:18 159/376 calls cached (42%)

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@github-actions github-actions bot added the L: dart:pub Dart packages via pub label Nov 17, 2024
@chika3742 chika3742 marked this pull request as ready for review November 17, 2024 12:45
@chika3742 chika3742 requested a review from a team as a code owner November 17, 2024 12:45
@abdulapopoola
Copy link
Member

Thanks @chika3742 !

Packages such as analyzer depend on macros package, which depends on _macros which is included in the Dart SDK. When the project depends on such packages, Dependabot will no longer create any PRs because it cannot find _macros package.
This commit passes the DART_ROOT environment variable to dependency_services so that it can find the Dart SDK.
Copy link
Contributor

@sachin-sandhu sachin-sandhu left a comment

Choose a reason for hiding this comment

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

approving, LGTM

@sachin-sandhu sachin-sandhu merged commit 8b20f50 into dependabot:main Nov 19, 2024
39 checks passed
@chika3742 chika3742 deleted the fix-pub-2 branch November 20, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dart:pub Dart packages via pub
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants