ConradIrwin / interception

Listen to raise in ruby
MIT License
24 stars 5 forks source link

Ship JRuby ext pre-built #22

Open headius opened 8 years ago

headius commented 8 years ago

Currently, interception builds a small "event hook" extension for JRuby at install time. This is unnecessary and limits deployment of JRuby.

Many people that use JRuby do not have the javac compiler present, such as in production environments. And there's no reason they need it; once compiled, JVM bytecode can be shipped anywhere with a compatible JVM and run directly. This is how JRuby works and many JRuby-based application deployments as well.

Because interception does not ship a pre-built jar for the JRuby ext, it is more difficult to deploy a JRuby "fat jar" that contains all dependencies. This is largely because you can't just fetch the gem and include it; you have to also build some of its contents.

I would recommend that interception not build the JRuby ext on install, but instead release a -java gem that has the ext pre-built. This is how all other JRuby extensions are shipped.

ConradIrwin commented 8 years ago

Thanks @headius. I haven't done much on this project for a while, but will add it to the TODO list (and/or appeal for anyone else watching the project to jump in and do this!)

stdedos commented 1 month ago

Hello there! I tried to spike a CI at https://github.com/stdedos/interception/tree/ci/build-gems - but I am lacking the various ruby tidbits missing.

I'd be nice if someone would build on top of that 🙏

stdedos commented 1 month ago

For now, it is just tests failing (but the failures are not immediately obvious, because of continue-on-error: true)

Let me know what you think 🙏

headius commented 1 month ago

Hey good to see some interest in this one!

I noticed that the logic includes a TracePoint implementation. I suspect that probably works on JRuby, since we support most of the TracePoint API. Maybe we can eliminate the JRuby extension altogether?

headius commented 1 month ago

I remove the JRuby extension in https://github.com/ConradIrwin/interception/pull/24 and use the TracePoint version of the logic.

stdedos commented 1 month ago

Apart from the tests, CI "by itself" seems working.

I'd appreciate attention to:

Trying to test this locally (again, I don't know exactly what I'm doing), it doesn't seem to work:

$ bin/gem install ./interception-0.5.gem 
Building native extensions. This could take a while...
ERROR:  Error installing ./interception-0.5.gem:
    ERROR: Failed to build gem native extension.

    current directory: /p/build/.r-gems/9.4.6.0/gems/interception-0.5/ext
/p/b/bin/jruby -I uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib extconf.rb
extconf failedBad file descriptor - /bin/sh

Gem files will remain installed in /p/build/.r-gems/9.4.6.0/gems/interception-0.5 for inspection.
Results logged to /p/build/.r-gems/9.4.6.0/extensions/universal-java-21/3.1.0/interception-0.5/gem_make.out

This is the jruby-head from https://github.com/stdedos/interception/actions/runs/11178801848 artifacts

stdedos commented 1 month ago

@ConradIrwin I guess I have no PR yet 😅

But if you have time to spare, checkout the code (and/or check a/some packaged artifact whether it's suitable-for-publish ruby)