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

Support bundler 2 #494

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

deivid-rodriguez
Copy link
Contributor

@deivid-rodriguez deivid-rodriguez commented May 10, 2021

Unless using ruby 2.3 or older, or even on ruby 2.3 if a modern enough bundler is used, the bundler gemspec should never have its loaded_from attribute set to a missing file, so this whole hack shouldn't be necessary.

Just checking CI for now.

@deivid-rodriguez deivid-rodriguez force-pushed the remove_unnecessary_code branch from a7355db to 41b3847 Compare May 10, 2021 20:26
@olleolleolle
Copy link
Member

@deivid-rodriguez Really appreciate this input!

@olleolleolle
Copy link
Member

@deivid-rodriguez I note that this project uninstalls Bundler and installs a Bundler < 2. I'll poke a little into that, see if a newer set of Bundler can be used, perhaps update the matrix to be about current Bundler & RubyGems.

@deivid-rodriguez
Copy link
Contributor Author

I did some work last week on getting warbler's CI green, I should be able to propose a separate PR for that soon 👍.

@deivid-rodriguez deivid-rodriguez force-pushed the remove_unnecessary_code branch from 41b3847 to a38b0c6 Compare June 12, 2021 14:52
@deivid-rodriguez deivid-rodriguez changed the title Remove unnecessary code Support bundler 2 Jun 12, 2021
@deivid-rodriguez
Copy link
Contributor Author

deivid-rodriguez commented Jun 12, 2021

I will try to support bundler 2 in this PR.

@deivid-rodriguez
Copy link
Contributor Author

Everything seems to be fine, and with the most recent bundler & rubygems a couple of hacks can be removed, apparently. I still want to I will see whether it's still worth keeping those hacks around in order to support old versions.

Something problematic is that default gems are not correctly packaged inside the war file. That's why the CI was pinned to rubygems 2.7.11, because it's the most recent version that does not install bundler as a default gem. But this is an existing issue, unrelated to the bundler version in use. In this PR, I'm using a different workaround, namely, manually installing bundler as a regular gem so that it's correctly packaged.

@olleolleolle
Copy link
Member

@deivid-rodriguez This is wonderful work, and I did merge the "Remove Rake 12 from matrix" change, too, would that take this PR closer to green?

@deivid-rodriguez deivid-rodriguez force-pushed the remove_unnecessary_code branch from 9696e05 to b78a0f9 Compare June 13, 2021 07:54
@deivid-rodriguez
Copy link
Contributor Author

Yeah, PR should be green now, but I'm leaving it as a draft for now since I still want to verify a few things.

@olleolleolle
Copy link
Member

@deivid-rodriguez Huh, it LOOKS like that actually fixed it.

@deivid-rodriguez deivid-rodriguez force-pushed the remove_unnecessary_code branch 4 times, most recently from d712228 to 5e1518f Compare August 8, 2022 14:51
Unless using ruby 2.3 or older, or even of ruby 2.3 if a modern enough
bundler is used, the bundler gemspec should never have its `loaded_from`
attribute set to a missing file, so this whole hack shouldn't be
necessary.
Currently warbler is unusable from jruby 9.2 during to this require
failing (not sure to which extent though, but at least one spec is
failing and there's an open issue about this).

If we stop monkeypatching bundler, we don't need to require it, and thus
the error disappears. Since doing that doesn't make any tests fail, I
will assume the problems caused by not monkeypatching bundler are less
important than the problems caused by doing it.

So, I'm removing the code to fix the issue and get specs green.
Since warbler in action doesn't need bundler.

Fixes several failures like

```
10) Warbler::Jar with JBundler in a war project uses ENV['JBUNDLE_JARFILE'] if set
    Failure/Error: let(:config) { drbclient.config(@extra_config) }

    LoadError:
      no such file to load -- jbundler/config
    # (druby://127.0.0.1:7890) ./lib/warbler/traits/jbundler.rb:33:in `add_jbundler_jars'
    # (druby://127.0.0.1:7890) ./lib/warbler/traits/jbundler.rb:29:in `after_configure'
    # (druby://127.0.0.1:7890) ./lib/warbler/traits.rb:33:in `block in after_configure'
    # (druby://127.0.0.1:7890) ./lib/warbler/traits.rb:33:in `after_configure'
    # (druby://127.0.0.1:7890) ./lib/warbler/config.rb:217:in `initialize'
    # (druby://127.0.0.1:7890) ./spec/drb_helper.rb:29:in `config'
    # ./spec/warbler/jbundler_spec.rb:23:in `block in config'
    # ./spec/warbler/jbundler_spec.rb:63:in `block in <main>'
```
`Bundler::Definition#specs_for` no longer behaves as before. Admittedly
the previous behavior was more intuitive.
@deivid-rodriguez deivid-rodriguez force-pushed the remove_unnecessary_code branch from 5e1518f to e3b4c8d Compare August 19, 2022 14:20
@headius
Copy link
Member

headius commented Oct 17, 2022

Seems to have stalled since 2021?

@deivid-rodriguez
Copy link
Contributor Author

I actually rebased this a couple months ago and fixed one more issue, but it was still not ready.

@headius
Copy link
Member

headius commented Nov 4, 2022

How are we now? Close to releaseable?

@deivid-rodriguez
Copy link
Contributor Author

I'm not actively working on this, nor planning to. Sorry.

@dolzenko
Copy link

@deivid-rodriguez sorry to bother, I know it's been 2 years, but do you have a (draft) list of what remains to do here for this to be merged in? I'm using the code from this branch for some time and it kind of works for me. And if it's not something massive probably I can have a go at it.

@headius without this, what is the recommended way to deploy new JRuby apps today? Especially if Rails 7 requires Ruby 3 which (I assume) requires Bundler 2. I thought about replacing the whole thing with a simple script but wanted to hear your thoughts on it first 🙏

@deivid-rodriguez
Copy link
Contributor Author

@dolzenko I stopped working on this patch a while ago. I think I still had to get a few tests to pass. But if you're using this succesfully, I guess this is probably still an improvement even if some tests fail. Happy to give this a rebase if there's interest in merging it.

@dolzenko
Copy link

dolzenko commented Mar 27, 2024

@deivid-rodriguez I integrated the code in the midst of difficult release process in a hurry and I have this in the build script

# (added while trying to fix "rake not found" warble error)
bundle config set cache_all true
bundle cache --verbose
bundle install --deployment
jruby -G -S warble compiled war

(kind of a gross hack where I just almost bruteforced through the different bundle invocation scenarios to find the one working)

but now I definitely have the needed time to at least test it properly, or maybe even look into fixing the tests if you say its only that.

@deivid-rodriguez
Copy link
Contributor Author

Actually, a few comments above I claimed that CI was green, so maybe it was not that. Honestly, I forgot what the remaining issues were, sorry 😞.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants