-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Properly set groups based on dependencies #85
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change with how bundix writes the groups. I believe something like the fix in NixOS/nixpkgs#51884 is needed? bundlerEnv
still defaults groups to just ["default"]
which might break things that rely on the buggy behavior.
@@ -127,7 +127,7 @@ def build_depcache(lock) | |||
end | |||
|
|||
lock.specs.each do |spec| | |||
dep_cache[spec.name] ||= Dependency.new(spec.name, nil, {}) | |||
dep_cache[spec.name] ||= Dependency.new(spec.name, nil, { "group" => [] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop adds everything in the lockfile that isn't listed in the gemfile so technically we don't know which groups these gems are supposed to be.
If group
is not specified, the constructor defaults to default
which is not what we want as we want to resolve groups based on the dependency tree. So we explicitly set the group
to empty which we're going to fill in later.
@@ -143,7 +143,7 @@ def build_depcache(lock) | |||
dep_cache[name] = Dependency.new(name, lock.bundler_version, {}) | |||
end | |||
|
|||
if !((as_dep.groups - cached.groups) - [:default]).empty? or !(as_dep.platforms - cached.platforms).empty? | |||
if !(as_dep.groups - cached.groups).empty? or !(as_dep.platforms - cached.platforms).empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe [:default]
here is just a workaround to the wrong group set for transitive dependencies. This is also what breaks #39
Bundix incorrectly adds the
default
group to gems in the lock file but not in the gem file.A Gemfile like
will result in
rspec
having the grouptest
, but its dependencies (rspec-mocks
, etc) will have bothdefault
andtest
.Incidentally, this PR also fixes #39