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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pub/lib/dependabot/pub/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def run_dependency_services(command, stdin_data: nil)
"CI" => "true",
"PUB_ENVIRONMENT" => "dependabot",
"FLUTTER_ROOT" => "/tmp/flutter",
"DART_ROOT" => "/tmp/flutter/bin/cache/dart-sdk",
"PUB_HOSTED_URL" => options[:pub_hosted_url],
# This variable will make the solver run assuming that Dart SDK version.
# TODO(sigurdm): Would be nice to have a better handle for fixing the dart sdk version.
Expand Down
22 changes: 22 additions & 0 deletions pub/spec/dependabot/pub/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,28 @@
end
end

context "when given a project with dependencies from dart sdk" do
let(:project) { "can_update_with_dart_sdk_deps" }
let(:dependency_name) { "lints" }
let(:requirements_to_unlock) { :all }

it "can update lints" do
expect(can_update).to be_truthy
expect(updated_dependencies).to eq [
{ "name" => "lints",
"package_manager" => "pub",
"previous_requirements" => [{
file: "pubspec.yaml", groups: ["dev"], requirement: "^3.0.0", source: nil
}],
"previous_version" => "3.0.0",
"requirements" => [{
file: "pubspec.yaml", groups: ["dev"], requirement: "^4.0.0", source: nil
}],
"version" => "4.0.0" }
]
end
end

context "when loading a YAML file with alias" do
fixture = "spec/fixtures/projects/yaml_alias/"
alias_info_file = "pubspec_alias_true.yaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: dependabot_testcase
environment:
sdk: ^3.5.0
dependencies:
_macros:
sdk: dart
dev_dependencies:
lints: ^3.0.0
Loading