buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maarten Billemont <lhun...@gmail.com>
Subject Generation of .classpath eclipse files does not take resource exclusions into account.
Date Sun, 06 Apr 2008 12:52:50 GMT
The following patch fixes this issue; I'm sure something just as  
simple can be done for inclusions though I haven't given it much  
thought yet:

--- /Gentoo/usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/core/ 
common.rb 2008-04-06 14:48:16 +0200
+++ /Gentoo/usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/core/ 
common.rb~        2008-04-06 14:43:37 +0200
@@ -310,8 +310,8 @@
    class Filter

      def initialize() #:nodoc:
-      @includes = []
-      @excludes = []
+      @include = []
+      @exclude = []
        @sources = []
      end

@@ -357,9 +357,6 @@
        self
      end

-    # The patterns this filter must include.
-    attr_reader :includes
-
      # :call-seq:
      #   include(*files) => self
      #
@@ -368,20 +365,17 @@
      # By default all files are included. You can use this method to  
only include specific
      # files form the source directory.
      def include(*files)
-      @includes += files
+      @include += files
        self
      end
-    alias :add :include
-
-    # The patterns this filter must exclude.
-    attr_reader :excludes
+    alias :add :include

      # :call-seq:
      #   exclude(*files) => self
      #
      # Specifies files to exclude and returns self. See  
FileList#exclude.
      def exclude(*files)
-      @excludes += files
+      @exclude += files
        self
      end

@@ -444,8 +438,8 @@
          base = Pathname.new(source)
          files = FileList.recursive(source).
            map { |file|  
Pathname.new(file).relative_path_from(base).to_s }.
-          select { |file| @includes.empty? || @includes.any? { | 
pattern| File.fnmatch(pattern, file) } }.
-          reject { |file| @excludes.any? { |pattern|  
File.fnmatch(pattern, file) } }
+          select { |file| @include.empty? || @include.any? { | 
pattern| File.fnmatch(pattern, file) } }.
+          reject { |file| @exclude.any? { |pattern|  
File.fnmatch(pattern, file) } }
          files.each do |file|
            src, dest = File.expand_path(file, source),  
File.expand_path(file, target.to_s)
            map[file] = src if !File.exist?(dest) ||  
File.stat(src).mtime > File.stat(dest).mtime

--- /Gentoo/usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/java/ 
eclipse.rb~       2008-04-06 14:44:47 +0200
+++ /Gentoo/usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/java/ 
eclipse.rb        2008-04-06 14:50:07 +0200
@@ -43,6 +43,9 @@

            m2repo = Buildr::Repositories.instance.local
            excludes = [ '**/.svn/', '**/CVS/' ].join('|')
+          if project.resources.filter.excludes.size > 0
+              excludes += "|" +  
project.resources.filter.excludes.join('|')
+          end

            File.open(task.name, "w") do |file|
              xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)


Mime
View raw message