Skip to content

Commit 6fcc54c

Browse files
committed
[rust] bump the crate version in Cargo.lock directly instead of repinning through Bazel
1 parent 21e7241 commit 6fcc54c

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎rake_tasks/rust.rake‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,11 @@ task :version, [:version] do |_task, arguments|
6464
new_version = updated.split(/\.|-/).tap { |v| v.delete_at(2) }.unshift('0').join('.').gsub('.nightly', '-nightly')
6565
puts "Updating Rust from #{old_version} to #{new_version}"
6666

67-
# Replace only the selenium-manager package version field, not coincidental
68-
# crate-version literals elsewhere (e.g. `tar = "0.4.44"` in Cargo.toml).
69-
pattern = /(^\s*version\s*=\s*")#{Regexp.escape(old_version)}(")/
70-
['rust/Cargo.toml', 'rust/BUILD.bazel'].each do |file|
67+
# Anchor on the package name: other crates in Cargo.lock sit at the same
68+
# 0.4.x numbers (e.g. `tar`), as do dependency literals in Cargo.toml.
69+
pattern = /(name = "selenium-manager".*?version = ")#{Regexp.escape(old_version)}(")/m
70+
['rust/Cargo.toml', 'rust/BUILD.bazel', 'rust/Cargo.lock'].each do |file|
7171
text = File.read(file).sub(pattern, "\\1#{new_version}\\2")
7272
File.open(file, 'w') { |f| f.puts text }
7373
end
74-
75-
Rake::Task['rust:pin'].reenable
76-
Rake::Task['rust:pin'].invoke
7774
end

0 commit comments

Comments
 (0)