Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .agents/codebase-insights.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ The native tracer (Rust extension) caches frequently used Ruby method IDs and
class constants in the `Recorder` struct. When adding new Ruby method calls,
ensure the IDs are interned once during allocation and stored in the struct for
reuse.

When the native extension is built via `rb_sys` during gem installation, the
compiled shared library is placed directly under the gem's `lib` directory
instead of `ext/native_tracer/target/release`.
1 change: 1 addition & 0 deletions .agents/tasks/2025/06/29-2312-fix-extension-spec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In codetracer-ruby-recorder.gemspec, set spec.extensions to ['ext/native_tracer/extconf.rb'] and verify that rake build produces a gem that compiles the extension when installed
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
'ext/native_tracer/target/release/*'
]
spec.require_paths = ['lib']
spec.extensions = []
spec.extensions = ['ext/native_tracer/extconf.rb']
spec.bindir = 'bin'
spec.executables = ['codetracer-ruby-recorder']

Expand Down
8 changes: 8 additions & 0 deletions gems/codetracer-ruby-recorder/lib/codetracer_ruby_recorder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ def load_native_recorder
ext_dir = File.expand_path('../ext/native_tracer/target/release', __dir__)
dlext = RbConfig::CONFIG['DLEXT']
target_path = File.join(ext_dir, "codetracer_ruby_recorder.#{dlext}")

unless File.exist?(target_path)
# When built via rb_sys during gem installation, the extension is
# placed directly under the gem's lib directory.
lib_path = File.expand_path("codetracer_ruby_recorder.#{dlext}", __dir__)
target_path = lib_path if File.exist?(lib_path)
end

unless File.exist?(target_path)
extensions = %w[so bundle dylib dll]
alt_path = extensions
Expand Down
Loading