44 ( line =~ /VERSION = "([^"]*)"/ ) && $1
55end . compact [ 0 ]
66
7- case ARGV [ 0 ]
8- when '32'
9- $platform = 'x86'
7+ $platform = ARGV [ 0 ]
8+
9+ def run_cmd ( cmd , raise_on_error = true )
10+ system ( cmd )
11+ raise $?. to_s if raise_on_error && $?. to_i != 0
12+ end
13+
14+ case $platform
15+ when 'x86-mingw32'
1016 $ruby_base_dirs = [ ]
1117
1218 $ruby_base_dirs =
1521 'c:\ruby\rubyinstaller-2.6.0-1-x86' ,
1622 'c:\ruby\rubyinstaller-2.7.0-1-x86' ,
1723 'c:\ruby\rubyinstaller-3.0.0-1-x86' ,
24+ 'c:\ruby\rubyinstaller-3.1.0-1-x86' ,
1825 ]
1926
2027 $oracle_path = 'c:\oracle\instantclient_19_9-win32'
21- $devkit_tdm_setup = 'c:\ruby\devkit-tdm-32\devkitvars.bat'
22- $devkit_mingw64_setup = 'c:\ruby\devkit-mingw64-32\devkitvars.bat'
2328 $ridk_setup = 'ridk enable'
2429
2530 $build_ruby_dirs =
2833 [ 'c:\ruby\rubyinstaller-2.6.0-1-x86' , $ridk_setup] ,
2934 [ 'c:\ruby\rubyinstaller-2.7.0-1-x86' , $ridk_setup] ,
3035 [ 'c:\ruby\rubyinstaller-3.0.0-1-x86' , $ridk_setup] ,
36+ [ 'c:\ruby\rubyinstaller-3.1.0-1-x86' , $ridk_setup] ,
3137 ]
3238
33- $cygwin_dir = 'c:\cygwin'
34-
35- when '64'
36- $platform = 'x64'
39+ when 'x64-mingw32'
3740 $ruby_base_dirs =
3841 [
3942 # RubyInstaller <URL:http://rubyinstaller.org>
4043 'c:\ruby\rubyinstaller-2.5.0-1-x64' ,
4144 'c:\ruby\rubyinstaller-2.6.0-1-x64' ,
4245 'c:\ruby\rubyinstaller-2.7.0-1-x64' ,
4346 'c:\ruby\rubyinstaller-3.0.0-1-x64' ,
47+ 'c:\ruby\rubyinstaller-3.1.0-1-x64' ,
4448 ]
4549
4650 $oracle_path = 'c:\oracle\instantclient_19_9-win64'
47- $devkit_mingw64_setup = 'c:\ruby\devkit-mingw64-64\devkitvars.bat'
4851 $ridk_setup = 'ridk enable'
4952 $build_ruby_dirs =
5053 [
5154 [ 'c:\ruby\rubyinstaller-2.5.0-1-x64' , $ridk_setup, :disable_fortify_source ] ,
5255 [ 'c:\ruby\rubyinstaller-2.6.0-1-x64' , $ridk_setup] ,
5356 [ 'c:\ruby\rubyinstaller-2.7.0-1-x64' , $ridk_setup] ,
5457 [ 'c:\ruby\rubyinstaller-3.0.0-1-x64' , $ridk_setup] ,
58+ [ 'c:\ruby\rubyinstaller-3.1.0-1-x64' , $ridk_setup] ,
59+ ]
60+
61+ when 'x64-mingw-ucrt'
62+ $ruby_base_dirs =
63+ [
64+ # RubyInstaller <URL:http://rubyinstaller.org>
65+ 'c:\ruby\rubyinstaller-3.1.0-1-x64' ,
66+ ]
67+
68+ $oracle_path = 'c:\oracle\instantclient_19_9-win64'
69+ $ridk_setup = 'ridk enable'
70+ $build_ruby_dirs =
71+ [
72+ [ 'c:\ruby\rubyinstaller-3.1.0-1-x64' , $ridk_setup] ,
5573 ]
5674
57- $cygwin_dir = 'c:\cygwin64'
5875when 'all'
59- FileUtils . cp_r ( '.' , 'c:\build\ruby-oci8-build-64' )
60- FileUtils . cp_r ( '.' , 'c:\build\ruby-oci8-build-32' )
61- Dir . chdir ( 'c:\build\ruby-oci8-build-64' ) do
62- system ( 'ruby mkpkg-win32.rb 64' )
63- end
64- Dir . chdir ( 'c:\build\ruby-oci8-build-32' ) do
65- system ( 'ruby mkpkg-win32.rb 32' )
76+ files = File . read ( 'dist-files' ) . split ( "\n " )
77+ [ 'x86-mingw32' , 'x64-mingw32' , 'x64-mingw-ucrt' ] . each do |platform |
78+ FileUtils . rm_rf platform
79+ files . each do |file |
80+ dest = File . join ( platform , file )
81+ FileUtils . mkdir_p File . dirname ( dest )
82+ FileUtils . copy ( file , dest )
83+ end
84+ Dir . chdir platform do
85+ run_cmd ( "#{ RbConfig . ruby } ../mkpkg-win32.rb #{ platform } " )
86+ end
6687 end
88+ exit 0
6789else
68- puts "#{ ARGV [ 0 ] } (32|64 |all)"
90+ puts "#{ ARGV [ 0 ] } (x86-mingw32|x64-mingw32|x64-mingw-ucrt |all)"
6991 exit 0
7092end
7193
72- $gem_package = "ruby-oci8-#{ $ruby_oci8_version} -#{ $platform} -mingw32 .gem"
94+ $gem_package = "ruby-oci8-#{ $ruby_oci8_version} -#{ $platform} .gem"
7395ENV [ 'PATH' ] = $oracle_path + ';c:\Windows\System32'
7496
7597def prepend_path ( basedir , others = [ ] )
@@ -93,11 +115,6 @@ def ruby_oci8_gem_is_installed?
93115 false
94116end
95117
96- def run_cmd ( cmd , raise_on_error = true )
97- system ( cmd )
98- raise $?. to_s if raise_on_error && $?. to_i != 0
99- end
100-
101118def make_gem
102119 Dir . glob ( 'ext/oci8/oci8lib_*.so' ) do |file |
103120 File . delete file
@@ -132,22 +149,17 @@ def install_and_test
132149 raise "ruby-oci8 gem in #{ base_dir } could not be uninstalled."
133150 end
134151 end
135- run_cmd ( "gem install ./#{ $gem_package} --local" )
136- run_cmd ( "ruby -I. test/test_all.rb" , false )
152+ begin
153+ run_cmd ( "gem install ./#{ $gem_package} --local" )
154+ run_cmd ( "ruby -I. test/test_all.rb" , false )
155+ ensure
156+ run_cmd ( "gem uninstall ruby-oci8 --platform #{ $platform} " )
157+ end
137158 end
138159 end
139160end
140161
141- def test_on_cygwin
142- prepend_path ( $cygwin_dir) do
143- run_cmd ( "ruby setup.rb config" )
144- run_cmd ( "ruby setup.rb setup" )
145- run_cmd ( "ruby -Iext/oci8 -Ilib -I. test/test_all.rb" , false )
146- end
147- end
148-
149162make_gem
150163ENV [ 'LOCAL' ] ||= '//172.17.0.2/ORCLPDB1'
151164ENV [ 'NLS_LANG' ] ||= 'American_America.AL32UTF8'
152165install_and_test
153- test_on_cygwin
0 commit comments