Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
96368ee
remove pom.rb for now
monkstone Oct 20, 2018
799b169
Bump version to 3.0.0.pre
monkstone Oct 20, 2018
2ea71c4
add back javafx
monkstone Oct 20, 2018
f56fd3d
custom warning if it ever gets there
monkstone Oct 21, 2018
812877d
fast atan2
monkstone Oct 22, 2018
2ce1be7
bump java requirement
monkstone Oct 22, 2018
637d757
changelog for pre-release
monkstone Oct 22, 2018
53369d6
Use --pre
monkstone Oct 23, 2018
10e78ab
Bump jruby version
monkstone Nov 14, 2018
e1d3e0e
Serious refactoring for jdk11
monkstone Jan 17, 2019
ea43f04
readme
monkstone Jan 17, 2019
5c9eb89
not forgetting gemspec
monkstone Jan 17, 2019
0dd042a
Update README.md
monkstone Jan 17, 2019
5b67c8f
use lambda expression
monkstone Jan 17, 2019
651e65d
Merge branch 'jdk11' of https://github.com/ruby-processing/propane in…
monkstone Jan 17, 2019
bcdac89
jdk target
monkstone Jan 18, 2019
de88d1e
Consistently indent 4 spaces, as per netbeans
monkstone Jan 18, 2019
36ac0a2
Update README.md
monkstone Jan 24, 2019
f6a71cb
Merge branch 'jdk11' of https://github.com/ruby-processing/propane in…
monkstone Jan 27, 2019
fd2a151
Getting ready for release
monkstone Feb 15, 2019
cc66a24
adjust manifest
monkstone Feb 15, 2019
0bc31ea
Merge branch 'master' into jdk11
monkstone Feb 15, 2019
3983b20
Merge pull request #32 from ruby-processing/jdk11
monkstone Feb 15, 2019
3fd97e1
polyglot not working
monkstone Feb 15, 2019
2495946
Merge pull request #33 from ruby-processing/jdk11
monkstone Feb 15, 2019
f2ab096
check for wrong JDK
monkstone Feb 16, 2019
7c26784
Update README.md
monkstone Feb 16, 2019
d252921
use sanitised samples
monkstone Feb 16, 2019
b5bfbf4
Update README.md
monkstone Feb 16, 2019
c053e64
Update README.md
monkstone Feb 20, 2019
3a84ae0
AppRender => GfxRender
monkstone Mar 20, 2019
18584c2
fix polyglot maven
monkstone Mar 21, 2019
41740f0
Merge branch 'master' of https://github.com/ruby-processing/propane
monkstone Mar 21, 2019
44a86c5
Bump examples attempt fix of macOS icons
monkstone May 4, 2019
7b81921
Changes to be committed:
monkstone May 5, 2019
bd09139
give windows another chance?
monkstone May 19, 2019
02c0e5a
update maven wrapper
monkstone May 22, 2019
5e09849
return to travis?
monkstone May 24, 2019
7e772b6
remove apt-get update
monkstone May 24, 2019
a48387c
Update README.md
monkstone May 24, 2019
12db9aa
fix native library load linux
monkstone Aug 30, 2019
978e1c2
build on Debian
monkstone Aug 31, 2019
0645f57
bump versions
monkstone Aug 31, 2019
aaed9fc
get ready for 3.4.0 release
monkstone Sep 1, 2019
ac00d98
remove uneeded var
monkstone Sep 2, 2019
6e9f516
update polyglot maven
monkstone Sep 2, 2019
c854434
tidy source
monkstone Sep 2, 2019
8dc3b03
remove core/util
monkstone Sep 3, 2019
3ca14f8
suppress warnings
monkstone Sep 13, 2019
f99810b
bump version
monkstone Sep 13, 2019
b856656
Update README.md
monkstone Sep 13, 2019
4c2b5ca
Update README.md
monkstone Sep 13, 2019
2a1bbfa
net and dxf libraries
monkstone Sep 14, 2019
8a8cb29
https://adoptopenjdk.net/
monkstone Sep 17, 2019
0fc9678
Merge branch 'master' of https://github.com/ruby-processing/propane
monkstone Sep 17, 2019
76b6b42
remove var
monkstone Oct 2, 2019
a50aa18
change grid methods to mimic x, y, z order of nested loops
monkstone Oct 7, 2019
dff019a
use mvnw for build
monkstone Oct 22, 2019
6efd7ec
add shuffle
monkstone Oct 22, 2019
ac4558d
bump jruby
monkstone Oct 31, 2019
0268d45
display_density fix
monkstone Nov 28, 2019
4438064
ditch GLVideo in favor of video2-beta
monkstone Nov 28, 2019
672a9ed
Get ready for release
monkstone Dec 1, 2019
b4b7836
merge commit
monkstone Dec 3, 2019
bbde299
fix from Jay Scott for windows native bug
monkstone Dec 22, 2019
2251977
get read for release
monkstone Dec 22, 2019
c1826b4
get ready for release
monkstone Dec 22, 2019
0ec2e52
various fixes + rubocop
monkstone Dec 23, 2019
cce89bd
adjust warnings for ruby environment
monkstone Dec 28, 2019
ad0211c
use Map.of
monkstone Jan 9, 2020
78a61d5
some tidy up
monkstone Jan 11, 2020
68032d8
bump processing version in build
monkstone Jan 18, 2020
c562edd
Merge branch 'master' of https://github.com/ruby-processing/propane
monkstone Jan 18, 2020
5abf0ea
Bump copyright date
monkstone Jan 23, 2020
4cc9afe
Various cleanups
monkstone Feb 16, 2020
1375847
prefer match
monkstone Feb 16, 2020
d23ae9d
prefer match?
monkstone Feb 16, 2020
45ea0db
Various rubocop corrections
monkstone Feb 17, 2020
8123477
perchance for probability
monkstone Feb 18, 2020
2e60a19
Bump temporarily to jruby-9.2.10.0
monkstone Feb 20, 2020
7449190
Bump for JRuby-9.2.11.0
monkstone Mar 4, 2020
fcc151f
Update for latest processing4
monkstone Apr 3, 2020
2fd7aee
Bump Versions, getting ready for release
monkstone Apr 4, 2020
da9445a
more tidy up
monkstone Apr 4, 2020
8712ff4
Belt and braces might be reqd
monkstone Apr 4, 2020
09bdac6
Bump versions
monkstone Apr 4, 2020
6475c89
some javadoc fixes
monkstone Apr 4, 2020
10039f3
final push
monkstone Apr 4, 2020
b3e232c
Merge pull request #35 from ruby-processing/processing4
monkstone Apr 4, 2020
570a489
Update README.md
monkstone Apr 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ target
*.jar
*~
MANIFEST.MF
nb-configuration.xml

2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<extension>
<groupId>io.takari.polyglot</groupId>
<artifactId>polyglot-ruby</artifactId>
<version>0.3.2</version>
<version>0.4.4</version>
</extension>
</extensions>
117 changes: 117 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

private static final String WRAPPER_VERSION = "0.5.5";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");

System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
3 changes: 2 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: java
dist: bionic

rvm:
- jruby-9.2.11.1
jdk:
- openjdk11
os:
- linux
22 changes: 16 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
**v2.9.4** Bump for jruby-9.2.5.0.
**v3.5.0** Rebase processing core code around Sam Pottinhgers latest fixes for JOGL an image save, does mean breaking some of Diwis and Joshua Davis examples, but one hopes codeanticode knows what he's doing.

**v2.9.3** Bump for jruby-9.2.4.1.
**v3.4.3** Use Map.of to initialize HashMap bump processing version in build bump to jruby-9.2.11.0

**v2.9.2** Bump for jruby-9.2.3.0.
**v3.4.2** Fix native library bug on windows (thanks to Jay Scott). Add minim library examples

**v3.4.1** Update to jruby-9.2.9.0

**v3.4.0** Experimental refactoring of ThinkDifferent, and some other processing classes

**v3.3.1** Reflection makes refactoring a nightmare DesktopHandler => ThinkDifferent

**v3.3.0** Compile with jdk12\. Changed AppRender to GfxRender (PGraphics instead of PApplet). Attempt fix for macOS icons

**v3.2.0** Now is the time for some serious refactoring for jdk11\. Might even work on MacOS and Windows, ahead of vanilla processing.

**v2.9.1** Attempt to bring 64 bit Windows users to party. Use non versioned jogl/opengl jars from processing distro, including processing.org apple.jar in case it's needed, MacOS users are being very opaque on this.

Expand All @@ -26,7 +36,7 @@

**v2.6.1** Bump processing version, bump recommended jruby version.

**v2.6.0** Refactored `LibraryLoader` knows less about `Library` class. The library class _knows_ about paths, and checks that they exist. Currently has ability to load `GLVideo` library, that will eventually become the new video libary (supports gstreamer-1.0 instead of gstreamer-0.1.0 that has already been dropped by some linux distros).
**v2.6.0** Refactored `LibraryLoader` knows less about `Library` class. The library class _knows_ about paths, and checks that they exist. Currently has ability to load `GLVideo` library, that will eventually become the new video libary (supports gstreamer-1.0 instead of gstreamer-0.1.0 that has already been dropped by some linux distros).

**v2.5.5** Intermediate `refactored_library` loader, can be release if required but still not there as regards refactor goals.

Expand Down Expand Up @@ -64,13 +74,13 @@

**v2.0.0** Refactored to work with processing-3.0, `--install samples` and/or vanilla processing `sound` and `video` libraries

**v0.9.0** Implements `data_path` in ruby, you should use this method to return the absolute path to the `data` folder (read and write). Prefer JRubyArt methods, in the main.
**v0.9.0** Implements `data_path` in ruby, you should use this method to return the absolute path to the `data` folder (read and write). Prefer JRubyArt methods, in the main.

**v0.8.0** Complete samples refactored to `data_path` folder, no longer require jruby-complete to run because we provide an absolute path to `data` folder, but it still probably requires that you run the sketch from the directory. Future direction might be to create a `~/.propane` folder, which would support additionalvanilla processing libraries, also integration with `atom` editor.

**v0.7.0** Update to JRuby-Complete-9.1.2.0.

**v0.6.0** Includes a sketch creator utility 3D still only for linux64 and macosx, any Windows developers are welcome to extend to windows (should be easy), includes slider in sketch library, change to requiring jdk8. Update to JRuby-Complete-9.1.0.0, request updated arcball (to run samples).
**v0.6.0** Includes a sketch creator utility 3D still only for linux64 and macosx, any Windows developers are welcome to extend to windows (should be easy), includes slider in sketch library, change to requiring jdk8\. Update to JRuby-Complete-9.1.0.0, request updated arcball (to run samples).

**v0.5.0** Includes a sketch creator utility 3D still only for linux64 and macosx, any Windows developers are welcome to extend to windows (should be easy).

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
47 changes: 36 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Propane
To build custom core see [processing-core][processing-core]
# Propane [![Gem Version](https://badge.fury.io/rb/propane.svg)](https://badge.fury.io/rb/propane) ![Travis CI](https://travis-ci.org/ruby-processing/propane.svg)

