Skip to content

Commit

Permalink
FF-2853 fix: rename eppo_rb to eppo_client (#19)
Browse files Browse the repository at this point in the history
* chore: fix Cargo.lock checking in CI

`cargo generate-lockfile` tries to update dependencies to latest
version and thus fails with `--locked`, even if the lockfile itself is
fine.

`cargo update --workspace` only updates files from the workspace root
and any packages that are missing in the lockfile. So it produces
consistent result.

* FF-2853 fix: rename eppo_rb to eppo_client

For some reason, ExtensionTask ignored lib_dir during gem
installation, so extension was installed to lib/eppo_rb and gem failed
to function.

Renaming import does not help because it breaks the build in local
development.

Rename eppo_rb to eppo_client, so extension name matches the
installation directory. This is also what was recommended by rust gem
template.
  • Loading branch information
rasendubi authored Jul 24, 2024
1 parent b3e382a commit 00eacc7
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Check Cargo.lock
# Ensure that Cargo.lock matches Cargo.toml
run: cargo generate-lockfile --locked
run: cargo update --workspace --locked
working-directory: ruby-sdk

- name: Override eppo_core for testing
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:
fi
- name: Verify MSRV for each package
run: |
for dir in eppo_core rust-sdk ruby-sdk/ext/eppo_rb; do
for dir in eppo_core rust-sdk ruby-sdk/ext/eppo_client; do
(cd $dir && cargo msrv verify)
done
26 changes: 13 additions & 13 deletions ruby-sdk/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ruby-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# in the ext/ directory.

[workspace]
members = ["./ext/eppo_rb"]
members = ["./ext/eppo_client"]
resolver = "2"
2 changes: 1 addition & 1 deletion ruby-sdk/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ task default: :build

GEMSPEC = Gem::Specification.load("eppo-server-sdk.gemspec")

RbSys::ExtensionTask.new("eppo_rb", GEMSPEC) do |ext|
RbSys::ExtensionTask.new("eppo_client", GEMSPEC) do |ext|
ext.lib_dir = "lib/eppo_client"
end

Expand Down
2 changes: 1 addition & 1 deletion ruby-sdk/eppo-server-sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.extensions = ["ext/eppo_rb/Cargo.toml"]
spec.extensions = ["ext/eppo_client/Cargo.toml"]

# Uncomment to register a new dependency of your gem
# spec.add_dependency "example-gem", "~> 1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "eppo_rb"
version = "0.1.0"
name = "eppo_client"
version = "3.0.0"
edition = "2021"
license = "MIT"
publish = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
// Without this flag, building via `cargo build` fails with undefined references to ruby
// library. This is fine as `eppo_rb` is going to be loaded as an extension by the host Ruby.
// library. This is fine as `eppo_client` is going to be loaded as an extension by the host Ruby.
println!("cargo:rustc-link-arg=-Wl,-undefined,dynamic_lookup");
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
require "mkmf"
require "rb_sys/mkmf"

create_rust_makefile("eppo_rb")
create_rust_makefile("eppo_client")
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ruby-sdk/lib/eppo_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require "logger"

require_relative "config"
require_relative "eppo_rb"
require_relative "eppo_client"

module EppoClient
# The main client singleton
Expand Down

0 comments on commit 00eacc7

Please sign in to comment.