Skip to content

Commit

Permalink
Merge pull request #54 from ruby-processing/jruby-9.3.1.0
Browse files Browse the repository at this point in the history
Jruby 9.3.1.0
  • Loading branch information
monkstone authored Oct 15, 2021
2 parents 3edf1d9 + 55d70b1 commit e138a17
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**v2.6.0** Recommend JRuby-9.3.1.0 use, move non-java files to resources (simplifies path). Use `field` not `declared_field` to access java_class fields.

**v2.5.1** Recommend JRuby-9.2.19.0 use.

**v2.5.0** Refactor noise to delegate pattern and make OpenSimplex2 noise default noise, implement pdf and svg export libraries.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

[![Gem Version](https://badge.fury.io/rb/jruby_art.svg)](https://badge.fury.io/rb/jruby_art) ![Travis CI](https://travis-ci.org/ruby-processing/JRubyArt.svg)

A new version for jdk11 use, does not require an installed `vanilla processing`, however if installed you can use processing-ide to download libraries. Configuration file is incompatible with that of previous version of JRubyArt (and you should move or rename old `config.yml` to keep it). This version will run with a default configuration file but you won't be able to use processing libraries, until you match configuration to your setup. Illegal reflective access warning should be fixed for this release (by using JOGL-2.4.0-rc jars), though you may need to define `JAVA_HOME` for JRuby warnings to be suppressed.
A new version for jdk11+ and JRuby-9.3.1.0 use, does not require an installed `vanilla processing`, however if installed you can use processing-ide to download libraries. Configuration file is incompatible with that of previous version of JRubyArt (and you should move or rename old `config.yml` to keep it). This version will run with a default configuration file but you won't be able to use processing libraries, until you match configuration to your setup. Illegal reflective access warning should be fixed for this release (by using JOGL-2.4.0-rc jars), though you may need to define `JAVA_HOME` for JRuby warnings to be suppressed.

## Requirements

A clean start for `jruby_art` with custom processing core included, built for [jruby-9.2.16.0](http://jruby.org/download) see [wiki](https://github.com/ruby-processing/JRubyArt/wiki/Building-latest-gem) for building gem from this repo.
A clean start for `jruby_art` with custom processing core included, built for [jruby-9.3.1.0](http://jruby.org/download) see [wiki](https://github.com/ruby-processing/JRubyArt/wiki/Building-latest-gem) for building gem from this repo.

## Requirements

A suitable version of ruby (MRI `ruby 2.5+` or `jruby-9.2.16.0`) to download gem. NB: avoid ruby 2.7, it is guaranteed to give you problems (you've been warned)
Tested and working AdoptOpenJDK 11-13, OpenJ9 14, if you have any issues with opengl sketches with distro installed JDK use a JDK from AdoptOpenJDK.
A suitable version of ruby (MRI `ruby 2.6+` or `jruby-9.3.1.0`) to download gem. NB: avoid ruby 2.7, it is guaranteed to give you problems (you've been warned)
Tested and working OpenJDK 11-17, if you have any issues with opengl sketches with distro installed JDK use a JDK from AdoptOpenJDK.


## Configuration
Expand Down Expand Up @@ -87,7 +87,7 @@ k9 --live sketch.rb # pry is bound to Processing.app # needs `jruby -S gem insta

## Example sketches

[Worked Examples](https://github.com/ruby-processing/JRubyArt-examples) and, [The-Nature-of-Code-Examples-for-JRubyArt](https://github.com/ruby-processing/The-Nature-of-Code-for-JRubyArt) feel free to add your own, especially ruby-2.4+ syntax now we can. These can now be downloaded using `k9 --install` please move existing `k9_samples` if you wish to keep them.
[Worked Examples](https://github.com/ruby-processing/JRubyArt-examples) and, [The-Nature-of-Code-Examples-for-JRubyArt](https://github.com/ruby-processing/The-Nature-of-Code-for-JRubyArt) feel free to add your own, especially ruby-2.6+ syntax now we can. These can now be downloaded using `k9 --install` please move existing `k9_samples` if you wish to keep them.

[adopt]: https://adoptopenjdk.net/
[pi]: http://ruby-processing.github.io/JRubyArt/raspberrypi_started/
Expand Down
12 changes: 6 additions & 6 deletions lib/jruby_art/helper_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ def find_method(method_name)
# some methods. Add to this list as needed.
def proxy_java_fields
fields = %w[key frameRate mousePressed keyPressed]
methods = fields.map { |field| java_class.declared_field(field) }
@declared_fields = Hash[fields.zip(methods)]
methods = fields.map { |field| java_class.field(field) }
@jfields = Hash[fields.zip(methods)]
end

# Fix java conversion problems getting the last key
# If it's ASCII, return the character, otherwise the integer
def key
int = @declared_fields['key'].value(java_self)
int = @jfields['key'].value(java_self)
int < 256 ? int.chr : int
end

Expand Down Expand Up @@ -167,19 +167,19 @@ def save_strings(filename, strings)

# frame_rate needs to support reading and writing
def frame_rate(fps = nil)
return @declared_fields['frameRate'].value(java_self) unless fps
return @jfields['frameRate'].value(java_self) unless fps

super(fps)
end

# Is the mouse pressed for this frame?
def mouse_pressed?
@declared_fields['mousePressed'].value(java_self)
@jfields['mousePressed'].value(java_self)
end

# Is a key pressed for this frame?
def key_pressed?
@declared_fields['keyPressed'].value(java_self)
@jfields['keyPressed'].value(java_self)
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/jruby_art/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

# A wrapper for version
module JRubyArt
VERSION = '2.5.1'
VERSION = '2.6.0'
end
8 changes: 4 additions & 4 deletions pom.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project 'jruby_art', 'https://github.com/ruby-processing/JRubyArt' do

model_version '4.0.0'
id 'ruby-processing:jruby_art:2.5.1'
id 'ruby-processing:jruby_art:2.6.0'
packaging 'jar'

description 'Jar for JRubyArt'
Expand All @@ -28,11 +28,12 @@
'polyglot.dump.pom' => 'pom.xml',
'project.build.sourceEncoding' => 'UTF-8',
'jogl.version' => '2.3.2',
'jruby.version' => '9.3.1.0',
'itextpdf.version' => '5.5.13.2',
'batik.version' => '1.14',
'jruby.api' => 'http://jruby.org/apidocs/' )

pom 'org.jruby:jruby:9.2.19.0'
jar 'org.jruby:jruby-base:${jruby.version}'
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
jar 'org.processing:video:3.0.2'
Expand Down Expand Up @@ -76,12 +77,11 @@
build do
resource do
directory '${source.directory}/main/java'
includes '**/**/*.glsl', '**/*.jnilib'
excludes '**/**/*.java'
end
resource do
directory '${source.directory}/main/resources'
includes '**/*.png', '*.txt'
includes '**/*.png', '**/*.txt', '**/*.glsl'
end
end

Expand Down
15 changes: 6 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DO NOT MODIFY - GENERATED CODE
<modelVersion>4.0.0</modelVersion>
<groupId>ruby-processing</groupId>
<artifactId>jruby_art</artifactId>
<version>2.5.1</version>
<version>2.6.0</version>
<name>jruby_art</name>
<description>Jar for JRubyArt</description>
<url>https://github.com/ruby-processing/JRubyArt</url>
Expand Down Expand Up @@ -66,6 +66,7 @@ DO NOT MODIFY - GENERATED CODE
<itextpdf.version>5.5.13.2</itextpdf.version>
<jogl.version>2.3.2</jogl.version>
<jruby.api>http://jruby.org/apidocs/</jruby.api>
<jruby.version>9.3.1.0</jruby.version>
<jruby_art.basedir>${project.basedir}</jruby_art.basedir>
<polyglot.dump.pom>pom.xml</polyglot.dump.pom>
<processing.api>http://processing.github.io/processing-javadocs/core/</processing.api>
Expand All @@ -75,9 +76,8 @@ DO NOT MODIFY - GENERATED CODE
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby</artifactId>
<version>9.2.19.0</version>
<type>pom</type>
<artifactId>jruby-base</artifactId>
<version>${jruby.version}</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
Expand Down Expand Up @@ -109,10 +109,6 @@ DO NOT MODIFY - GENERATED CODE
<resources>
<resource>
<directory>${source.directory}/main/java</directory>
<includes>
<include>**/**/*.glsl</include>
<include>**/*.jnilib</include>
</includes>
<excludes>
<exclude>**/**/*.java</exclude>
</excludes>
Expand All @@ -121,7 +117,8 @@ DO NOT MODIFY - GENERATED CODE
<directory>${source.directory}/main/resources</directory>
<includes>
<include>**/*.png</include>
<include>*.txt</include>
<include>**/*.txt</include>
<include>**/*.glsl</include>
</includes>
</resource>
</resources>
Expand Down
2 changes: 1 addition & 1 deletion vendors/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WARNING = <<~WARN
WARN
# https://github.com/processing/processing-video/releases/download/r6-v2.0-beta4/video-2.0-beta4.zip
JRUBYC_VERSION = '9.2.19.0'
JRUBYC_VERSION = '9.3.1.0'
SOUND = 'sound.zip'
SOUND_VERSION = 'v2.2.3'
VIDEO = 'video.zip'
Expand Down

0 comments on commit e138a17

Please sign in to comment.