Hi Scott (?),

Please open a Jira issue for this contribution at
http://issues.apache.org/jira/browse/Buildr;  this provides a clear legal
trail that you grant the ASF the permission to license your code under the
ASL.

Also, you posted to the old Google mailing list;  see
http://incubator.apache.org/buildr/mailing_lists.html for the new list
addresses

thanks!
alex


On Fri, Apr 18, 2008 at 5:56 AM, <[EMAIL PROTECTED]> wrote:

>
> Used the groovyc compiler plugin as a template.  For the project
> definition, simply use compile.using(:aspectjc).with instead of
> compile.with or whatever.
>
> require 'core/project'
> require 'core/common'
> require 'core/compile'
> require 'java/artifact'
> require 'java/java'
>
> module Buildr
>  module Compiler
>    # Aspectjc compiler:
>    #  compile.using(:aspectjc)
>    #
>    # You need to require 'java/aspectjc' if you need to use this
> compiler.
>    #
>    #
>    # Aspectjc accepts the following options:
>    #
>    # * :encoding          -- Encoding of source files
>    # * :verbose           -- Asks the compiler for verbose output,
> true when running in verbose mode.
>    # * :fork              -- Whether to execute Aspectjc using a
> spawned instance of the JVM; defaults to no
>    # * :memoryInitialSize -- The initial size of the memory for the
> underlying VM, if using fork mode; ignored otherwise.
>    #                                     Defaults to the standard VM
> memory setting. (Examples: 83886080, 81920k, or 80m)
>    # * :memoryMaximumSize -- The maximum size of the memory for the
> underlying VM, if using fork mode; ignored otherwise.
>    #                                     Defaults to the standard VM
> memory setting. (Examples: 83886080, 81920k, or 80m)
>    # * :listfiles         -- Indicates whether the source files to be
> compiled will be listed; defaults to no
>    # * :stacktrace        -- If true each compile error message will
> contain a stacktrace
>    # * :warnings          -- Issue warnings when compiling.  True
> when running in verbose mode.
>    # * :debug             -- Generates bytecode with debugging
> information.  Set from the debug
>    #                                     environment variable/global
> option.
>    # * :deprecation       -- If true, shows deprecation messages.
> False by default.
>    # * :optimise          -- Generates faster bytecode by applying
> optimisations to the program.
>    # * :source            -- Source code compatibility.
>    # * :target            -- Bytecode compatibility.
>    # * :javac             -- Hash of options passed to the ant javac
> task
>    class Aspectjc < Base
>
>      # Which groovy version to use?
>      # VERSION = "1.5.3" unless const_defined?('VERSION')
>
>      REQUIRES = Buildr.struct(
>        :aspectj => "aspectj:aspectjrt:jar:1.5.3",
>        :aspectjlib => "aspectj:aspectjlib:jar:1.5.3",
>        :aspectjant => "aspectj:aspectj-ant:jar:1.0.6",
>        :aspectjweaver => "aspectj:aspectjweaver:jar:1.5.3",
>        :aspectjtools =>"aspectj:aspectjtools:jar:1.5.3"
>      ) unless const_defined?('REQUIRES')
>
>
>      ANT_TASK = 'org.aspectj.tools.ant.taskdefs.AjcTask'
>
>      ASPECTJC_OPTIONS =
> [:srcdir , :classpath, :destDir , :maxmem , :verbose , :Xlint,
> :showWeaveInfo, :source, :target  ]
>      OPTIONS = ASPECTJC_OPTIONS
>
>      class << self
>        def dependencies #:nodoc:
>          Buildr.artifacts(REQUIRES)
>        end
>
>        def applies_to?(project, task) #:nodoc:
>          paths = task.sources + [sources].flatten.map { |src|
> Array(project.path_to(:source, task.usage, src.to_sym)) }
>          paths.flatten!
>          # Just select if we find .java files
>          paths.any? { |path| !Dir["#{path}/**/*.java"].empty? }
>        end
>      end
>
>      Java.classpath << dependencies
>
>      specify :language => :java, :sources => [:java], :source_ext =>
> [:java],
>              :target => 'classes', :target_ext => 'class', :packaging
> => :jar
>
>      def initialize(project, options) #:nodoc:
>        super
>        #options[:debug] = Buildr.options.debug if
> options[:debug].nil?
>        #options[:deprecation] ||= false
>        #options[:optimise] ||= false
>        options[:source] = '5.0' if options[:source].nil?
>        options[:verbose] ||= Rake.application.options.trace if
> options[:verbose].nil?
>        #options[:warnings] = verbose if options[:warnings].nil?
>        # options[:javac] = OpenObject.new if options[:javac].nil?
>      end
>
>      # http://groovy.codehaus.org/The+Aspectjc+Ant+Task
>      def compile(sources, target, dependencies) #:nodoc:
>        return if Rake.application.options.dryrun
>        Buildr.ant 'aspectjc' do |ant|
>          classpath = dependencies |
> self.class.dependencies.map(&:to_s)
>          ant.taskdef :name => 'aspectjc', :classname =>
> ANT_TASK, :classpath => classpath.join(File::PATH_SEPARATOR)
>          ant.aspectjc aspectjc_options(sources, target) do
>            sources.each { |src| ant.src :path => src }
>            ant.classpath do
>              classpath.each { |dep| ant.pathelement :path => dep }
>            end
>          end
>        end
>      end
>
>     private
>      def aspectjc_options(sources, target)
>        check_options options, OPTIONS
>        aspectjc_options = options.only(*ASPECTJC_OPTIONS)
>        aspectjc_options[:destdir] = File.expand_path(target)
>        aspectjc_options[:source] = '1.5'
>        aspectjc_options
>      end
>
>    end
>  end
> end
>
> Buildr::Compiler.compilers.unshift Buildr::Compiler::Aspectjc
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "buildr-talk" group.
> To post to this group, send email to [EMAIL PROTECTED]
> To unsubscribe from this group, send email to
> [EMAIL PROTECTED]
> For more options, visit this group at
> http://groups.google.com/group/buildr-talk?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>

Reply via email to