jrubyfx-openjfx.patch 1.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/README.md +121 -0
  4. data/bin/jrubyfx-compile +32 -0
  5. data/bin/jrubyfx-generator +98 -0
  6. data/bin/jrubyfx-jarify +115 -0
  7. data/lib/jrubyfx.rb +41 -0
  8. data/lib/jrubyfx/application.rb +42 -0
  9. data/lib/jrubyfx/compiler_app.rb +51 -0
  10. data/lib/jrubyfx/controller.rb +375 -0
  11. data/lib/jrubyfx/core_ext/border_pane.rb +30 -0
  12. data/lib/jrubyfx/core_ext/column_constraints.rb +43 -0
  13. data/lib/jrubyfx/core_ext/drag_event.rb +32 -0
  14. data/lib/jrubyfx/core_ext/duration.rb +30 -0
  15. data/lib/jrubyfx/core_ext/effects.rb +32 -0
  16. data/lib/jrubyfx/core_ext/exts.yml +57 -0
  17. data/lib/jrubyfx/core_ext/file_chooser.rb +63 -0
  18. data/lib/jrubyfx/core_ext/geometry.rb +27 -0
  19. data/lib/jrubyfx/core_ext/grid_pane.rb +30 -0
  20. data/lib/jrubyfx/core_ext/image_view.rb +25 -0
  21. data/lib/jrubyfx/core_ext/media_player.rb +25 -0
  22. data/lib/jrubyfx/core_ext/observable_value.rb +158 -0
  23. data/lib/jrubyfx/core_ext/pagination.rb +28 -0
  24. data/lib/jrubyfx/core_ext/path.rb +37 -0
  25. data/lib/jrubyfx/core_ext/precompiled.rb +1883 -0
  26. data/lib/jrubyfx/core_ext/progress_indicator.rb +41 -0
  27. data/lib/jrubyfx/core_ext/radial_gradient.rb +37 -0
  28. data/lib/jrubyfx/core_ext/region.rb +42 -0
  29. data/lib/jrubyfx/core_ext/rotate.rb +39 -0
  30. data/lib/jrubyfx/core_ext/stage.rb +89 -0
  31. data/lib/jrubyfx/core_ext/table_view.rb +31 -0
  32. data/lib/jrubyfx/core_ext/timeline.rb +56 -0
  33. data/lib/jrubyfx/core_ext/transition.rb +26 -0
  34. data/lib/jrubyfx/core_ext/tree_view.rb +40 -0
  35. data/lib/jrubyfx/core_ext/xy_chart.rb +53 -0
  36. data/lib/jrubyfx/dsl.rb +330 -0
  37. data/lib/jrubyfx/dsl_control.rb +28 -0
  38. data/lib/jrubyfx/dsl_map.rb +273 -0
  39. data/lib/jrubyfx/imports.rb +324 -0
  40. data/lib/jrubyfx/java_fx_impl.rb +144 -0
  41. data/lib/jrubyfx/module.rb +178 -0
  42. data/lib/jrubyfx/part_imports.rb +141 -0
  43. data/lib/jrubyfx/utils.rb +86 -0
  44. data/lib/jrubyfx/utils/__ignore_java_stupid_rdoc.rb +30 -0
  45. data/lib/jrubyfx/utils/common_converters.rb +223 -0
  46. data/lib/jrubyfx/utils/common_utils.rb +72 -0
  47. data/lib/jrubyfx/utils/string_utils.rb +48 -0
  48. data/lib/jrubyfx/version.rb +4 -0
  49. data/lib/jrubyfx_tasks.rb +183 -0
  50. metadata +145 -0
