Skip to content

Commit

Permalink
feat: Add support for workspace.dependencies in cargo 1.64.0+
Browse files Browse the repository at this point in the history
I did not write tests because I don't know enough Ruby to do it, but I
will gladly accept directions on it.
  • Loading branch information
poliorcetics committed Sep 26, 2022
1 parent c053490 commit 78afa00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ ENV RUSTUP_HOME=/opt/rust \
PATH="${PATH}:/opt/rust/bin"
RUN mkdir -p "$RUSTUP_HOME" && chown dependabot:dependabot "$RUSTUP_HOME"
USER dependabot
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.61.0 --profile minimal
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.64.0 --profile minimal


### Terraform
Expand Down
9 changes: 9 additions & 0 deletions cargo/lib/dependabot/cargo/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ def manifest_dependencies
end
end
end

workspace = parsed_file(file).fetch("workspace", {})
workspace.fetch("dependencies", {}).each do |name, requirement|
next unless name == name_from_declaration(name, requirement)
next if lockfile && !version_from_lockfile(name, requirement)

dependency_set <<
build_dependency(name, requirement, "dependencies", file)
end
end

dependency_set
Expand Down

0 comments on commit 78afa00

Please sign in to comment.