From 0b6e2b43f5904042e4065ba030a1f2c54d10ac10 Mon Sep 17 00:00:00 2001 From: maxirmx Date: Fri, 7 Jul 2023 23:20:23 +0300 Subject: [PATCH] Fixed version.txt generation --- .github/workflows/alpine.yml | 3 ++- .github/workflows/macos.yml | 1 + .github/workflows/ubuntu.yml | 1 + Rakefile | 10 ++++++++++ lib/tebako/cli.rb | 8 -------- lib/tebako/version.rb | 2 +- tebako.gemspec | 3 +++ tests-2/tebako-test.rb | 5 +++-- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/alpine.yml b/.github/workflows/alpine.yml index 7f4e8d50..543f3052 100644 --- a/.github/workflows/alpine.yml +++ b/.github/workflows/alpine.yml @@ -118,10 +118,11 @@ jobs: make -j4 make install - - name: Install bundler + - name: Install bundle run: | gem install bundler bundle install + bundle exec rake generate_version_txt - name: Create deps folder run: mkdir ${{ env.DEPS }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 36725c39..2141f919 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -112,6 +112,7 @@ jobs: - name: tebako setup run: | bundle install + bundle exec rake generate_version_txt ${{ github.workspace }}/exe/tebako setup tests-1: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e347a768..7c6ff20e 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -137,6 +137,7 @@ jobs: - name: tebako setup run: | bundle install + bundle exec rake generate_version_txt ${{ github.workspace }}/exe/tebako setup tests-1: diff --git a/Rakefile b/Rakefile index 90bfe395..f05d7148 100644 --- a/Rakefile +++ b/Rakefile @@ -31,3 +31,13 @@ require "rubocop/rake_task" RuboCop::RakeTask.new task default: %i[rubocop] + +desc "Generate version.txt" +task "generate_version_txt" do + require_relative "lib/tebako/version" + File.write(File.join(__dir__, "version.txt"), "#{Tebako::VERSION}\n") + puts "Generate version.txt #{Tebako::VERSION} ==> #{File.join(__dir__, "version.txt")}" +end + +task build: :generate_version_txt +task release: :generate_version_txt diff --git a/lib/tebako/cli.rb b/lib/tebako/cli.rb index fc434b35..520bcca8 100755 --- a/lib/tebako/cli.rb +++ b/lib/tebako/cli.rb @@ -93,12 +93,6 @@ def options defaults = ::YAML.load_file(OPTIONS_FILE) || {} Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options)) end - - def generate - FileUtils.mkdir_p(prefix) - File.write(File.join(prefix, "version.txt"), "#{Tebako::VERSION}\n") - puts("all: ") - end end private @@ -111,8 +105,6 @@ def do_press end def do_setup - FileUtils.mkdir_p(prefix) - File.write(File.join(prefix, "version.txt"), "#{Tebako::VERSION}\n") packaging_error(101) unless system(b_env, "cmake -DSETUP_MODE:BOOLEAN=ON #{cfg_options}") packaging_error(102) unless system(b_env, "cmake --build #{output} --target setup --parallel #{Etc.nprocessors}") diff --git a/lib/tebako/version.rb b/lib/tebako/version.rb index bddef5b4..7f83cfe2 100644 --- a/lib/tebako/version.rb +++ b/lib/tebako/version.rb @@ -26,5 +26,5 @@ # POSSIBILITY OF SUCH DAMAGE. module Tebako - VERSION = "0.5.1" + VERSION = "0.5.2" end diff --git a/tebako.gemspec b/tebako.gemspec index a2cd9ead..2174d202 100644 --- a/tebako.gemspec +++ b/tebako.gemspec @@ -54,6 +54,9 @@ Gem::Specification.new do |spec| f.match(%r{\A(?:(?:test|spec|features|deps|output|common\.env)/|\.(?:git|cirrus|tebako|rubocop))}) end end + + spec.files << "version.txt" + spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = %w[cmake exe ext include lib resources src tools/ci-scripts tools/cmake-scripts tools/includes] diff --git a/tests-2/tebako-test.rb b/tests-2/tebako-test.rb index a4f00b96..8fdd8f42 100755 --- a/tests-2/tebako-test.rb +++ b/tests-2/tebako-test.rb @@ -268,11 +268,12 @@ def test_102_launcher_stdinredir # -- that we are linking to known set of shared libraries (https://github.com/tamatebako/tebako/issues/42) def expected_libs - if RbConfig::CONFIG["target_os"] =~ /darwin/ + case RbConfig::CONFIG["target_os"] + when /darwin/ ["Security.framework", "Foundation.framework", "CoreFoundation.framework", "libSystem", "libc++", "launcher-package-package:"] # This is the test program itself: 'launcher-package-package:' - elsif RbConfig::CONFIG["target_os"] =~ /linux-musl/ + when /linux-musl/ ["libc.musl-x86_64.so", "ld-musl-x86_64.so"] else # linux-gnu assumed ["linux-vdso.so", "libpthread.so", "libdl.so", "libc.so", "ld-linux-", "libm.so",