Class: Javac

Inherits:
JavaTask show all
Defined in:
lib/jake/javac.rb

Instance Attribute Summary collapse

Attributes inherited from JavaTask

#base_dir

Instance Method Summary collapse

Methods inherited from JavaTask

#execute, in

Constructor Details

#initialize(path) ⇒ Javac

Returns a new instance of Javac.



4
5
6
7
# File 'lib/jake/javac.rb', line 4

def initialize(path)
  super(path)
  @cp = []
end

Instance Attribute Details

#cpObject

Returns the value of attribute cp.



2
3
4
# File 'lib/jake/javac.rb', line 2

def cp
  @cp
end

#outputObject

Returns the value of attribute output.



2
3
4
# File 'lib/jake/javac.rb', line 2

def output
  @output
end

#srcObject

Returns the value of attribute src.



2
3
4
# File 'lib/jake/javac.rb', line 2

def src
  @src
end

Instance Method Details

#commandObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jake/javac.rb', line 9

def command
  classpath = []

  @src = Dir.glob(@src)
  @cp.each do |p|
    puts "Globbing #{p}"
    classpath << Dir.glob(p)
    puts "CP = #{classpath}"
  end

  FileUtils.mkdir_p(@output) unless File.exist? @output
    "javac " + @src.join(' ').to_s + " -cp " + classpath.join(cp_separator).to_s + " -d " + @output
end