module Buildr::SwungWeave

Constants

GROUP
VERSION

Public Class Methods

api_artifact() click to toggle source
# File lib/swung_weave_buildr.rb, line 9
def api_artifact
  "#{GROUP}:swung-weave-api:jar:#{VERSION}"
end
dependencies() click to toggle source
# File lib/swung_weave_buildr.rb, line 32
def dependencies
  [
    # We do not need asm as it is merged into the tool jar
    self.api_artifact,
    "#{GROUP}:swung-weave-tool:jar:#{VERSION}"
  ]
end
enhance(dir, dependencies) click to toggle source
# File lib/swung_weave_buildr.rb, line 13
def enhance(dir, dependencies)
  cp = [dir] + Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s)
  tf = Tempfile.open('swung_weave')
  begin
    tf << Dir["#{dir}/**/*.class"].join("\n")
    tf.close
    args = []
    args << "@#{tf.path}"
    args << "-d"
    args << dir
    args << "--verbose"
    args << "--debug" if Buildr.application.options.trace

    Java::Commands.java 'org.realityforge.swung_weave.tool.Main', *(args + [{:classpath => cp}])
  ensure
    tf.close!
  end
end

Public Instance Methods

swung_weave(buildr_project = nil) click to toggle source
# File lib/swung_weave_buildr.rb, line 45
def swung_weave(buildr_project = nil)
  if buildr_project.nil? && Buildr.application.current_scope.size > 0
    buildr_project = Buildr.project(Buildr.application.current_scope.join(':'))
  end

  if buildr_project.iml?
    buildr_project.iml.add_facet('SwungWeave', 'SwungWeave') do |facet|
      facet.configuration
    end
  end
  buildr_project.compile { buildr_project.swung_weave_enhance }
  buildr_project.compile.with Buildr::SwungWeave.dependencies
end
swung_weave_enhance() click to toggle source
# File lib/swung_weave_buildr.rb, line 41
def swung_weave_enhance
  SwungWeave.enhance(compile.target.to_s, compile.dependencies)
end