Attached patch fixes (well, at least a bit of) Rake build. In
particular, this patch fixes get_case_sensitive_path to actually work.
Current code does p.downcase.to_s == filename, which assumes filename
is already downcased, but filename is from *.csproj and it actually is
not, so at least it should be p.downcase == filename.downcase. Current
code also does not deal with directory names differing in case.

-- 
Seo Sanghyeon
Index: Rakefile
===================================================================
--- Rakefile	(revision 169)
+++ Rakefile	(working copy)
@@ -272,7 +272,7 @@
 desc "compile extension attribute assembly" 
 task :compile_extension_attributes => [:clean_build] do
   IronRuby.source_context do
-    compile :dlr_core, :references => ['!System.dll'], :switches => ['target:library'], :output => 'Microsoft.Scripting.ExtensionAttribute.dll', :csproj => 'Microsoft.Scripting.ExtensionAttribute.csproj'
+    compile :dlr_core, :references => ['!System.dll'], :switches => ['target:library'], :output => 'Microsoft.Scripting.ExtensionAttribute.dll', :csproj => 'microsoft.scripting.extensionattribute.csproj'
   end
 end
 
Index: context.rb
===================================================================
--- context.rb	(revision 169)
+++ context.rb	(working copy)
@@ -458,10 +458,13 @@
     end
 
     def get_case_sensitive_path(pathname)
-      filename = pathname.basename.downcase
-      dir = Pathname.new pathname.dirname
-      result = dir.entries.find { |p| p.downcase.to_s == filename }
-      (Pathname.new(pathname.dirname) + result).to_s
+      elements = pathname.split '\\'
+      result = Pathname.new '.'
+      elements.each do |element|
+        entry = result.entries.find { |p| p.downcase == element.downcase }
+        result = result + entry
+      end
+      result.to_s
     end
 
     def get_compile_path_list(csproj)
@@ -469,12 +472,12 @@
       cs_proj_files = Dir[csproj]
       if cs_proj_files.length == 1
         doc = REXML::Document.new(File.open(cs_proj_files.first))
-        result = doc.elements.collect("/Project/ItemGroup/Compile") { |c| "\"#{c.attributes['Include']}\"" }
+        result = doc.elements.collect("/Project/ItemGroup/Compile") { |c| c.attributes['Include'] }
         result.delete_if { |e| e =~ /Silverlight\\SilverlightVersion.cs/ }
         if ENV['mono'].nil?
           result
         else
-          result.map { |p| get_case_sensitive_path(p).gsub('\\', '/') }
+          result.map { |p| get_case_sensitive_path(p) }
         end
       else
         raise ArgumentError.new("Found more than one .csproj file in directory! #{cs_proj_files.join(", ")}")
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to