Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

[2.0] Enable specific_platform by default on 2.0 #5818

Merged
merged 4 commits into from
Jul 5, 2017

Conversation

segiddins
Copy link
Member

What was the end-user problem that led to this PR?

The problem was that Bundler has somewhat suspect handling of multi-platform gems. We'd assume that different platform versions of gems were generally interchangeable, so if Bundler resolved to the "ruby" platform gem we'd just blindly try to swap in the gem for the local platform, which could lead to issues (say if the sets of dependencies were different).

Was was your diagnosis of the problem?

My diagnosis was that we needed to stop only working with the notion of "generic" platforms, which mapped everything to (basically) either java, pure ruby, and windows, and instead keep track of the actual platforms a bundle was being used on, and resolve for those specific platforms.

What is your fix for the problem, implemented in this PR?

My fix enables the changes made in #4836 by default on Bundler 2.

Why did you choose this fix out of the possible options?

I chose this fix because it means Bundler will default to more correct platforms semantics out of the box.

@segiddins
Copy link
Member Author

Will update the specs on 2.0 once the source changes land, as those already fork a lot of the lockfile output specs

@bundlerbot
Copy link
Collaborator

☔ The latest upstream changes (presumably #5820) made this pull request unmergeable. Please resolve the merge conflicts.

@segiddins segiddins force-pushed the seg-bundler-2-specific-platform branch from 8720a9a to c254dff Compare July 1, 2017 15:28
@segiddins
Copy link
Member Author

Holy heck this was hard to get passing, took a bunch of time

@segiddins segiddins force-pushed the seg-bundler-2-specific-platform branch from c254dff to 85c527c Compare July 2, 2017 12:57
@segiddins
Copy link
Member Author

Should be green now. Please review.

Copy link
Contributor

@jules2689 jules2689 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It all seems fairly straightforward to me. Would be best to get someone with more familiarity to also look. I am a bit concerned about the liberal sorting, but have no numbers to back it up at this time.

@@ -904,7 +904,7 @@ def expand_dependencies(dependencies, remote = false)
"To add those platforms to the bundle, " \
"run `bundle lock --add-platform #{mapped_platforms.join " "}`."
end
platforms.each do |p|
Resolver.sort_platforms(platforms).each do |p|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little concerned about sorting in definition. Is this on the require path?
We should skip this block entirely if remote == true since the entire functionality is not used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears to be

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea to speed this up that I'll try out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be improved now, it only sorts the platforms once instead of once per dependency

@@ -26,6 +26,9 @@ def message
end.min_by(&:size)
trees.reject! {|t| !maximal.include?(t.last) } if maximal

trees = trees.sort_by {|t| t.flatten.map(&:to_s) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're doing another sort below, maybe we can combine the sort_by, uniq, and sort_by for perf reasons?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is in an error message, so I'm not overly concerned with performance

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh true.

@segiddins segiddins force-pushed the seg-bundler-2-specific-platform branch 2 times, most recently from ec93581 to 76a5657 Compare July 4, 2017 15:27
@indirect
Copy link
Member

indirect commented Jul 5, 2017

LGTM. 👍 @bundlerbot r+

@bundlerbot
Copy link
Collaborator

📌 Commit 76a5657 has been approved by indirect

@bundlerbot
Copy link
Collaborator

☔ The latest upstream changes (presumably #5790) made this pull request unmergeable. Please resolve the merge conflicts.

@bundlerbot
Copy link
Collaborator

🔒 Merge conflict

@segiddins segiddins force-pushed the seg-bundler-2-specific-platform branch from 76a5657 to 81ac8ab Compare July 5, 2017 12:13
@segiddins
Copy link
Member Author

Rebased.

@bundlerbot r=indirect

@bundlerbot
Copy link
Collaborator

📌 Commit 81ac8ab has been approved by indirect

@bundlerbot
Copy link
Collaborator

⌛ Testing commit 81ac8ab with merge b088392...

bundlerbot added a commit that referenced this pull request Jul 5, 2017
…rect

[2.0] Enable specific_platform by default on 2.0

### What was the end-user problem that led to this PR?

The problem was that Bundler has somewhat suspect handling of multi-platform gems. We'd assume that different platform versions of gems were generally interchangeable, so if Bundler resolved to the "ruby" platform gem we'd just blindly try to swap in the gem for the local platform, which could lead to issues (say if the sets of dependencies were different).

### Was was your diagnosis of the problem?

My diagnosis was that we needed to stop only working with the notion of "generic" platforms, which mapped everything to (basically) either java, pure ruby, and windows, and instead keep track of the actual platforms a bundle was being used on, and resolve for those specific platforms.

### What is your fix for the problem, implemented in this PR?

My fix enables the changes made in #4836 by default on Bundler 2.

### Why did you choose this fix out of the possible options?

I chose this fix because it means Bundler will default to more correct platforms semantics out of the box.
@bundlerbot
Copy link
Collaborator

☀️ Test successful - status-travis
Approved by: indirect
Pushing b088392 to master...

@bundlerbot bundlerbot merged commit 81ac8ab into master Jul 5, 2017
@segiddins segiddins deleted the seg-bundler-2-specific-platform branch July 5, 2017 14:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants