Class: CompilerApp

Inherits:
JRubyFX::Application show all
Defined in:
lib/jrubyfx/compiler_app.rb

Overview

This class is used by the rake task to compile fxml files

Constant Summary

Constants included from JRubyFX::DSL

JRubyFX::DSL::NAME_TO_CLASSES, JRubyFX::DSL::NAME_TO_CLASS_NAME

Constants included from JRubyFX::FXImports

JRubyFX::FXImports::JFX_CLASS_HIERARCHY, JRubyFX::FXImports::LOCAL_NAME_MAP

Constants included from JRubyFX

JRubyFX::VERSION

Instance Method Summary collapse

Methods inherited from JRubyFX::Application

in_jar?, launch

Methods included from JRubyFX::DSL

compile_dsl, included, load_dsl, #logical_lookup, #method_missing, #self_test_lookup, write_color_method_converter, write_enum_converter, write_enum_method_converter, write_event_method

Methods included from JRubyFX::FXImports

#const_missing

Methods included from JRubyFX

#build, included, load_fx, #run_later, #with

Methods included from JRubyFX::Utils::CommonUtils

#attempt_conversion, #populate_properties, #split_args_from_properties

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JRubyFX::DSL

Instance Method Details

#split(arr, delim) ⇒ Object



45
46
47
48
49
50
# File 'lib/jrubyfx/compiler_app.rb', line 45

def split(arr, delim)
  index = arr.index(delim)
  first = arr[0...index]
  second = arr[(index+1)..-1]
  return first, second
end

#start(stage) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/jrubyfx/compiler_app.rb', line 21

def start(stage)
  begin
    args = parameters.raw.to_a
    if args.include? "--"
      ar, requires = split(args, "--")
      requires.each {|x| require x}
      ar
    else
      args
    end.each do |arg|
      loader = FxmlLoader.new
      loader.location = URL.new "file:#{arg}"
      loader.controller = Object.new
      puts "Compiling #{arg}..."
      loader.load(jruby_ext: {jit: 0, dont_load: true, jit_opts: {force: true}})
    end
    puts "done"
  rescue java.lang.Throwable, Exception => e
    $JRUBYFX_AOT_ERROR = e
  ensure
    Platform.exit
  end
end