Skip to content

Commit 1da793b

Browse files
authored
Merge pull request #582 from andyundso/fix-windows-build
Fix load path for precompiled code on Windows
2 parents 9aba2bb + 01c2038 commit 1da793b

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

.github/workflows/ci.yml

+3-22
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ jobs:
6666
name: install-windows-mingw
6767
runs-on: windows-latest
6868
steps:
69-
- uses: actions/checkout@v4
70-
7169
- uses: ruby/setup-ruby@v1
7270
with:
7371
ruby-version: ${{ matrix.ruby-version }}
@@ -80,13 +78,7 @@ jobs:
8078

8179
- name: Install native gem
8280
shell: pwsh
83-
run: |
84-
$rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
85-
$gemVersion = (Get-Content VERSION).Trim()
86-
$gemToInstall = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
87-
88-
Write-Host "Looking to install $gemToInstall"
89-
gem install "$gemToInstall"
81+
run: gem install "tiny_tds-*.gem"
9082

9183
- name: Test if TinyTDS loads
9284
shell: pwsh
@@ -191,8 +183,6 @@ jobs:
191183
name: install-windows-ucrt
192184
runs-on: windows-latest
193185
steps:
194-
- uses: actions/checkout@v4
195-
196186
- uses: ruby/setup-ruby@v1
197187
with:
198188
ruby-version: ${{ matrix.ruby-version }}
@@ -205,13 +195,7 @@ jobs:
205195

206196
- name: Install native gem
207197
shell: pwsh
208-
run: |
209-
$rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
210-
$gemVersion = (Get-Content VERSION).Trim()
211-
$gemToInstall = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
212-
213-
Write-Host "Looking to install $gemToInstall"
214-
gem install "$gemToInstall"
198+
run: gem install "tiny_tds-*.gem"
215199

216200
- name: Test if TinyTDS loads
217201
shell: pwsh
@@ -389,8 +373,6 @@ jobs:
389373
name: install-linux
390374
runs-on: ubuntu-22.04
391375
steps:
392-
- uses: actions/checkout@v4
393-
394376
- name: Download precompiled gem
395377
uses: actions/download-artifact@v4
396378
with:
@@ -407,7 +389,7 @@ jobs:
407389
sh -c "
408390
gem update --system 3.3.22 &&
409391
${{ matrix.bootstrap }}
410-
gem install --no-document ./gems/tiny_tds-$(cat VERSION)-${{ matrix.platform }}.gem &&
392+
gem install --no-document ./gems/tiny_tds-*.gem &&
411393
ruby -e \"require 'tiny_tds'; puts TinyTds::Gem.root_path\" &&
412394
tsql-ttds -C &&
413395
defncopy-ttds -v
@@ -425,7 +407,6 @@ jobs:
425407
- true
426408

427409
mssql-version:
428-
- 2017
429410
- 2019
430411
- 2022
431412

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.2.1
2+
3+
* Ensure the native Gem loads on Windows. Fixes #581.
4+
15
## 3.2.0
26

37
* Reduce number of files shipped with precompiled Windows gem

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.0
1+
3.2.1

lib/tiny_tds.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module TinyTds
1111
# Is this file part of a fat binary gem with bundled freetds?
1212
# This path must be enabled by add_dll_directory on Windows.
1313
gplat = ::Gem::Platform.local
14-
FREETDS_LIB_PATH = Dir[File.expand_path("../ports/#{gplat.cpu}-#{gplat.os}*/lib", __dir__)].first
14+
FREETDS_LIB_PATH = Dir[File.expand_path("../ports/#{gplat.cpu}-#{gplat.os}*/{bin,lib}", __dir__)].first
1515

1616
add_dll_path = proc do |path, &block|
1717
if RUBY_PLATFORM =~ /(mswin|mingw)/i && path

0 commit comments

Comments
 (0)