Skip to content

Commit

Permalink
fix: reorganize dependencies (another attempt to fix tamatebako/tebak…
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Jan 16, 2025
1 parent 599510b commit 914caac
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 13 deletions.
28 changes: 17 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2024 [Ribose Inc](https://www.ribose.com).
# Copyright (c) 2021-2025 [Ribose Inc](https://www.ribose.com).
# All rights reserved.
# This file is a part of tebako
#
Expand Down Expand Up @@ -361,8 +361,10 @@ ExternalProject_Add(${RUBY_PRJ}
DOWNLOAD_NO_PROGRESS true
SOURCE_DIR ${RUBY_SOURCE_DIR}
BUILD_IN_SOURCE true
PATCH_COMMAND ruby ${EXE}/tebako-packager pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
CONFIGURE_COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} ${LIBYAML_RUBY_OPTION} \
CONFIGURE_COMMAND ruby ${EXE}/tebako-packager pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
# Make it for MacOS otherwise LDFLAGS are invalid
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_LIB_DIR}
COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} ${LIBYAML_RUBY_OPTION} \
--without-gmp \
--disable-dtrace \
--disable-debug-env \
Expand All @@ -379,23 +381,27 @@ ExternalProject_Add(${RUBY_PRJ}
COMMAND ${GNU_BASH} -c "ruby ${EXE}/tebako-packager pass2 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${DEPS_LIB_DIR} ${DATA_SRC_DIR} ${RUBY_STASH_DIR} ${RUBY_VER}"
)

add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ} ${LIBDWARFS_WR_PRJ})

if(IS_GNU)
add_dependencies(${RUBY_PRJ} ${PATCHELF_PRJ})
endif(IS_GNU)

# add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ})

if (${SETUP_MODE})
add_custom_target(setup
${CMAKE_COMMAND} -E echo "Tebako setup has completed"
DEPENDS ${DWARFS_WR_PRJ} ${RUBY_PRJ}
)
else (${SETUP_MODE})
if(IS_GNU)
add_dependencies(setup ${PATCHELF_PRJ})
endif(IS_GNU)

else (${SETUP_MODE})
add_custom_target(setup
${CMAKE_COMMAND} -E echo "Tebako setup has been verified"
DEPENDS ${DWARFS_WR_PRJ} ${RUBY_PRJ}
)
if(IS_GNU)
add_dependencies(setup ${PATCHELF_PRJ})
endif(IS_GNU)



set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -406,7 +412,7 @@ else (${SETUP_MODE})

add_custom_target(packaged_filesystem
COMMAND ruby ${DEPS_BIN_DIR}/deploy.rb
DEPENDS ${RUBY_PRJ}
DEPENDS setup
BYPRODUCTS ${DATA_BIN_FILE}
)

Expand Down
1 change: 1 addition & 0 deletions lib/tebako/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def self.exit_on_failure?
no_commands do
def bootstrap(clean: false)
options_manager = Tebako::OptionsManager.new(options)
# creating it for MacOs environment where it want to have all lib folders exiting at configuration stage
cache_manager = Tebako::CacheManager.new(options_manager.deps, options_manager.source,
options_manager.output_folder)
cache_manager.version_cache_check unless options[:devmode] || clean
Expand Down
1 change: 0 additions & 1 deletion lib/tebako/cli_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def do_press_runtime(options_manager, scenario_manager)

def do_setup(options_manager)
puts "Setting up tebako packaging environment"

merged_env = ENV.to_h.merge(options_manager.b_env)
Tebako.packaging_error(101) unless system(merged_env, setup_cfg_cmd(options_manager))
Tebako.packaging_error(102) unless system(merged_env, setup_build_cmd(options_manager))
Expand Down
4 changes: 4 additions & 0 deletions lib/tebako/options_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def deps_bin_dir
@deps_bin_dir ||= File.join(deps, "bin")
end

def deps_lib_dir
@deps_lib_dir ||= File.join(deps, "lib")
end

def fs_current
fs_current = Dir.pwd
if RUBY_PLATFORM =~ /msys|mingw|cygwin/
Expand Down
2 changes: 1 addition & 1 deletion lib/tebako/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
# POSSIBILITY OF SUCH DAMAGE.

module Tebako
VERSION = "0.12.2"
VERSION = "0.12.3"
end
30 changes: 30 additions & 0 deletions spec/options_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,36 @@
end
end
end

describe "#deps_lib_dir" do
let(:options_manager) { Tebako::OptionsManager.new({}) }
it "returns the correct lib directory path" do
allow(options_manager).to receive(:prefix).and_return("/fake/prefix")
expect(options_manager.deps_lib_dir).to eq("/fake/prefix/deps/lib")
end
end

describe "#press_announce_ref" do
let(:options_manager) { Tebako::OptionsManager.new({}) }
it "returns the announce reference string" do
allow(options_manager).to receive(:ref).and_return("ref")
expect(options_manager.press_announce_ref(true)).to eq(" referencing runtime at 'ref'")
expect(options_manager.press_announce_ref(false)).to eq("")
end
end

describe "#ref" do
it "returns 'tebako-runtime' if no ref is specified" do
options_manager = described_class.new({})
expect(options_manager.ref).to eq("tebako-runtime")
end

it "returns the given ref, converting backslashes to forward slashes" do
options = { "ref" => "some\\path\\ref" }
options_manager = described_class.new(options)
expect(options_manager.ref).to eq("some/path/ref")
end
end
end

# rubocop:enable Metrics/BlockLength

0 comments on commit 914caac

Please sign in to comment.