propane 3.1.0.pre-java → 3.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -0
  3. data/CHANGELOG.md +1 -5
  4. data/README.md +23 -12
  5. data/Rakefile +23 -12
  6. data/lib/propane/helpers/version_error.rb +6 -0
  7. data/lib/propane/runner.rb +12 -0
  8. data/lib/propane/version.rb +1 -1
  9. data/library/slider/slider.rb +1 -1
  10. data/mvnw +234 -0
  11. data/mvnw.cmd +145 -0
  12. data/pom.xml +28 -27
  13. data/propane.gemspec +2 -2
  14. data/src/main/java/japplemenubar/JAppleMenuBar.java +41 -47
  15. data/src/main/java/monkstone/ColorUtil.java +1 -1
  16. data/src/main/java/monkstone/MathToolModule.java +12 -11
  17. data/src/main/java/monkstone/PropaneLibrary.java +9 -10
  18. data/src/main/java/monkstone/core/LibraryProxy.java +124 -113
  19. data/src/main/java/monkstone/fastmath/Deglut.java +86 -89
  20. data/src/main/java/monkstone/filechooser/Chooser.java +7 -13
  21. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -1
  22. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +4 -4
  23. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  24. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +9 -9
  25. data/src/main/java/monkstone/slider/SimpleSlider.java +0 -9
  26. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +11 -13
  27. data/src/main/java/monkstone/slider/Slider.java +1 -1
  28. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  29. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  30. data/src/main/java/monkstone/slider/WheelHandler.java +8 -9
  31. data/src/main/java/monkstone/vecmath/AppRender.java +2 -2
  32. data/src/main/java/monkstone/vecmath/ShapeRender.java +2 -2
  33. data/src/main/java/monkstone/vecmath/package-info.java +2 -2
  34. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +2 -2
  35. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
  36. data/src/main/java/monkstone/videoevent/VideoInterface.java +11 -5
  37. data/src/main/java/monkstone/videoevent/package-info.java +2 -2
  38. data/src/main/java/processing/awt/PGraphicsJava2D.java +1742 -2243
  39. data/src/main/java/processing/awt/PShapeJava2D.java +268 -270
  40. data/src/main/java/processing/awt/PSurfaceAWT.java +821 -920
  41. data/src/main/java/processing/core/DesktopHandler.java +94 -0
  42. data/src/main/java/processing/core/PApplet.java +14170 -14082
  43. data/src/main/java/processing/core/PConstants.java +447 -473
  44. data/src/main/java/processing/core/PFont.java +867 -873
  45. data/src/main/java/processing/core/PGraphics.java +7193 -7428
  46. data/src/main/java/processing/core/PImage.java +3051 -3117
  47. data/src/main/java/processing/core/PMatrix.java +159 -172
  48. data/src/main/java/processing/core/PMatrix2D.java +403 -444
  49. data/src/main/java/processing/core/PMatrix3D.java +735 -749
  50. data/src/main/java/processing/core/PShape.java +2651 -2793
  51. data/src/main/java/processing/core/PShapeOBJ.java +415 -422
  52. data/src/main/java/processing/core/PShapeSVG.java +1466 -1475
  53. data/src/main/java/processing/core/PStyle.java +37 -40
  54. data/src/main/java/processing/core/PSurface.java +98 -103
  55. data/src/main/java/processing/core/PSurfaceNone.java +208 -236
  56. data/src/main/java/processing/core/PVector.java +961 -990
  57. data/src/main/java/processing/data/DoubleDict.java +709 -753
  58. data/src/main/java/processing/data/DoubleList.java +695 -748
  59. data/src/main/java/processing/data/FloatDict.java +702 -746
  60. data/src/main/java/processing/data/FloatList.java +697 -751
  61. data/src/main/java/processing/data/IntDict.java +673 -718
  62. data/src/main/java/processing/data/IntList.java +633 -699
  63. data/src/main/java/processing/data/JSONArray.java +873 -931
  64. data/src/main/java/processing/data/JSONObject.java +1165 -1262
  65. data/src/main/java/processing/data/JSONTokener.java +341 -351
  66. data/src/main/java/processing/data/LongDict.java +662 -707
  67. data/src/main/java/processing/data/LongList.java +634 -700
  68. data/src/main/java/processing/data/Sort.java +41 -37
  69. data/src/main/java/processing/data/StringDict.java +486 -522
  70. data/src/main/java/processing/data/StringList.java +580 -624
  71. data/src/main/java/processing/data/Table.java +3508 -3686
  72. data/src/main/java/processing/data/TableRow.java +183 -182
  73. data/src/main/java/processing/data/XML.java +883 -957
  74. data/src/main/java/processing/event/Event.java +66 -87
  75. data/src/main/java/processing/event/KeyEvent.java +41 -48
  76. data/src/main/java/processing/event/MouseEvent.java +93 -103
  77. data/src/main/java/processing/event/TouchEvent.java +6 -10
  78. data/src/main/java/processing/javafx/PGraphicsFX2D.java +5 -69
  79. data/src/main/java/processing/javafx/PSurfaceFX.java +2 -7
  80. data/src/main/java/processing/opengl/FontTexture.java +270 -290
  81. data/src/main/java/processing/opengl/FrameBuffer.java +363 -375
  82. data/src/main/java/processing/opengl/LinePath.java +500 -543
  83. data/src/main/java/processing/opengl/LineStroker.java +582 -593
  84. data/src/main/java/processing/opengl/PGL.java +2881 -2904
  85. data/src/main/java/processing/opengl/PGraphics2D.java +315 -408
  86. data/src/main/java/processing/opengl/PGraphics3D.java +72 -107
  87. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12043 -12230
  88. data/src/main/java/processing/opengl/PJOGL.java +1681 -1745
  89. data/src/main/java/processing/opengl/PShader.java +1257 -1260
  90. data/src/main/java/processing/opengl/PShapeOpenGL.java +4599 -4662
  91. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1030 -1047
  92. data/src/main/java/processing/opengl/Texture.java +1397 -1462
  93. data/src/main/java/processing/opengl/VertexBuffer.java +55 -57
  94. data/src/main/resources/icon/icon-1024.png +0 -0
  95. data/src/main/resources/icon/icon-128.png +0 -0
  96. data/src/main/resources/icon/icon-16.png +0 -0
  97. data/src/main/resources/icon/icon-256.png +0 -0
  98. data/src/main/resources/icon/icon-32.png +0 -0
  99. data/src/main/resources/icon/icon-48.png +0 -0
  100. data/src/main/resources/icon/icon-512.png +0 -0
  101. data/src/main/resources/icon/icon-64.png +0 -0
  102. data/vendors/Rakefile +1 -1
  103. metadata +12 -8
  104. data/src/main/java/processing/core/ThinkDifferent.java +0 -70
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d30b5c711105c3e4795739b48211591d221039464e60a9e1f545c7d43bcd0294
4
- data.tar.gz: 7cced24e7cc4e1dc831837f8d263c8211f09dd2e265bf7d46a8362704d577ce8
3
+ metadata.gz: 27e0f6d8547d0ab680c183052c93de07386e196ef645111564ad033172ccccbe
4
+ data.tar.gz: cc8cf473457ddfbe7e423e202276d209d629942b2d04bedfd07c577ca1fefb43
5
5
  SHA512:
6
- metadata.gz: e3e297a0d7a8ce24c5543bb83eb69146be511d808fd6e6a2e2bbaf0dc84ed60cbde754b6b40c09c5354210d88a999da386f61165bdbeb91554817546b6516af6
7
- data.tar.gz: 895be9e7ce50d9bba9d2433cc457265faaa3690199ea88815c52cb87c09fc7f1a17f86661defff1a1a41d3f76e81c01f7c9daead46dcdc8dac1a47943ea6a1a1
6
+ metadata.gz: 501f170bf9899573c5085c292a0fe8796df82588dd74b2b07b80c8dda96498a7cbd26352fce2a8623a69b1ff0d4703bb265dcf55b81292efdbe3c52322100fc1
7
+ data.tar.gz: 4b8a78d2f4b924111b16a8269d922107f84f186465e5568972237944886bfcb2c23fa5178e5c2b8046aa559b74ea167932795c25a97849322ec9c991ab274a24
@@ -0,0 +1 @@
1
+ distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
@@ -1,8 +1,4 @@
1
- **v3.1.0.pre** Now is the time for some serious refactoring for jdk11. Hell we might even get in working on MacOS and Windows, ahead of vanilla processing. For MacOS this means ditching apple.jar dependency.
2
-
3
- **v3.0.1.pre** Bump jruby version
4
-
5
- **v3.0.0.pre** Compiled for java 11, works on linux, requires testing on MacOS and Windows
1
+ **v3.2** Now is the time for some serious refactoring for jdk11. Might even work on MacOS and Windows, ahead of vanilla processing.
6
2
 
