[前][次][番号順一覧][スレッド一覧]

ruby-changes:43125

From: nobu <ko1@a...>
Date: Sun, 29 May 2016 12:08:57 +0900 (JST)
Subject: [ruby-changes:43125] nobu:r55198 (trunk): auto_ext.rb

nobu	2016-05-29 12:08:45 +0900 (Sun, 29 May 2016)

  New Revision: 55198

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55198

  Log:
    auto_ext.rb
    
    * ext/-test-/auto_ext.rb (auto_ext): utitily method to create
      extension libraries for tests.

  Added files:
    trunk/ext/-test-/auto_ext.rb
  Modified files:
    trunk/ChangeLog
    trunk/ext/-test-/bignum/extconf.rb
    trunk/ext/-test-/class/extconf.rb
    trunk/ext/-test-/debug/extconf.rb
    trunk/ext/-test-/exception/extconf.rb
    trunk/ext/-test-/file/extconf.rb
    trunk/ext/-test-/float/extconf.rb
    trunk/ext/-test-/hash/extconf.rb
    trunk/ext/-test-/integer/extconf.rb
    trunk/ext/-test-/iter/extconf.rb
    trunk/ext/-test-/method/extconf.rb
    trunk/ext/-test-/proc/extconf.rb
    trunk/ext/-test-/string/extconf.rb
    trunk/ext/-test-/struct/extconf.rb
    trunk/ext/-test-/symbol/extconf.rb
    trunk/ext/-test-/time/extconf.rb
    trunk/ext/-test-/win32/console/extconf.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55197)
+++ ChangeLog	(revision 55198)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 29 12:08:42 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/-test-/auto_ext.rb (auto_ext): utitily method to create
+	  extension libraries for tests.
+
 Sat May 28 20:40:57 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* misc/ruby-additional.el (ruby-insert-heredoc-code-block): insert
Index: ext/-test-/win32/console/extconf.rb
===================================================================
--- ext/-test-/win32/console/extconf.rb	(revision 55197)
+++ ext/-test-/win32/console/extconf.rb	(revision 55198)
@@ -1,9 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/win32/console/extconf.rb#L1
 # frozen_string_literal: false
 if $mingw or $mswin
-  $srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-  inits = $srcs.map {|s| File.basename(s, ".*")}
-  inits.delete("init")
-  inits.map! {|s|"X(#{s})"}
-  $defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-  create_makefile("-test-/win32/console")
+  require_relative "../../auto_ext.rb"
+  auto_ext
 end
Index: ext/-test-/iter/extconf.rb
===================================================================
--- ext/-test-/iter/extconf.rb	(revision 55197)
+++ ext/-test-/iter/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/iter/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/iter")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/symbol/extconf.rb
===================================================================
--- ext/-test-/symbol/extconf.rb	(revision 55197)
+++ ext/-test-/symbol/extconf.rb	(revision 55198)
@@ -1,8 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/symbol/extconf.rb#L1
 # frozen_string_literal: false
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
+require_relative "../auto_ext.rb"
 have_func("rb_pin_dynamic_symbol")
-create_makefile("-test-/symbol")
+auto_ext
Index: ext/-test-/class/extconf.rb
===================================================================
--- ext/-test-/class/extconf.rb	(revision 55197)
+++ ext/-test-/class/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/class/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/class")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/float/extconf.rb
===================================================================
--- ext/-test-/float/extconf.rb	(revision 55197)
+++ ext/-test-/float/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/float/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/float")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/string/extconf.rb
===================================================================
--- ext/-test-/string/extconf.rb	(revision 55197)
+++ ext/-test-/string/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/string/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/string")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/method/extconf.rb
===================================================================
--- ext/-test-/method/extconf.rb	(revision 55197)
+++ ext/-test-/method/extconf.rb	(revision 55198)
@@ -1,7 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/method/extconf.rb#L1
 # frozen_string_literal: false
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/method")
+require_relative "../auto_ext.rb"
+auto_ext
Index: ext/-test-/bignum/extconf.rb
===================================================================
--- ext/-test-/bignum/extconf.rb	(revision 55197)
+++ ext/-test-/bignum/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/bignum/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/bignum")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/hash/extconf.rb
===================================================================
--- ext/-test-/hash/extconf.rb	(revision 55197)
+++ ext/-test-/hash/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/hash/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/hash")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/debug/extconf.rb
===================================================================
--- ext/-test-/debug/extconf.rb	(revision 55197)
+++ ext/-test-/debug/extconf.rb	(revision 55198)
@@ -1,7 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/debug/extconf.rb#L1
 # frozen_string_literal: false
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/debug")
+require_relative "../auto_ext.rb"
+auto_ext
Index: ext/-test-/auto_ext.rb
===================================================================
--- ext/-test-/auto_ext.rb	(revision 0)
+++ ext/-test-/auto_ext.rb	(revision 55198)
@@ -0,0 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/auto_ext.rb#L1
+# frozen_string_literal: false
+def auto_ext(feat = $0[%r[/ext/-test-/(.*)/extconf.rb\z], 1], inc: false)
+  $INCFLAGS << " -I$(topdir) -I$(top_srcdir)" if inc
+  $srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
+  inits = $srcs.map {|s| File.basename(s, ".*")}
+  inits.delete("init")
+  inits.map! {|s|"X(#{s})"}
+  $defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
+  create_makefile(feat)
+end

Property changes on: ext/-test-/auto_ext.rb
___________________________________________________________________
Added: svn:eol-style
   + LF

Index: ext/-test-/exception/extconf.rb
===================================================================
--- ext/-test-/exception/extconf.rb	(revision 55197)
+++ ext/-test-/exception/extconf.rb	(revision 55198)
@@ -1,7 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/exception/extconf.rb#L1
 # frozen_string_literal: false
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/exception")
+require_relative "../auto_ext.rb"
+auto_ext
Index: ext/-test-/time/extconf.rb
===================================================================
--- ext/-test-/time/extconf.rb	(revision 55197)
+++ ext/-test-/time/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/time/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/time")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/proc/extconf.rb
===================================================================
--- ext/-test-/proc/extconf.rb	(revision 55197)
+++ ext/-test-/proc/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/proc/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/proc")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/file/extconf.rb
===================================================================
--- ext/-test-/file/extconf.rb	(revision 55197)
+++ ext/-test-/file/extconf.rb	(revision 55198)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/file/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
+require_relative "../auto_ext.rb"
 
 headers = %w[sys/param.h sys/mount.h sys/vfs.h].select {|h| have_header(h)}
 if have_type("struct statfs", headers)
@@ -14,9 +14,4 @@ if have_type("struct statvfs", headers) https://github.com/ruby/ruby/blob/trunk/ext/-test-/file/extconf.rb#L14
   have_struct_member("struct statvfs", "f_type", headers)
 end
 
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/file")
+auto_ext(inc: true)
Index: ext/-test-/struct/extconf.rb
===================================================================
--- ext/-test-/struct/extconf.rb	(revision 55197)
+++ ext/-test-/struct/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/struct/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/struct")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)
Index: ext/-test-/integer/extconf.rb
===================================================================
--- ext/-test-/integer/extconf.rb	(revision 55197)
+++ ext/-test-/integer/extconf.rb	(revision 55198)
@@ -1,8 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/integer/extconf.rb#L1
 # frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/integer")
+require_relative "../auto_ext.rb"
+auto_ext(inc: true)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]