Skip to content

RCBC-504: Update core and version generation #162

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

Merged
merged 2 commits into from
Nov 12, 2024
Merged
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
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end
desc "Compile binary extension"
task :compile do
require 'tempfile'
Dir.chdir(Dir.tmpdir) do
Dir.chdir(Dir.tmpdir) do # rubocop:disable ThreadSafety/DirChdir
sh "ruby '#{File.join(__dir__, 'ext', 'extconf.rb')}'"
end
end
Expand All @@ -52,9 +52,9 @@ end

desc "Encode git revision into 'ext/extconf.rb' template (dependency of 'build' task)"
task :render_git_revision do
library_revision = Dir.chdir(__dir__) { `git rev-parse HEAD`.strip }
core_revision = Dir.chdir(File.join(__dir__, 'ext', 'couchbase')) { `git rev-parse HEAD`.strip }
core_describe = Dir.chdir(File.join(__dir__, 'ext', 'couchbase')) do
library_revision = Dir.chdir(__dir__) { `git rev-parse HEAD`.strip } # rubocop:disable ThreadSafety/DirChdir
core_revision = Dir.chdir(File.join(__dir__, 'ext', 'couchbase')) { `git rev-parse HEAD`.strip } # rubocop:disable ThreadSafety/DirChdir
core_describe = Dir.chdir(File.join(__dir__, 'ext', 'couchbase')) do # rubocop:disable ThreadSafety/DirChdir
`git fetch --tags >/dev/null 2>&1`
`git describe --long --always HEAD`.strip
end
Expand Down
4 changes: 2 additions & 2 deletions bin/jenkins/repackage-extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def bundle(target_dir)
end

if first_gemspec
Dir.chdir(first_gemspec.full_gem_path) do
Dir.chdir(first_gemspec.full_gem_path) do # rubocop:disable ThreadSafety/DirChdir
File.write("lib/couchbase/libcouchbase.rb", <<-RUBY)
begin
require_relative "\#{RUBY_VERSION[/(\\d+\\.\\d+)/]}/libcouchbase"
Expand Down Expand Up @@ -101,7 +101,7 @@ def repackage(gemspec)
# build new gem
output_gem = nil

Dir.chdir gemspec.full_gem_path do
Dir.chdir gemspec.full_gem_path do # rubocop:disable ThreadSafety/DirChdir
output_gem = Gem::Package.build(gemspec, true)
end

Expand Down
13 changes: 8 additions & 5 deletions ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ add_library(
rcb_version.cxx
rcb_views.cxx)
target_include_directories(couchbase PRIVATE ${PROJECT_BINARY_DIR}/generated)
target_include_directories(couchbase PRIVATE SYSTEM ${RUBY_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/couchbase
${PROJECT_BINARY_DIR}/couchbase/generated
${PROJECT_SOURCE_DIR}/couchbase/third_party/cxx_function
${PROJECT_SOURCE_DIR}/couchbase/third_party/expected/include)
target_include_directories(
couchbase
PRIVATE SYSTEM
${RUBY_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/couchbase
${PROJECT_BINARY_DIR}/couchbase/generated
${PROJECT_SOURCE_DIR}/couchbase/third_party/cxx_function
${PROJECT_SOURCE_DIR}/couchbase/third_party/expected/include)
target_link_libraries(
couchbase
PRIVATE project_options
Expand Down
2 changes: 1 addition & 1 deletion ext/couchbase
1 change: 1 addition & 0 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def sys(*cmd)
elsif ENV["CB_STATIC_OPENSSL"]
cmake_flags << "-DCOUCHBASE_CXX_CLIENT_STATIC_OPENSSL=ON"
end
cmake_flags << "-DCOUCHBASE_CXX_CLIENT_WRAPPER_UNIFIED_ID=ruby/#{Couchbase::VERSION[:sdk]}"

unless cmake_flags.grep(/BORINGSSL/)
case RbConfig::CONFIG["target_os"]
Expand Down
12 changes: 6 additions & 6 deletions ext/rcb_analytics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -911,17 +911,17 @@ cb_Backend_analytics_link_get_all(VALUE self, VALUE options)
cb_throw_error(
resp.ctx,
fmt::format(R"(unable to retrieve links type={}, dataverse="{}", name="{}")",
req.link_type,
req.link_name,
req.dataverse_name));
req.link_type.value_or("-"),
req.link_name.value_or("-"),
req.dataverse_name.value_or("-")));
} else {
const auto& first_error = resp.errors.front();
cb_throw_error(
resp.ctx,
fmt::format(R"(unable to retrieve links type={}, dataverse="{}", name="{}" ({}: {}))",
req.link_type,
req.link_name,
req.dataverse_name,
req.link_type.value_or("-"),
req.link_name.value_or("-"),
req.dataverse_name.value_or("-"),
first_error.code,
first_error.message));
}
Expand Down
6 changes: 3 additions & 3 deletions lib/couchbase/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.log_level

# Return logger associated with the library
def self.logger
@logger # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
@logger # rubocop:disable ThreadSafety/ClassInstanceVariable
end

# Associate logger with the library
Expand All @@ -67,8 +67,8 @@ def self.logger
#
# @since 3.4.0
def self.set_logger(logger, adapter_class: nil, verbose: false, level: :info)
@logger = logger # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
if @logger.nil? # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
@logger = logger # rubocop:disable ThreadSafety/ClassInstanceVariable
if @logger.nil? # rubocop:disable ThreadSafety/ClassInstanceVariable
Backend.install_logger_shim(nil)
return
end
Expand Down
Loading