diff --git a/pub/lib/dependabot/pub/helpers.rb b/pub/lib/dependabot/pub/helpers.rb index b0ffd79aec..c27b84e8de 100644 --- a/pub/lib/dependabot/pub/helpers.rb +++ b/pub/lib/dependabot/pub/helpers.rb @@ -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. diff --git a/pub/spec/dependabot/pub/update_checker_spec.rb b/pub/spec/dependabot/pub/update_checker_spec.rb index eaf67acbf0..a77b2fcc2d 100644 --- a/pub/spec/dependabot/pub/update_checker_spec.rb +++ b/pub/spec/dependabot/pub/update_checker_spec.rb @@ -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" diff --git a/pub/spec/fixtures/projects/can_update_with_dart_sdk_deps/pubspec.yaml b/pub/spec/fixtures/projects/can_update_with_dart_sdk_deps/pubspec.yaml new file mode 100644 index 0000000000..d18bc62a97 --- /dev/null +++ b/pub/spec/fixtures/projects/can_update_with_dart_sdk_deps/pubspec.yaml @@ -0,0 +1,8 @@ +name: dependabot_testcase +environment: + sdk: ^3.5.0 +dependencies: + _macros: + sdk: dart +dev_dependencies: + lints: ^3.0.0