A slim layer to communicate with Processing from JRuby, features a polyglot maven build. We have created a configuration free version of ruby processing, for processing-3.4, where we include a modified processing core (`public runPropane()` to replace `protected runSketch()`, (_runSketch not currently usable with jruby and jdk 9_). These jars are small enough to include in a gem distribution, and hence we do not require configuration. This has created a scriptable version, ie files get run direct from jruby, but you could use jruby-complete if you used the propane script (avoids need to give the absolute data path for the data folder, but would also be needed for a watch mode). See guide to [building ruby-processing projects][building]. NB: this is a far from perfect solution and javafx sketches and possibly a few others still fail to run with jdk9, but a least I get to diagnose those errors too.
This version is intended to work with openjdk11+, @sampottinger is currently working on [vanilla processing][vanilla] which will enable JRubyArt to catch up.

A slim layer to communicate with Processing from JRuby, features maven build. We have created a configuration free version of ruby processing, for processing-4.0+, where we include a modified processing core (`public runPropane()` to replace `protected runSketch()`. These jars are small enough to include in a gem distribution, and hence we do not require configuration. This has created a scriptable version, ie files get run direct from jruby. Currently JavaFX is unsupported again @sampottinger is currently working on [vanilla processing][vanilla] to use OpenJFX. It would be nice make use of java modules, but I think we should let jruby project do that first (unless processing.org beat them to it).

adjust above for your OS/distro setup.

## Requirements

- `jdk8_u181`
- `jruby-9.2.5.0`
- `mvn-3.5.0+`
- `apple.jar` (_build only_) see (or may'be runtime as well a MacOS user needed to test) [vanilla-processing](https://github.com/processing/processing/blob/master/core/apple.jar)
There may be a linker issue with P2D or P3D sketches with stock openjdk with some linux distros, in which case you might find [Adopt open jdk binaries][adopt] will work for you.

- `jdk-11.0.3+`
- `jruby-9.2.11.1`

Currently you can ignore `illegal reflective access` warnings, see [here how to suppress them][warning].

## Building and testing

Expand All @@ -21,13 +24,30 @@ rake javadoc
```

## Installation

```bash
jgem install propane # from rubygems
jgem install propane-2.9.4-java.gem # local install requires a custom processing-core
jgem install propane-3.5.0-java.gem # local install
# Alternative
jruby -S gem install propane # from rubygems
jruby -S gem install propane-3.5.0-java.gem # local install
```

## Check Install
To check version and confirm gem bin files are on your path (also checks JDK version)

```bash
propane --version
```

## Suppressing Reflective Access warnings

Since propane-3.5.0 it is possible to suppress reflective access warnings by setting JAVA_HOME environmental variable jruby does the rest.

## Usage

A propane sketch:-

``` ruby
require 'propane'

Expand All @@ -49,8 +69,8 @@ end
FlashingLightsSketch.new
```

Create template sketches with the sketch creator tool

There is a handy sketch creator tool
```bash
propane -c my_sketch 200 200 # for default renderer
propane -c my_sketch 200 200 p2d # for opengl 2D renderer
Expand All @@ -62,23 +82,28 @@ To run sketches
```bash
jruby my_sketch.rb # or use script to run sketches from atom
```

To install the sound and video libraries `~/.propane/libraries`. Depends on wget.
```bash
propane --install sound
propane --install video
```

Other java libraries can be manually installed to the same folder (no need for processing ide)

See [gh-pages][gh-pages] for more detailed instructions and much more.

## Examples

[Worked Examples](https://github.com/ruby-processing/propane-examples) more to follow, feel free to add your own, especially ruby-2.2+ syntax now we can. To install the samples. The samples get copied to `~/propane_samples`. Depends on wget.
[Worked Examples](https://github.com/ruby-processing/propane-examples) more to follow, feel free to add your own, especially ruby-2.5
+ syntax now we can. To install the samples. The samples get copied to `~/propane_samples`. Depends on wget.
```bash
propane --install samples
```
please move existing `propane_samples` if you wish to keep them. The current release features several PixelFlow glsl library examples, including a few shadertoy demos as sketches.

[adopt]: https://adoptopenjdk.net/
[building]:http://ruby-processing.github.io/building/building/
[gh-pages]:https://ruby-processing.github.io/propane/
[processing-core]:https://github.com/ruby-processing/processing-core
[vanilla]:https://github.com/processing/processing/pull/5753
[warning]: https://monkstone.github.io/jruby_art/update/2019/09/10/Reflective_Access.html
44 changes: 15 additions & 29 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
# frozen_string_literal: false
require_relative 'lib/propane/version'
require 'erb'

desc 'Create jar Manifest'
task :create_manifest do
manifest = ERB.new <<~MANIFEST
Implementation-Title: rpextras (java extension for propane)
Implementation-Version: <%= Propane::VERSION %>
Class-Path: apple.jar gluegen-rt.jar jog-all.jar
MANIFEST
File.open('MANIFEST.MF', 'w') do |f|
f.puts(manifest.result(binding))
end
end
require_relative 'lib/propane/version'

task default: [:init, :compile, :install, :test, :gem]
task default: %i[init compile install test gem]

# depends on installed processing, with processing on path
desc 'Create Manifest and Copy Jars'
task init: :create_manifest do
processing_root = File.dirname(`readlink -f $(which processing)`) # for Archlinux etc
# processing_root = File.join(ENV['HOME'], 'processing-3.4') # alternative for debian linux etc
jar_dir = File.join(processing_root, 'core', 'library')
opengl = Dir.entries(jar_dir).grep(/amd64|macosx-universal/)
# Currently depends on local jogl-2.4.0 jars on path ~/jogl24
desc 'Copy Jars'
task :init do
jogl24 = File.join(ENV['HOME'], 'jogl24')
opengl = Dir.entries(jogl24).grep(/amd64|universal/).select { |jar| jar =~ /linux|windows|macosx/ }
opengl.concat %w[jogl-all.jar gluegen-rt.jar]
opengl.each do |gl|
FileUtils.cp(File.join(jar_dir, gl), File.join('.', 'lib'))
FileUtils.cp(File.join(jogl24, gl), File.join('.', 'lib'))
end
end

Expand All @@ -41,12 +27,12 @@ end

desc 'Document'
task :javadoc do
sh 'mvn javadoc:javadoc'
sh './mvnw javadoc:javadoc'
end

desc 'Compile'
task :compile do
sh 'mvn package'
sh './mvnw package'
end

desc 'JRuby-Complete'
Expand All @@ -58,15 +44,15 @@ desc 'Test'
task :test do
sh 'jruby test/helper_methods_test.rb'
# sh 'jruby test/respond_to_test.rb' Skip test on Travis to avoid Headless fail
sh 'jruby test/create_test.rb'
sh 'jruby test/math_tool_test.rb'
sh 'jruby test/deglut_spec_test.rb'
sh 'jruby test/vecmath_spec_test.rb'
sh 'jruby --dev test/create_test.rb'
sh 'jruby --dev test/math_tool_test.rb'
sh 'jruby --dev test/deglut_spec_test.rb'
sh 'jruby --dev test/vecmath_spec_test.rb'
end

desc 'clean'
task :clean do
Dir["./**/*.{jar,gem}"].each do |path|
Dir['./**/*.{jar,gem}'].each do |path|
puts "Deleting #{path} ..."
File.delete(path)
end
Expand Down
4 changes: 3 additions & 1 deletion bin/propane
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env jruby
# frozen_string_literal: true

unless defined? PROPANE_ROOT
$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
$LOAD_PATH << __dir__
PROPANE_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
end

Expand Down
Loading