From df596f3cb82de2138f3e9ab835ca54404735e76b Mon Sep 17 00:00:00 2001 From: fenrir Date: Sat, 7 Dec 2024 23:19:53 +0900 Subject: [PATCH] Fix RubyInline problem in Windows Ruby >= 3.1 with patched version --- .github/workflows/main.yml | 13 +++---------- spec/sdr/replica_spec.rb | 6 ++++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e77271..fe001d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,22 +23,15 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Fix Ruby library + - name: Fix RubyInline if: matrix.os == 'windows-latest' - # https://github.com/IBM/aspera-cli - # copy the file [Ruby main dir]\lib\libx64-ucrt-ruby310.dll.a to [Ruby main dir]\lib\libx64-ucrt-ruby310.a (remove the dll extension) shell: cmd run: | - cd /d ${{ steps.ruby-inst.outputs.ruby-prefix }}\lib start /b /wait ruby -e "exit(Gem::Version.new('${{ matrix.ruby }}') >= Gem::Version.new('3.1') ? 0 : 1)" if %errorlevel% == 0 ( - setlocal enableDelayedExpansion - for %%F in (libx64-ucrt-ruby*.dll.a) do ( - set "filename=%%F" - copy "!filename!" "!filename:.dll.a=.a!" - ) + gem install specific_install hoe minitest + gem specific_install https://github.com/fenrir-naru/rubyinline.git fix_windoze -i vendor/bundle ) - dir cd >nul - name: Run the default task run: bundle exec rake diff --git a/spec/sdr/replica_spec.rb b/spec/sdr/replica_spec.rb index 853aad6..a359020 100644 --- a/spec/sdr/replica_spec.rb +++ b/spec/sdr/replica_spec.rb @@ -2,6 +2,8 @@ require 'gps_pvt/Replica' +begin; require 'inline'; rescue LoadError; end + class NativeGenerator inline(:C){|builder| builder.include('') @@ -47,7 +49,7 @@ class NativeGenerator } __C_CODE__ } -end if require 'inline' +end if defined?(Module::inline) RSpec::describe GPS_PVT::Replica::GPS_CA_Code do let(:gen_type){described_class} @@ -67,7 +69,7 @@ class NativeGenerator }.join(', ')}" if idx_diff expect(idx_diff).to be_nil, msg_fail } - end if defined?(:NativeGenerator) + end if defined?(NativeGenerator) it "has functionality to retreat replica" do prn_range.each{|prn| gen_f, gen_b = 2.times.collect{gen_type::new(prn)}