[Rubycocoa-devel 478] Re: loading bridge-support behavior

Zurück zum Archiv-Index

Laurent Sansonetti lsans****@apple*****
Sat Dec 9 11:47:44 JST 2006


On Dec 9, 2006, at 2:46 AM, kimura wataru wrote:

> Hi,
>
> I feel inconvenience to install BridgeSupport files before
> running tests.
>
> I wrote a patch for the apple-unstable branch to change
> loading bridge-support files.
>
> * add search path (SIGN_PATHS) from the environment
>   RUBYCOCOA_BRIDGESUPPORT_PATH
> * reverse search order of SIGN_PATHS in oc_import.rb
>

This is a good idea. I slightly modified your patch and applied it.

* I used BRIDGE_SUPPORT_PATH because it's more generic (we might want  
to tell the PyObjC guys so that they can use the same variable name).
* BRIDGE_SUPPORT_PATH can contain multiple paths, separated with ":"
* These paths are used first in priority before anything else (even  
before the bridge support files inside the frameworks)

Index: framework/src/ruby/osx/objc/oc_import.rb
===================================================================
--- framework/src/ruby/osx/objc/oc_import.rb    (revision 1262)
+++ framework/src/ruby/osx/objc/oc_import.rb    (working copy)
@@ -18,6 +18,13 @@
      '/Library/BridgeSupport'
    ]

+  PRE_SIGN_PATHS =
+    if path = ENV['BRIDGE_SUPPORT_PATH']
+      path.split(':')
+    else
+      []
+    end
+
    if path = ENV['HOME']
      FRAMEWORK_PATHS << File.join(ENV['HOME'], 'Library', 'Frameworks')
      SIGN_PATHS << File.join(ENV['HOME'], 'Library', 'BridgeSupport')
@@ -47,6 +54,16 @@
    end

    def OSX.load_bridge_support_signatures(framework)
+    # First, look into the pre paths.
+    framework_name = framework[0] == ?/ ? File.basename(framework,  
'.framework') : framework
+    PRE_SIGN_PATHS.each do |dir|
+      path = File.join(dir, framework_name + '.xml')
+      if File.exists?(path)
+        load_bridge_support_file(path)
+        return true
+      end
+    end
+
      # A path to a framework, let's search for BridgeSupport.xml  
inside the Resources folder.
      if framework[0] == ?/
        path = File.join(framework, 'Resources', 'BridgeSupport.xml')
@@ -54,7 +71,7 @@
          load_bridge_support_file(path)
          return true
        end
-      framework = File.basename(framework, '.framework')
+      framework = framework_name
      end

      # Let's try to localize the framework and see if it contains the  
metadata.

Laurent

PS: I also fixed a typo in the previous commit

-      command config('make-prog') + ' -f Makefile.rubyccoa clean'
+      command config('make-prog') + ' -f Makefile.rubycocoa clean'




More information about the Rubycocoa-devel mailing list
Zurück zum Archiv-Index