7
3
  **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.
8
4
 
data/README.md CHANGED
@@ -1,16 +1,15 @@
1
1
  # Propane
2
2
 
3
- Here is my attempt to get a version of ruby-processing working with openjdk11, it imore than a proof of concept, as it already works very succesfully under linux the question is will it work under Windows and MacOS. To do this I have created a custom maven build of processing core, to which I add vanilla processing jogl jars (these are not the same as jogl jars form maven).
4
- I am watching with interest progress made by @sampottinger on [vanilla processing][vanilla]. I have implemented a different solution for think different than @ssilverman in my jdk11 branch (but I don't know whether it works).
3
+ This version is intended to work with openjdk11+, @sampottinger is currently working on [vanilla processing][vanilla] which will enable JRubyArt to catch up.
5
4
 
6
- 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()`. 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 will not run with jdk11, but a least I get to diagnose those errors too.
5
+ A slim layer to communicate with Processing from JRuby, features maven build. We have created a configuration free version of ruby processing, for processing-3.5+, 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.
7
6
 
8
7
  adjust above for your OS/distro setup.
9
8
 
10
9
  ## Requirements
11
10
 
12
- - `jdk-11.0.1`
13
- - `jruby-9.2.5.0`
11
+ - `jdk-11.0.2+`
12
+ - `jruby-9.2.7.0`
14
13
  - `mvn-3.5.4+`
15
14
 
16
15
  ## Building and testing
@@ -22,16 +21,26 @@ rake javadoc
22
21
  ```
23
22
 
24
23
  ## Installation
24
+
25
25
  ```bash
26
- jgem install --pre propane # from rubygems
27
- jgem install propane-3.1.0.pre-java.gem # local install requires a custom processing-core
26
+ jgem install propane # from rubygems
27
+ jgem install propane-3.2.0-java.gem # local install
28
28
  # Alternative
29
- jruby -S gem install --pre propane # from rubygems
30
- jruby -S gem install propane-3.1.0.pre-java.gem # local install requires a custom processing-core
29
+ jruby -S gem install propane # from rubygems
30
+ jruby -S gem install propane-3.2.0-java.gem # local install
31
+ ```
32
+
33
+ ## Check Install
34
+ To check version and confirm gem bin files are on your path (also checks JDK version)
35
+
36
+ ```bash
37
+ propane --version
31
38
  ```
32
39
 
33
40
  ## Usage
34
41
 
42
+ A propane sketch:-
43
+
35
44
  ``` ruby
36
45
  require 'propane'
37
46
 
@@ -53,8 +62,8 @@ end
53
62
  FlashingLightsSketch.new
54
63
  ```
55
64
 
65
+ Create template sketches with the sketch creator tool
56
66
 
57
- There is a handy sketch creator tool
58
67
  ```bash
59
68
  propane -c my_sketch 200 200 # for default renderer
60
69
  propane -c my_sketch 200 200 p2d # for opengl 2D renderer
@@ -66,18 +75,21 @@ To run sketches
66
75
  ```bash
67
76
  jruby my_sketch.rb # or use script to run sketches from atom
68
77
  ```
78
+
69
79
  To install the sound and video libraries `~/.propane/libraries`. Depends on wget.
70
80
  ```bash
71
81
  propane --install sound
72
82
  propane --install video
73
83
  ```
84
+
74
85
  Other java libraries can be manually installed to the same folder (no need for processing ide)
75
86
 
76
87
  See [gh-pages][gh-pages] for more detailed instructions and much more.
77
88
 
78
89
  ## Examples
79
90
 
80
- [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.
91
+ [Worked Examples](https://github.com/ruby-processing/propane-examples) more to follow, feel free to add your own, especially ruby-2.4
92
+ + syntax now we can. To install the samples. The samples get copied to `~/propane_samples`. Depends on wget.
81
93
  ```bash
82
94
  propane --install samples
83
95
  ```
@@ -86,4 +98,3 @@ propane --install samples
86
98
  [building]:http://ruby-processing.github.io/building/building/
87
99
  [gh-pages]:https://ruby-processing.github.io/propane/
88
100
  [vanilla]:https://github.com/processing/processing/pull/5753
89
- https://github.com/processing/processing/pull/5747
data/Rakefile CHANGED
@@ -1,26 +1,37 @@
1
1
  # frozen_string_literal: false
2
2
  require_relative 'lib/propane/version'
3
+ require 'erb'
3
4
 
4
- def create_manifest
5
- title = 'Implementation-Title: rpextras (java extension for propane)'
6
- version = format('Implementation-Version: %s', Propane::VERSION)
5
+ desc 'Create jar Manifest'
6
+ task :create_manifest do
7
+ manifest = ERB.new <<~MANIFEST
8
+ Implementation-Title: rpextras (java extension for propane)
9
+ Implementation-Version: <%= Propane::VERSION %>
10
+ Class-Path: gluegen-rt.jar jog-all.jar
11
+ MANIFEST
7
12
  File.open('MANIFEST.MF', 'w') do |f|
8
- f.puts(title)
9
- f.puts(version)
10
- f.puts('Class-Path: apple.jar gluegen-rt.jar jog-all.jar')
13
+ f.puts(manifest.result(binding))
11
14
  end
12
15
  end
13
16
 
14
17
  task default: [:init, :compile, :install, :test, :gem]
15
18
 
16
- desc 'Create Manifest'
17
- task :init do
18
- create_manifest
19
+ # depends on installed processing, with processing on path
20
+ desc 'Create Manifest and Copy Jars'
21
+ task init: :create_manifest do
22
+ processing_root = File.dirname(`readlink -f $(which processing)`) # for Archlinux etc
23
+ # processing_root = File.join(ENV['HOME'], 'processing-3.5.3') # alternative for debian linux etc
24
+ jar_dir = File.join(processing_root, 'core', 'library')
25
+ opengl = Dir.entries(jar_dir).grep(/amd64|macosx-universal/)
26
+ opengl.concat %w[jogl-all.jar gluegen-rt.jar]
27
+ opengl.each do |gl|
28
+ FileUtils.cp(File.join(jar_dir, gl), File.join('.', 'lib'))
29
+ end
19
30
  end
20
31
 
21
32
  desc 'Install'
22
33
  task :install do
23
- sh 'mv target/propane-3.0.1.jar lib'
34
+ sh "mv target/propane-#{Propane::VERSION}.jar lib"
24
35
  end
25
36
 
26
37
  desc 'Gem'
@@ -55,8 +66,8 @@ end
55
66
 
56
67
  desc 'clean'
57
68
  task :clean do
58
- Dir['./**/*.%w{jar gem}'].each do |path|
59
- puts 'Deleting #{path} ...'
69
+ Dir["./**/*.{jar,gem}"].each do |path|
70
+ puts "Deleting #{path} ..."
60
71
  File.delete(path)
61
72
  end
62
73
  FileUtils.rm_rf('./target')
@@ -0,0 +1,6 @@
1
+
2
+ class JDKVersionError < StandardError
3
+ def message
4
+ 'This version of propane requires at least JDK11 to work'
5
+ end
6
+ end
@@ -67,10 +67,22 @@ module Propane
67
67
  end
68
68
 
69
69
  def show_version
70
+
70
71
  v_format = "Propane version %s\nJRuby version %s"
71
72
  puts format(v_format, Propane::VERSION, JRUBY_VERSION)
72
73
  end
73
74
 
75
+ def show_version
76
+ require 'erb'
77
+ require_relative 'helpers/version_error'
78
+ raise JDKVersionError.new if ENV_JAVA['java.specification.version'] < '11'
79
+ template = ERB.new <<-EOF
80
+ propane version <%= Propane::VERSION %>
81
+ JRuby version <%= JRUBY_VERSION %>
82
+ EOF
83
+ puts template.result(binding)
84
+ end
85
+
74
86
  def install(library)
75
87
  choice = library.downcase
76
88
  valid = Regexp.union('samples', 'sound', 'video', 'glvideo')
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Propane
3
- VERSION = '3.1.0.pre'.freeze
3
+ VERSION = '3.2.0'.freeze
4
4
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  # Here's a little library for quickly hooking up in sketch sliders.
3
- # Copyright (c) 2016-18 Martin Prout.
3
+ # Copyright (c) 2016-19 Martin Prout.
4
4
 
5
5
  java_import 'monkstone.slider.CustomHorizontalSlider'
6
6
  java_import 'monkstone.slider.CustomVerticalSlider'
data/mvnw ADDED
@@ -0,0 +1,234 @@
1
+ #!/bin/sh
2
+ # ----------------------------------------------------------------------------
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ # ----------------------------------------------------------------------------
20
+
21
+ # ----------------------------------------------------------------------------
22
+ # Maven2 Start Up Batch script
23
+ #
24
+ # Required ENV vars:
25
+ # ------------------
26
+ # JAVA_HOME - location of a JDK home dir
27
+ #
28
+ # Optional ENV vars
29
+ # -----------------
30
+ # M2_HOME - location of maven2's installed home dir
31
+ # MAVEN_OPTS - parameters passed to the Java VM when running Maven
32
+ # e.g. to debug Maven itself, use
33
+ # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34
+ # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35
+ # ----------------------------------------------------------------------------
36
+
37
+ if [ -z "$MAVEN_SKIP_RC" ] ; then
38
+
39
+ if [ -f /etc/mavenrc ] ; then
40
+ . /etc/mavenrc
41
+ fi
42
+
43
+ if [ -f "$HOME/.mavenrc" ] ; then
44
+ . "$HOME/.mavenrc"
45
+ fi
46
+
47
+ fi
48
+
49
+ # OS specific support. $var _must_ be set to either true or false.
50
+ cygwin=false;
51
+ darwin=false;
52
+ mingw=false
53
+ case "`uname`" in
54
+ CYGWIN*) cygwin=true ;;
55
+ MINGW*) mingw=true;;
56
+ Darwin*) darwin=true
57
+ #
58
+ # Look for the Apple JDKs first to preserve the existing behaviour, and then look
59
+ # for the new JDKs provided by Oracle.
60
+ #
61
+ if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
62
+ #
63
+ # Apple JDKs
64
+ #
65
+ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
66
+ fi
67
+
68
+ if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
69
+ #
70
+ # Apple JDKs
71
+ #
72
+ export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
73
+ fi
74
+
75
+ if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
76
+ #
77
+ # Oracle JDKs
78
+ #
79
+ export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
80
+ fi
81
+
82
+ if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
83
+ #
84
+ # Apple JDKs
85
+ #
86
+ export JAVA_HOME=`/usr/libexec/java_home`
87
+ fi
88
+ ;;
89
+ esac
90
+
91
+ if [ -z "$JAVA_HOME" ] ; then
92
+ if [ -r /etc/gentoo-release ] ; then
93
+ JAVA_HOME=`java-config --jre-home`
94
+ fi
95
+ fi
96
+
97
+ if [ -z "$M2_HOME" ] ; then
98
+ ## resolve links - $0 may be a link to maven's home
99
+ PRG="$0"
100
+
101
+ # need this for relative symlinks
102
+ while [ -h "$PRG" ] ; do
103
+ ls=`ls -ld "$PRG"`
104
+ link=`expr "$ls" : '.*-> \(.*\)$'`
105
+ if expr "$link" : '/.*' > /dev/null; then
106
+ PRG="$link"
107
+ else
108
+ PRG="`dirname "$PRG"`/$link"
109
+ fi
110
+ done
111
+
112
+ saveddir=`pwd`
113
+
114
+ M2_HOME=`dirname "$PRG"`/..
115
+
116
+ # make it fully qualified
117
+ M2_HOME=`cd "$M2_HOME" && pwd`
118
+
119
+ cd "$saveddir"
120
+ # echo Using m2 at $M2_HOME
121
+ fi
122
+
123
+ # For Cygwin, ensure paths are in UNIX format before anything is touched
124
+ if $cygwin ; then
125
+ [ -n "$M2_HOME" ] &&
126
+ M2_HOME=`cygpath --unix "$M2_HOME"`
127
+ [ -n "$JAVA_HOME" ] &&
128
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
129
+ [ -n "$CLASSPATH" ] &&
130
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
131
+ fi
132
+
133
+ # For Migwn, ensure paths are in UNIX format before anything is touched
134
+ if $mingw ; then
135
+ [ -n "$M2_HOME" ] &&
136
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
137
+ [ -n "$JAVA_HOME" ] &&
138
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
139
+ # TODO classpath?
140
+ fi
141
+
142
+ if [ -z "$JAVA_HOME" ]; then
143
+ javaExecutable="`which javac`"
144
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
145
+ # readlink(1) is not available as standard on Solaris 10.
146
+ readLink=`which readlink`
147
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
148
+ if $darwin ; then
149
+ javaHome="`dirname \"$javaExecutable\"`"
150
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
151
+ else
152
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
153
+ fi
154
+ javaHome="`dirname \"$javaExecutable\"`"
155
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
156
+ JAVA_HOME="$javaHome"
157
+ export JAVA_HOME
158
+ fi
159
+ fi
160
+ fi
161
+
162
+ if [ -z "$JAVACMD" ] ; then
163
+ if [ -n "$JAVA_HOME" ] ; then
164
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
165
+ # IBM's JDK on AIX uses strange locations for the executables
166
+ JAVACMD="$JAVA_HOME/jre/sh/java"
167
+ else
168
+ JAVACMD="$JAVA_HOME/bin/java"
169
+ fi
170
+ else
171
+ JAVACMD="`which java`"
172
+ fi
173
+ fi
174
+
175
+ if [ ! -x "$JAVACMD" ] ; then
176
+ echo "Error: JAVA_HOME is not defined correctly." >&2
177
+ echo " We cannot execute $JAVACMD" >&2
178
+ exit 1
179
+ fi
180
+
181
+ if [ -z "$JAVA_HOME" ] ; then
182
+ echo "Warning: JAVA_HOME environment variable is not set."
183
+ fi
184
+
185
+ CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
186
+
187
+ # For Cygwin, switch paths to Windows format before running java
188
+ if $cygwin; then
189
+ [ -n "$M2_HOME" ] &&
190
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
191
+ [ -n "$JAVA_HOME" ] &&
192
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
193
+ [ -n "$CLASSPATH" ] &&
194
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
195
+ fi
196
+
197
+ # traverses directory structure from process work directory to filesystem root
198
+ # first directory with .mvn subdirectory is considered project base directory
199
+ find_maven_basedir() {
200
+ local basedir=$(pwd)
201
+ local wdir=$(pwd)
202
+ while [ "$wdir" != '/' ] ; do
203
+ if [ -d "$wdir"/.mvn ] ; then
204
+ basedir=$wdir
205
+ break
206
+ fi
207
+ wdir=$(cd "$wdir/.."; pwd)
208
+ done
209
+ echo "${basedir}"
210
+ }
211
+
212
+ # concatenates all lines of a file
213
+ concat_lines() {
214
+ if [ -f "$1" ]; then
215
+ echo "$(tr -s '\n' ' ' < "$1")"
216
+ fi
217
+ }
218
+
219
+ export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
220
+ MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
221
+
222
+ # Provide a "standardized" way to retrieve the CLI args that will
223
+ # work with both Windows and non-Windows executions.
224
+ MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
225
+ export MAVEN_CMD_LINE_ARGS
226
+
227
+ WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
228
+
229
+ exec "$JAVACMD" \
230
+ $MAVEN_OPTS \
231
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
232
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
233
+ ${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS
234
+