class Buildr::Eclipse::Eclipse

Attributes

name[W]
options[R]

Public Class Methods

new(project) click to toggle source
# File lib/buildr/ide/eclipse.rb, line 25
def initialize(project)
  @project = project
  @options = Options.new(project)
end

Public Instance Methods

builders() → [b1, b2] click to toggle source
Returns the Eclipse project builders on the project.
They may be derived from the parent project if no specific builders have been set
on the project.

A builder is an Eclipse background job that parses the source code to produce built artifacts.

# File lib/buildr/ide/eclipse.rb, line 143
def builders(*values)
  if values.size > 0
    @builders ||= []
    @builders += values.flatten
  else
    @builders || (@project.parent ? @project.parent.eclipse.builders : [])
  end
end
builders=(builders) click to toggle source
Sets the Eclipse project builders on the project.
# File lib/buildr/ide/eclipse.rb, line 132
def builders=(var)
  @builders = arrayfy(var)
end
classpath_containers() → [con1, con2] click to toggle source
Returns the Eclipse project classpath containers on the project.
They may be derived from the parent project if no specific classpath containers have been set
on the project.

A classpath container is an Eclipse pre-determined ensemble of dependencies made available to the project classpath.

# File lib/buildr/ide/eclipse.rb, line 99
def classpath_containers(*values)
  if values.size > 0
    @classpath_containers ||= []
    @classpath_containers += values.flatten
  else
    @classpath_containers || (@project.parent ? @project.parent.eclipse.classpath_containers : [])
  end
end
classpath_containers=(cc) click to toggle source
Sets the Eclipse project classpath containers on the project.
# File lib/buildr/ide/eclipse.rb, line 87
def classpath_containers=(var)
  @classpath_containers = arrayfy(var)
end
classpath_variables :VAR → '/path/to/location' click to toggle source
Sets classpath variables to be used for library path substitution
on the project.
# File lib/buildr/ide/eclipse.rb, line 41
def classpath_variables(*values)
  fail "eclipse.classpath_variables expects a single hash argument" if values.size > 1
  if values.size == 1
    fail "eclipse.classpath_variables expects a Hash argument" unless values[0].is_a? Hash
    # convert keys to strings
    values = values[0].inject({}) { |h, (k,v)| h[k.to_s] = @project.path_to(v); h }
    @variables = values.merge(@variables || {})
  end
  @variables || (@project.parent ? @project.parent.eclipse.classpath_variables : default_classpath_variables)
end
default_classpath_variables() click to toggle source
# File lib/buildr/ide/eclipse.rb, line 52
def default_classpath_variables
  vars = {}
  vars[:SCALA_HOME] = ENV['SCALA_HOME'] if ENV['SCALA_HOME']
  vars[:JAVA_HOME]  = ENV['JAVA_HOME']  if ENV['JAVA_HOME']
  vars
end
exclude_libs() → [lib1, lib2] click to toggle source
Returns the an array of libraries to be excluded from the generated Eclipse classpath
# File lib/buildr/ide/eclipse.rb, line 111
def exclude_libs(*values)
  if values.size > 0
    @exclude_libs ||= []
    @exclude_libs += values.flatten
  else
    @exclude_libs || (@project.parent ? @project.parent.eclipse.exclude_libs : [])
  end
end
exclude_libs=(lib1, lib2) click to toggle source
Sets libraries to be excluded from the generated Eclipse classpath
# File lib/buildr/ide/eclipse.rb, line 124
def exclude_libs=(libs)
  @exclude_libs = arrayfy(libs)
end
name() click to toggle source
# File lib/buildr/ide/eclipse.rb, line 30
def name
  return @name if @name
  return @project.id.split('-').last if @options.short_names
  @project.id
end
natures() → [n1, n2] click to toggle source
Returns the Eclipse project natures on the project.
They may be derived from the parent project if no specific natures have been set
on the project.

An Eclipse project nature is used internally by Eclipse to determine the aspects of a project.

# File lib/buildr/ide/eclipse.rb, line 74
def natures(*values)
  if values.size > 0
    @natures ||= []
    @natures += values.flatten
  else
    @natures || (@project.parent ? @project.parent.eclipse.natures : [])
  end
end
natures=(natures) click to toggle source
Sets the Eclipse project natures on the project.
# File lib/buildr/ide/eclipse.rb, line 63
def natures=(var)
  @natures = arrayfy(var)
end