Skip to content

Commit 8eae003

Browse files
committed
Update core to 1.2.0
1 parent 8574a1a commit 8eae003

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,8 @@ jobs:
720720
retention-days: 5
721721

722722
windows_x64:
723+
# TODO(SA): windows build have to be verified
724+
if: false
723725
needs: source
724726
runs-on: windows-2022
725727
strategy:

ext/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ target_include_directories(
7171
${PROJECT_SOURCE_DIR}/couchbase/third_party/expected/include)
7272
target_link_libraries(
7373
couchbase
74-
PRIVATE project_options
75-
project_warnings
76-
couchbase_cxx_client_static
74+
PRIVATE couchbase_cxx_client_static_intermediate
7775
Microsoft.GSL::GSL
7876
asio
7977
taocpp::json

ext/couchbase

ext/extconf.rb

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Copyright 2020-2021 Couchbase, Inc.
24
#
35
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +14,7 @@
1214
# See the License for the specific language governing permissions and
1315
# limitations under the License.
1416

17+
require 'English'
1518
require "mkmf"
1619
require "tempfile"
1720

@@ -26,13 +29,20 @@
2629
require "ruby_installer/runtime"
2730
# ridk install 1
2831
# ridk install 3
29-
# ridk exec pacman --sync --noconfirm mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-go mingw-w64-ucrt-x86_64-nasm mingw-w64-ucrt-x86_64-ccache
32+
# ridk exec pacman --sync --noconfirm \
33+
# mingw-w64-ucrt-x86_64-ninja \
34+
# mingw-w64-ucrt-x86_64-cmake \
35+
# mingw-w64-ucrt-x86_64-toolchain \
36+
# mingw-w64-ucrt-x86_64-go \
37+
# mingw-w64-ucrt-x86_64-nasm \
38+
# mingw-w64-ucrt-x86_64-ccache
3039
ENV["CB_STATIC_BORINGSSL"] = "true"
3140
ENV["CB_STATIC_STDLIB"] = "true"
3241
ENV["GOROOT"] = File.join(RubyInstaller::Runtime.msys2_installation.msys_path, "ucrt64/lib/go")
33-
else
3442
end
3543

44+
pp ENV.select { |k, _| k =~ /^CB_|^DEBUG$/ }.merge("SDK_VERSION" => SDK_VERSION)
45+
3646
def which(name, extra_locations = [])
3747
ENV.fetch("PATH", "")
3848
.split(File::PATH_SEPARATOR)
@@ -53,28 +63,24 @@ def check_version(name, extra_locations = [])
5363
end
5464

5565
cmake_extra_locations = []
56-
if RUBY_PLATFORM =~ /mswin|mingw/
66+
if RUBY_PLATFORM.match?(/mswin|mingw/)
5767
cmake_extra_locations = [
5868
'C:\Program Files\CMake\bin',
5969
'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin',
6070
'C:\Program Files\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin',
6171
]
62-
local_app_data = ENV.fetch("LOCALAPPDATA", "#{ENV.fetch("HOME")}\\AppData\\Local")
63-
if File.directory?(local_app_data)
64-
cmake_extra_locations.unshift("#{local_app_data}\\CMake\\bin")
65-
end
72+
local_app_data = ENV.fetch("LOCALAPPDATA", "#{Dir.home}\\AppData\\Local")
73+
cmake_extra_locations.unshift("#{local_app_data}\\CMake\\bin") if File.directory?(local_app_data)
6674
end
6775
cmake, version = check_version("cmake", cmake_extra_locations)
68-
if version[/cmake version (\d+\.\d+)/, 1].to_f < 3.15
69-
cmake, version = check_version("cmake3")
70-
end
76+
cmake, version = check_version("cmake3") if version[/cmake version (\d+\.\d+)/, 1].to_f < 3.15
7177
abort "ERROR: CMake is required to build couchbase extension." unless cmake
7278
puts "-- #{version}, #{cmake}"
7379

7480
def sys(*cmd)
7581
puts "-- #{Dir.pwd}"
7682
puts "-- #{cmd.join(' ')}"
77-
system(*cmd) || abort("failed to execute command: #{$?.inspect}\n#{cmd.join(' ')}")
83+
system(*cmd) || abort("failed to execute command: #{$CHILD_STATUS.inspect}\n#{cmd.join(' ')}")
7884
end
7985

8086
build_type = ENV["DEBUG"] ? "Debug" : "Release"
@@ -98,7 +104,6 @@ def sys(*cmd)
98104
cmake_flags << "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
99105
end
100106

101-
102107
extconf_include = File.expand_path("cache/extconf_include.rb", __dir__)
103108
if File.exist?(extconf_include)
104109
puts "-- include extra cmake options from #{extconf_include}"
@@ -132,18 +137,18 @@ def sys(*cmd)
132137
cmake_flags << "-DENABLE_SANITIZER_THREAD=ON" if ENV["CB_TSAN"]
133138
cmake_flags << "-DENABLE_SANITIZER_UNDEFINED_BEHAVIOUR=ON" if ENV["CB_UBSAN"]
134139

135-
cc = ENV["CB_CC"]
136-
cxx = ENV["CB_CXX"]
137-
ar = ENV["CB_AR"]
140+
cc = ENV.fetch("CB_CC", nil)
141+
cxx = ENV.fetch("CB_CXX", nil)
142+
ar = ENV.fetch("CB_AR", nil)
138143

139-
if RbConfig::CONFIG["target_os"] =~ /mingw/
144+
if RbConfig::CONFIG["target_os"].include?('mingw')
140145
require "ruby_installer/runtime"
141146
RubyInstaller::Runtime.enable_dll_search_paths
142147
RubyInstaller::Runtime.enable_msys_apps
143148
cc = RbConfig::CONFIG["CC"]
144149
cxx = RbConfig::CONFIG["CXX"]
145150
cmake_flags << "-G Ninja"
146-
cmake_flags << "-DRUBY_LIBRUBY=#{File.basename(RbConfig::CONFIG["LIBRUBY_SO"], ".#{RbConfig::CONFIG["SOEXT"]}")}"
151+
cmake_flags << "-DRUBY_LIBRUBY=#{File.basename(RbConfig::CONFIG['LIBRUBY_SO'], ".#{RbConfig::CONFIG['SOEXT']}")}"
147152
end
148153

149154
cmake_flags << "-DCMAKE_C_COMPILER=#{cc}" if cc
@@ -163,26 +168,25 @@ def sys(*cmd)
163168
if ENV["CB_CREATE_BUILD_DIR_LINK"]
164169
links = [
165170
File.expand_path(File.join(project_path, "..", "build")),
166-
File.expand_path(File.join(project_path, "build"))
171+
File.expand_path(File.join(project_path, "build")),
167172
]
168173
links.each do |link|
169174
next if link == build_dir
175+
170176
FileUtils.ln_sf(build_dir, link, verbose: true)
171177
end
172178
end
173-
Dir.chdir(build_dir) do
179+
Dir.chdir(build_dir) do # rubocop:disable ThreadSafety/DirChdir
174180
puts "-- build #{build_type} extension #{SDK_VERSION} for ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}-#{RUBY_PLATFORM}"
175181
sys(cmake, *cmake_flags, "-B#{build_dir}", "-S#{project_path}")
176182
number_of_jobs = (ENV["CB_NUMBER_OF_JOBS"] || 4).to_s
177-
sys(cmake, "--build", build_dir, "--parallel", number_of_jobs, "--verbose")
183+
sys(cmake, "--build", build_dir, "--parallel", number_of_jobs, "--verbose")
178184
end
179185
extension_name = "libcouchbase.#{RbConfig::CONFIG['SOEXT'] || RbConfig::CONFIG['DLEXT']}"
180186
extension_path = File.expand_path(File.join(build_dir, extension_name))
181187
abort "ERROR: failed to build extension in #{extension_path}" unless File.file?(extension_path)
182-
extension_name.gsub!(/\.dylib/, '.bundle')
183-
if RbConfig::CONFIG["target_os"] =~ /mingw/
184-
extension_name.gsub!(/\.dll$/, '.so')
185-
end
188+
extension_name.gsub!('.dylib', '.bundle')
189+
extension_name.gsub!(/\.dll$/, '.so') if RbConfig::CONFIG["target_os"].include?('mingw')
186190
install_path = File.expand_path(File.join(__dir__, "..", "lib", "couchbase", extension_name))
187191
puts "-- copy extension to #{install_path}"
188192
FileUtils.cp(extension_path, install_path, verbose: true)

0 commit comments

Comments
 (0)