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

Remove persistent_gems_after_clean workaround #7296

Merged
merged 1 commit into from
Jun 20, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 1 addition & 10 deletions bundler/helpers/v1/lib/functions/lockfile_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def cache_vendored_gems(definition)
# Dependencies that have been unlocked for the update (including
# sub-dependencies)
unlocked_gems = definition.instance_variable_get(:@unlock).
fetch(:gems).reject { |gem| __keep_on_prune?(gem) }
fetch(:gems)
bundler_opts = {
cache_all: true,
cache_all_platforms: true,
Expand All @@ -84,15 +84,6 @@ def cache_vendored_gems(definition)
end
end

# This is not officially supported and may be removed without notice.
def __keep_on_prune?(spec_name)
unless (specs = Bundler.settings[:persistent_gems_after_clean])
return false
end

specs.include?(spec_name)
end

# Copied from Bundler::Runtime: Modified to only prune gems that have
# been unlocked
def prune_gem_cache(resolve, cache_path, unlocked_gems)
Expand Down
11 changes: 1 addition & 10 deletions bundler/helpers/v2/lib/functions/lockfile_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def cache_vendored_gems(definition)
# Dependencies that have been unlocked for the update (including
# sub-dependencies)
unlocked_gems = definition.instance_variable_get(:@unlock).
fetch(:gems).reject { |gem| __keep_on_prune?(gem) }
fetch(:gems)
bundler_opts = {
cache_all: true,
cache_all_platforms: true,
Expand All @@ -85,15 +85,6 @@ def cache_vendored_gems(definition)
end
end

# This is not officially supported and may be removed without notice.
def __keep_on_prune?(spec_name)
unless (specs = Bundler.settings[:persistent_gems_after_clean])
return false
end

specs.include?(spec_name)
end

# Copied from Bundler::Runtime: Modified to only prune gems that have
# been unlocked
def prune_gem_cache(resolve, cache_path, unlocked_gems)
Expand Down
16 changes: 0 additions & 16 deletions bundler/spec/dependabot/bundler/file_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1495,22 +1495,6 @@
expect(file.operation).to eq Dependabot::DependencyFile::Operation::DELETE
end

context "persistent gems after clean" do
let(:project_name) { "vendored_persistent_gems" }

it "does not delete cached files marked as persistent" do
file = updater.updated_dependency_files.find do |f|
f.name == "vendor/cache/business-1.4.0.gem"
end

vendor_files =
Dir.entries(Pathname.new(repo_contents_path).join("vendor/cache"))

expect(file).to be_nil
expect(vendor_files).to include("business-1.4.0.gem")
end
end

context "with dependencies that are not unlocked by the update" do
let(:project_name) { "conditional" }

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.