@@ -0,0 +1,72 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+ require_relative 'common_converters'
18
+
19
+ module JRubyFX
20
+ # Several utilities that have no better place to go
21
+ module Utils
22
+ # Utilities to manage argument properties for build/with
23
+ module CommonUtils
24
+ ##
25
+ # If last argument of the arg list is a hash-like entity (:each_pair)
26
+ # then this strip off last argument and return it as second return
27
+ # value.
28
+ # === Examples:
29
+ # split_args_from_properties(1, 2, a: 1) #=> [[1,2], {a: 1}]
30
+ # split_args_from_properties(1, 2) #=> [[1,2], {}]
31
+ #
32
+ def split_args_from_properties(*args)
33
+ if !args.empty? and args.last.respond_to? :each_pair
34
+ properties = args.pop
35
+ else
36
+ properties = {}
37
+ end
38
+
39
+ return args, properties
40
+ end
41
+
42
+ ##
43
+ # Sets the hashmap given on the passed in object as a set of properties,
44
+ # using converter if necessary.
45
+ #
46
+ def populate_properties(obj, properties)
47
+ properties.each_pair do |name, value|
48
+ obj.send(name.to_s + '=', *attempt_conversion(obj, name, value))
49
+ end
50
+ obj
51
+ end
52
+
53
+ ##
54
+ # Attempts to convert given value to JavaFX equvalent, if any, by calling
55
+ # obj.name_CommonConverters::ARG_CONVERTER_SUFFING, which is created by
56
+ # calling CommonConverters.converter_for in your class.
57
+ # See CommonConverters for current conversions
58
+ #
59
+ def attempt_conversion(obj, name, *values)
60
+ converter_method = name.to_s +
61
+ JRubyFX::Utils::CommonConverters::ARG_CONVERTER_SUFFIX
62
+
63
+ # Each type can create their own converter method to coerce things
64
+ # like symbols into real values JavaFX likes.
65
+ if obj.respond_to? converter_method
66
+ values = obj.__send__ converter_method, *values
67
+ end
68
+ values
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,48 @@
1
+ class String
2
+
3
+ # steal handy methods from activesupport
4
+ # Tries to find a constant with the name specified in the argument string.
5
+ #
6
+ # 'Module'.constantize # => Module
7
+ # 'Test::Unit'.constantize # => Test::Unit
8
+ #
9
+ # The name is assumed to be the one of a top-level constant, no matter
10
+ # whether it starts with "::" or not. No lexical context is taken into
11
+ # account:
12
+ #
13
+ # C = 'outside'
14
+ # module M
15
+ # C = 'inside'
16
+ # C # => 'inside'
17
+ # 'C'.constantize # => 'outside', same as ::C
18
+ # end
19
+ #
20
+ # NameError is raised when the name is not in CamelCase or the constant is
21
+ # unknown.
22
+ def constantize_by(splitter="::")
23
+ camel_cased_word = self
24
+ names = camel_cased_word.split(splitter)
25
+ names.shift if names.empty? || names.first.empty?
26
+
27
+ names.inject(Object) do |constant, name|
28
+ if constant == Object
29
+ constant.const_get(name)
30
+ else
31
+ candidate = constant.const_get(name)
32
+ next candidate if constant.const_defined?(name, false)
33
+ next candidate unless Object.const_defined?(name)
34
+
35
+ # Go down the ancestors to check it it's owned
36
+ # directly before we reach Object or the end of ancestors.
37
+ constant = constant.ancestors.inject do |const, ancestor|
38
+ break const if ancestor == Object
39
+ break ancestor if ancestor.const_defined?(name, false)
40
+ const
41
+ end
42
+
43
+ # owner is in Object, so raise
44
+ constant.const_get(name, false)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,4 @@
1
+ module JRubyFX
2
+ # Current gem version. Used in rake task.
3
+ VERSION='1.2.0'
4
+ end
@@ -0,0 +1,183 @@
1
+ =begin
2
+ JRubyFX - Write JavaFX and FXML in Ruby
3
+ Copyright (C) 2013 The JRubyFX Team
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ =end
17
+
18
+ # DO NOT INCLUDE ANY JRUBYFX CODE DIRECTLY!!! THIS IS A RAKEFILE EXTENSION!!!
19
+ require 'open-uri'
20
+ require 'rake'
21
+ require 'tmpdir'
22
+ require "pathname"
23
+
24
+ module JRubyFX
25
+ # This module contains utilities to jarify an app, and can be used in a rakefile or a running app.
26
+ module Tasks
27
+ extend Rake::DSL
28
+ # Base URL of JRuby-complete.jar download location
29
+ BASE_URL='http://jruby.org.s3.amazonaws.com/downloads'
30
+
31
+ ##
32
+ # Downloads the jruby-complete jar file for `jruby_version` and save in
33
+ # ~/.jruby-jar/jruby-complete.jar unless it already exits. If the jar is
34
+ # corrupt or an older version, set force to true to delete and re-download
35
+ def download_jruby(jruby_version, force=false)
36
+ dist = "#{Dir.home}/.jruby-jar"
37
+ unless force || (File.exists?("#{dist}/jruby-complete-#{jruby_version}.jar") && File.size("#{dist}/jruby-complete-#{jruby_version}.jar") > 0)
38
+ mkdir_p dist
39
+ base_dir = Dir.pwd
40
+ cd dist
41
+ $stderr.puts "JRuby complete jar not found. Downloading... (May take awhile)"
42
+ download(jruby_version)
43
+ cd base_dir
44
+ end
45
+ end
46
+
47
+ ##
48
+ # Creates a full jar from the given source pattern (must be a pattern to match
49
+ # files), with the given main script as the script to launch when the jarfile
50
+ # is run. The output jar is saved in the `target` dir, which also doubles as a
51
+ # temporary work dir. `jar` is the executable that makes jars. If `target` is
52
+ # nill then a random temporary directory is created, and output_jar is the
53
+ # full path to the jar file to save
54
+ def jarify_jrubyfx(src="src/*" ,main_script=nil, target="target", output_jar="jrubyfx-app.jar", opts = {})
55
+ if target_was_nil = target == nil
56
+ target = Dir.mktmpdir("jrubyfx")
57
+ final_jar = output_jar
58
+ output_jar = File.basename output_jar
59
+ end
60
+ # set defaults
61
+ opts = {file_filter: ->(f){true},jar: "jar"}.merge(opts)
62
+
63
+ mkdir_p target
64
+
65
+ #copy jruby jar file in, along with script and our rb files
66
+ cp "#{ENV['HOME']}/.jruby-jar/jruby-complete-#{opts[:version] || JRUBY_VERSION}.jar", "#{target}/#{output_jar}"
67
+
68
+ #copy source in
69
+ FileList[src].each do |iv_srv|
70
+ cp_r iv_srv, "#{target}/#{File.basename(iv_srv)}" if (main_script == nil || main_script != iv_srv) && opts[:file_filter].call(iv_srv)
71
+ end
72
+ cp main_script, "#{target}/jar-bootstrap.rb" unless main_script == nil
73
+
74
+ unless File.exists? "#{target}/jar-bootstrap.rb"
75
+ $stderr.puts "@"*79
76
+ $stderr.puts "@#{"!!!WARNING!!!".center(79-2)}@"
77
+ $stderr.puts "@#{"jar-bootstrap.rb NOT FOUND!".center(79-2)}@"
78
+ $stderr.puts "@#{"Did you set main_src= or have jar-bootstrap in src= ?".center(79-2)}@"
79
+ $stderr.puts "@"*79
80
+ end
81
+
82
+ #copy our libs in
83
+ FileList["#{File.dirname(__FILE__)}/*"].each do |librb|
84
+ cp_r librb, target
85
+ end
86
+
87
+ fxml_loader_path = nil
88
+ # this will find it if we are calling ruby -I whatever
89
+ $LOAD_PATH.each do |pth|
90
+ if File.exist? File.join(pth, "jrubyfx-fxmlloader.rb")
91
+ fxml_loader_path = pth
92
+ break
93
+ end
94
+ end
95
+
96
+ # default to gems
97
+ unless fxml_loader_path
98
+ fxml_loader_path = File.join(Gem::Specification.find_by_path('jrubyfx-fxmlloader').full_gem_path, "lib")
99
+ end
100
+ #copy fxmlloader in
101
+ FileList["#{fxml_loader_path}/*"].each do |librb|
102
+ cp_r librb, target
103
+ end
104
+
105
+ # edit the jar
106
+ base_dir = Dir.pwd
107
+ cd target
108
+ sh "#{opts[:jar]} ufe '#{output_jar}' org.jruby.JarBootstrapMain *"
109
+ chmod 0775, output_jar
110
+ cd base_dir
111
+
112
+ if target_was_nil
113
+ mv "#{target}/#{output_jar}", final_jar
114
+ rm_rf target
115
+ end
116
+ end
117
+
118
+ # Uses Java 8 Ant task to create a native bundle (exe, deb, rpm, etc) of the
119
+ # specified jar-ified ruby script
120
+ def native_bundles(base_dir=Dir.pwd, output_jar, verbosity, app_name)
121
+ # Currently only JDK8 will package up JRuby apps. In the near
122
+ # future the necessary tools will be in maven central and
123
+ # we can download them as needed, so this can be changed then.
124
+ # this is in format "1.7.0_11-b21", check for all jdk's less than 8
125
+ if ENV_JAVA["java.runtime.version"].match(/^1\.[0-7]{1}\..*/)
126
+ raise "You must install JDK 8 to use the native-bundle packaging tools. You can still create an executable jar, though."
127
+ end
128
+
129
+ # the native bundling uses ant
130
+ require "ant"
131
+
132
+ output_jar = Pathname.new(output_jar)
133
+ dist_dir = output_jar.parent
134
+ jar_name = File.basename(output_jar)
135
+ out_name = File.basename(output_jar, '.*')
136
+
137
+ # Can't access the "fx" xml namespace directly, so we get it via __send__.
138
+ ant do
139
+ taskdef(resource: "com/sun/javafx/tools/ant/antlib.xml",
140
+ uri: "javafx:com.sun.javafx.tools.ant",
141
+ classpath: ".:${java.home}/../lib/ant-javafx.jar")
142
+ __send__("javafx:com.sun.javafx.tools.ant:deploy", nativeBundles: "all",
143
+ width: "100", height: "100", outdir: "#{base_dir}/build/",
144
+ outfile: out_name, verbose: verbosity) do
145
+ application(mainClass: "org.jruby.JarBootstrapMain", name: app_name)
146
+ resources do
147
+ fileset(dir: dist_dir) do
148
+ include name: jar_name
149
+ end
150
+ end
151
+ end
152
+ end
153
+
154
+ # These webstart files don't work, and the packager doesn't have an option to
155
+ # disable them, so remove them so the user isn't confused.
156
+ # FIXME: jnlp webstart
157
+ full_build_dir = "#{base_dir}/build/"
158
+ rm FileList["#{full_build_dir}*.html","#{full_build_dir}*.jnlp"]
159
+ end
160
+
161
+ def compile(cmdline)
162
+ require 'jrubyfx/compiler_app'
163
+ $JRUBYFX_AOT_COMPILING = true
164
+ $JRUBYFX_AOT_ERROR = false
165
+ CompilerApp.launch(*cmdline) # must use this to provide a full javafx environ so controls will build properly
166
+ raise $JRUBYFX_AOT_ERROR if $JRUBYFX_AOT_ERROR
167
+ end
168
+
169
+
170
+ private
171
+ def download(version_string) #:nodoc:
172
+ File.open("jruby-complete-#{version_string}.jar","wb") do |f|
173
+ f.write(open("#{BASE_URL}/#{version_string}/jruby-complete-#{version_string}.jar").read)
174
+ end
175
+ end
176
+
177
+ module_function :jarify_jrubyfx
178
+ module_function :download_jruby
179
+ module_function :native_bundles
180
+ module_function :download
181
+ module_function :compile
182
+ end
183
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jrubyfx-openjfx.patch
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: java
6
+ authors:
7
+ - Patrick Plenefisch
8
+ - Thomas E Enebo
9
+ - Hiroshi Nakamura
10
+ - Hiro Asari
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2020-11-25 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ name: rake
23
+ prerelease: false
24
+ type: :development
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ name: rspec
37
+ prerelease: false
38
+ type: :development
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ - !ruby/object:Gem::Dependency
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0.4'
50
+ name: jrubyfx-fxmlloader-openjfx.patch
51
+ prerelease: false
52
+ type: :runtime
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0.4'
58
+ description: Enables JavaFX with FXML controllers and application in pure ruby. This
59
+ is temporary to support OpenJFX. Once version higher than 1.2.0 this should not
60
+ be used.
61
+ email:
62
+ - simonpatp@gmail.com
63
+ - tom.enebo@gmail.com
64
+ - nahi@ruby-lang.org
65
+ - asari.ruby@gmail.com
66
+ executables:
67
+ - jrubyfx-generator
68
+ - jrubyfx-jarify
69
+ - jrubyfx-compile
70
+ extensions: []
71
+ extra_rdoc_files: []
72
+ files:
73
+ - LICENSE
74
+ - README.md
75
+ - bin/jrubyfx-compile
76
+ - bin/jrubyfx-generator
77
+ - bin/jrubyfx-jarify
78
+ - lib/jrubyfx.rb
79
+ - lib/jrubyfx/application.rb
80
+ - lib/jrubyfx/compiler_app.rb
81
+ - lib/jrubyfx/controller.rb
82
+ - lib/jrubyfx/core_ext/border_pane.rb
83
+ - lib/jrubyfx/core_ext/column_constraints.rb
84
+ - lib/jrubyfx/core_ext/drag_event.rb
85
+ - lib/jrubyfx/core_ext/duration.rb
86
+ - lib/jrubyfx/core_ext/effects.rb
87
+ - lib/jrubyfx/core_ext/exts.yml
88
+ - lib/jrubyfx/core_ext/file_chooser.rb
89
+ - lib/jrubyfx/core_ext/geometry.rb
90
+ - lib/jrubyfx/core_ext/grid_pane.rb
91
+ - lib/jrubyfx/core_ext/image_view.rb
92
+ - lib/jrubyfx/core_ext/media_player.rb
93
+ - lib/jrubyfx/core_ext/observable_value.rb
94
+ - lib/jrubyfx/core_ext/pagination.rb
95
+ - lib/jrubyfx/core_ext/path.rb
96
+ - lib/jrubyfx/core_ext/precompiled.rb
97
+ - lib/jrubyfx/core_ext/progress_indicator.rb
98
+ - lib/jrubyfx/core_ext/radial_gradient.rb
99
+ - lib/jrubyfx/core_ext/region.rb
100
+ - lib/jrubyfx/core_ext/rotate.rb
101
+ - lib/jrubyfx/core_ext/stage.rb
102
+ - lib/jrubyfx/core_ext/table_view.rb
103
+ - lib/jrubyfx/core_ext/timeline.rb
104
+ - lib/jrubyfx/core_ext/transition.rb
105
+ - lib/jrubyfx/core_ext/tree_view.rb
106
+ - lib/jrubyfx/core_ext/xy_chart.rb
107
+ - lib/jrubyfx/dsl.rb
108
+ - lib/jrubyfx/dsl_control.rb
109
+ - lib/jrubyfx/dsl_map.rb
110
+ - lib/jrubyfx/imports.rb
111
+ - lib/jrubyfx/java_fx_impl.rb
112
+ - lib/jrubyfx/module.rb
113
+ - lib/jrubyfx/part_imports.rb
114
+ - lib/jrubyfx/utils.rb
115
+ - lib/jrubyfx/utils/__ignore_java_stupid_rdoc.rb
116
+ - lib/jrubyfx/utils/common_converters.rb
117
+ - lib/jrubyfx/utils/common_utils.rb
118
+ - lib/jrubyfx/utils/string_utils.rb
119
+ - lib/jrubyfx/version.rb
120
+ - lib/jrubyfx_tasks.rb
121
+ homepage: https://github.com/jruby/jrubyfx
122
+ licenses:
123
+ - Apache-2.0
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project: jrubyfx
141
+ rubygems_version: 2.7.10
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: JavaFX for JRuby with FXML (OpenJFX patched)
145
+ test_files: []