propane 3.3.1-java → 3.6.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -2
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -3
  5. data/.travis.yml +9 -0
  6. data/CHANGELOG.md +17 -5
  7. data/Gemfile +2 -0
  8. data/README.md +17 -8
  9. data/Rakefile +16 -30
  10. data/bin/propane +3 -1
  11. data/lib/propane.rb +6 -4
  12. data/lib/propane/app.rb +20 -10
  13. data/lib/propane/creators/sketch_class.rb +7 -1
  14. data/lib/propane/creators/sketch_factory.rb +4 -2
  15. data/lib/propane/creators/sketch_writer.rb +1 -0
  16. data/lib/propane/helper_methods.rb +23 -24
  17. data/lib/propane/helpers/numeric.rb +2 -0
  18. data/lib/propane/helpers/version_error.rb +1 -0
  19. data/lib/propane/library.rb +5 -1
  20. data/lib/propane/library_loader.rb +2 -0
  21. data/lib/propane/native_folder.rb +21 -15
  22. data/lib/propane/native_loader.rb +3 -0
  23. data/lib/propane/runner.rb +14 -6
  24. data/lib/propane/version.rb +2 -1
  25. data/library/boids/boids.rb +21 -11
  26. data/library/color_group/color_group.rb +28 -0
  27. data/library/control_panel/control_panel.rb +8 -5
  28. data/library/dxf/dxf.rb +6 -0
  29. data/library/file_chooser/chooser.rb +10 -9
  30. data/library/file_chooser/file_chooser.rb +10 -9
  31. data/library/library_proxy/library_proxy.rb +2 -0
  32. data/library/net/net.rb +7 -0
  33. data/library/simplex_noise/simplex_noise.rb +2 -0
  34. data/library/slider/slider.rb +23 -22
  35. data/library/vector_utils/vector_utils.rb +4 -0
  36. data/library/video_event/video_event.rb +4 -1
  37. data/mvnw +127 -51
  38. data/mvnw.cmd +182 -145
  39. data/pom.rb +53 -50
  40. data/pom.xml +17 -8
  41. data/propane.gemspec +13 -11
  42. data/src/main/java/monkstone/ColorUtil.java +13 -1
  43. data/src/main/java/monkstone/MathToolModule.java +253 -203
  44. data/src/main/java/monkstone/PropaneLibrary.java +2 -2
  45. data/src/main/java/monkstone/fastmath/Deglut.java +1 -1
  46. data/src/main/java/monkstone/filechooser/Chooser.java +2 -1
  47. data/src/main/java/monkstone/noise/SimplexNoise.java +2 -2
  48. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  49. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  50. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  51. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  52. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  53. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  54. data/src/main/java/monkstone/slider/WheelHandler.java +7 -6
  55. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  56. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +2 -2
  57. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
  58. data/src/main/java/monkstone/videoevent/CaptureEvent.java +27 -0
  59. data/src/main/java/monkstone/videoevent/{VideoInterface.java → MovieEvent.java} +11 -27
  60. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  61. data/src/main/java/processing/awt/PGraphicsJava2D.java +2164 -1661
  62. data/src/main/java/processing/awt/PImageAWT.java +377 -0
  63. data/src/main/java/processing/awt/PShapeJava2D.java +280 -268
  64. data/src/main/java/processing/awt/PSurfaceAWT.java +942 -829
  65. data/src/main/java/processing/awt/ShimAWT.java +581 -0
  66. data/src/main/java/processing/core/PApplet.java +831 -824
  67. data/src/main/java/processing/core/PConstants.java +477 -447
  68. data/src/main/java/processing/core/PFont.java +914 -880
  69. data/src/main/java/processing/core/PGraphics.java +229 -213
  70. data/src/main/java/processing/core/PImage.java +620 -318
  71. data/src/main/java/processing/core/PMatrix.java +172 -159
  72. data/src/main/java/processing/core/PMatrix2D.java +478 -409
  73. data/src/main/java/processing/core/PMatrix3D.java +762 -735
  74. data/src/main/java/processing/core/PShape.java +2888 -2652
  75. data/src/main/java/processing/core/PShapeOBJ.java +436 -415
  76. data/src/main/java/processing/core/PShapeSVG.java +1702 -1479
  77. data/src/main/java/processing/core/PStyle.java +40 -37
  78. data/src/main/java/processing/core/PSurface.java +139 -97
  79. data/src/main/java/processing/core/PSurfaceNone.java +296 -208
  80. data/src/main/java/processing/core/PVector.java +997 -965
  81. data/src/main/java/processing/core/ThinkDifferent.java +12 -17
  82. data/src/main/java/processing/data/DoubleDict.java +756 -710
  83. data/src/main/java/processing/data/DoubleList.java +749 -696
  84. data/src/main/java/processing/data/FloatDict.java +748 -702
  85. data/src/main/java/processing/data/FloatList.java +751 -697
  86. data/src/main/java/processing/data/IntDict.java +720 -673
  87. data/src/main/java/processing/data/IntList.java +699 -633
  88. data/src/main/java/processing/data/JSONArray.java +931 -873
  89. data/src/main/java/processing/data/JSONObject.java +1262 -1165
  90. data/src/main/java/processing/data/JSONTokener.java +351 -341
  91. data/src/main/java/processing/data/LongDict.java +710 -663
  92. data/src/main/java/processing/data/LongList.java +701 -635
  93. data/src/main/java/processing/data/Sort.java +37 -41
  94. data/src/main/java/processing/data/StringDict.java +525 -486
  95. data/src/main/java/processing/data/StringList.java +626 -580
  96. data/src/main/java/processing/data/Table.java +3690 -3510
  97. data/src/main/java/processing/data/TableRow.java +182 -183
  98. data/src/main/java/processing/data/XML.java +957 -883
  99. data/src/main/java/processing/dxf/RawDXF.java +404 -0
  100. data/src/main/java/processing/event/Event.java +87 -66
  101. data/src/main/java/processing/event/KeyEvent.java +48 -41
  102. data/src/main/java/processing/event/MouseEvent.java +88 -113
  103. data/src/main/java/processing/event/TouchEvent.java +10 -6
  104. data/src/main/java/processing/javafx/PGraphicsFX2D.java +20 -345
  105. data/src/main/java/processing/javafx/PSurfaceFX.java +149 -121
  106. data/src/main/java/processing/net/Client.java +744 -0
  107. data/src/main/java/processing/net/Server.java +388 -0
  108. data/src/main/java/processing/opengl/FontTexture.java +289 -270
  109. data/src/main/java/processing/opengl/FrameBuffer.java +386 -364
  110. data/src/main/java/processing/opengl/LinePath.java +547 -500
  111. data/src/main/java/processing/opengl/LineStroker.java +588 -581
  112. data/src/main/java/processing/opengl/PGL.java +3047 -2914
  113. data/src/main/java/processing/opengl/PGraphics2D.java +408 -315
  114. data/src/main/java/processing/opengl/PGraphics3D.java +107 -72
  115. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12378 -12075
  116. data/src/main/java/processing/opengl/PJOGL.java +1753 -1670
  117. data/src/main/java/processing/opengl/PShader.java +1266 -1257
  118. data/src/main/java/processing/opengl/PShapeOpenGL.java +4678 -4580
  119. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1114 -1027
  120. data/src/main/java/processing/opengl/Texture.java +1492 -1401
  121. data/src/main/java/processing/opengl/VertexBuffer.java +57 -55
  122. data/test/create_test.rb +21 -20
  123. data/test/deglut_spec_test.rb +4 -2
  124. data/test/helper_methods_test.rb +49 -20
  125. data/test/math_tool_test.rb +39 -32
  126. data/test/native_folder.rb +47 -0
  127. data/test/respond_to_test.rb +3 -2
  128. data/test/sketches/key_event.rb +2 -2
  129. data/test/sketches/library/my_library/my_library.rb +3 -0
  130. data/test/test_helper.rb +2 -0
  131. data/test/vecmath_spec_test.rb +35 -22
  132. data/vendors/Rakefile +33 -62
  133. metadata +54 -45
  134. data/src/main/java/processing/core/util/image/ImageLoadFacade.java +0 -161
  135. data/src/main/java/processing/core/util/image/ImageSaveFacade.java +0 -169
  136. data/src/main/java/processing/core/util/image/constants/TifConstants.java +0 -45
  137. data/src/main/java/processing/core/util/image/load/AwtImageLoadStrategy.java +0 -80
  138. data/src/main/java/processing/core/util/image/load/Base64StringImageLoadStrategy.java +0 -73
  139. data/src/main/java/processing/core/util/image/load/FallbackImageLoadStrategy.java +0 -70
  140. data/src/main/java/processing/core/util/image/load/ImageIoImageLoadStrategy.java +0 -132
  141. data/src/main/java/processing/core/util/image/load/ImageLoadStrategy.java +0 -48
  142. data/src/main/java/processing/core/util/image/load/ImageLoadUtil.java +0 -45
  143. data/src/main/java/processing/core/util/image/load/TgaImageLoadStrategy.java +0 -255
  144. data/src/main/java/processing/core/util/image/load/TiffImageLoadStrategy.java +0 -98
  145. data/src/main/java/processing/core/util/image/save/ImageSaveStrategy.java +0 -49
  146. data/src/main/java/processing/core/util/image/save/ImageSaveUtil.java +0 -48
  147. data/src/main/java/processing/core/util/image/save/ImageWriterImageSaveStrategy.java +0 -179
  148. data/src/main/java/processing/core/util/image/save/SaveImageException.java +0 -41
  149. data/src/main/java/processing/core/util/image/save/TgaImageSaveStrategy.java +0 -198
  150. data/src/main/java/processing/core/util/image/save/TiffImageSaveStrategy.java +0 -91
  151. data/src/main/java/processing/core/util/image/save/TiffNakedFilenameImageSaveStrategy.java +0 -57
  152. data/src/main/java/processing/core/util/io/InputFactory.java +0 -285
  153. data/src/main/java/processing/core/util/io/PathUtil.java +0 -109
  154. data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
  155. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
  156. data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
  157. data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ java_import Java::Monkstone::ColorUtil
4
+
5
+ # class wraps a java color array, supports shuffle!, last and ruby_string
6
+ # as well as ability to initialize with an array of "web" color string
7
+ class ColorGroup
8
+ attr_reader :colors
9
+ def initialize(p5cols)
10
+ @colors = p5cols
11
+ end
12
+
13
+ def self.from_web_array(web)
14
+ ColorGroup.new(ColorUtil.web_array(web.to_java(:string)))
15
+ end
16
+
17
+ def shuffle!
18
+ @colors = ColorUtil.shuffle(colors)
19
+ end
20
+
21
+ def ruby_string
22
+ ColorUtil.rubyString(colors)
23
+ end
24
+
25
+ def last
26
+ colors[0]
27
+ end
28
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Here's a little library for quickly hooking up controls to sketches.
2
4
  # For messing with the parameters and such.
3
5
  # These controls will set instance variables on the sketches.
@@ -25,7 +27,7 @@ module ControlPanel
25
27
  add_change_listener do
26
28
  update_label(label, name, value)
27
29
  ControlPanel.app_value(name, value)
28
- proc.call(value) if proc
30
+ proc&.call(value)
29
31
  end
30
32
  ControlPanel.app_value(name, val)
31
33
  end
@@ -49,7 +51,7 @@ module ControlPanel
49
51
  control_panel.add_element(self, name)
50
52
  add_action_listener do
51
53
  ControlPanel.app_value(name, value) unless value.nil?
52
- proc.call(value) if proc
54
+ proc&.call(value)
53
55
  end
54
56
  set_selected_index(initial_value ? elements.index(initial_value) : 0)
55
57
  end
@@ -69,7 +71,7 @@ module ControlPanel
69
71
  control_panel.add_element(self, name, false)
70
72
  add_action_listener do
71
73
  ControlPanel.app_value(name, value)
72
- proc.call(value) if proc
74
+ proc&.call(value)
73
75
  end
74
76
  end
75
77
 
@@ -87,7 +89,7 @@ module ControlPanel
87
89
  control_panel.add_element(self, name, false, true)
88
90
  add_action_listener do
89
91
  Propane.app.send(name)
90
- proc.call(value) if proc
92
+ proc&.call(value)
91
93
  end
92
94
  end
93
95
  end
@@ -160,7 +162,7 @@ module ControlPanel
160
162
  def feel(lf = 'metal')
161
163
  lafinfo = javax.swing.UIManager.getInstalledLookAndFeels
162
164
  laf = lafinfo.to_ary.find do |info|
163
- info.name =~ Regexp.new(Regexp.escape(lf), Regexp::IGNORECASE)
165
+ Regexp.new(Regexp.escape(lf), Regexp::IGNORECASE).match?(info.name)
164
166
  end
165
167
  javax.swing.UIManager.setLookAndFeel(laf.class_name)
166
168
  end
@@ -171,6 +173,7 @@ module ControlPanel
171
173
  def control_panel
172
174
  @control_panel ||= ControlPanel::Panel.new
173
175
  return @control_panel unless block_given?
176
+
174
177
  yield(@control_panel)
175
178
  @control_panel.display
176
179
  @control_panel.set_visible true
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @TODO usage
4
+ class Propane::App
5
+ java_import Java::ProcessingDxf::RawDXF
6
+ end
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Usage: :wq
3
4
  # load_library :chooser
4
- #
5
+ #
5
6
  # def setup
6
- # java_signature 'void selectInput(String, String)'
7
- # selectInput('Select a file to process:', 'fileSelected')
7
+ # java_signature 'void selectInput(String, String)'
8
+ # selectInput('Select a file to process:', 'fileSelected')
8
9
  # end
9
- #
10
+ #
10
11
  # def fileSelected(selection)
11
- # if selection.nil?
12
- # puts 'Window was closed or the user hit cancel.'
13
- # else
14
- # puts format('User selected %s', selection.get_absolute_path)
15
- # end
12
+ # if selection.nil?
13
+ # puts 'Window was closed or the user hit cancel.'
14
+ # else
15
+ # puts format('User selected %s', selection.get_absolute_path)
16
+ # end
16
17
  # end
17
18
  class Propane::App
18
19
  include Java::MonkstoneFilechooser::Chooser
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
- # Usage:
2
+
3
+ # Usage:
3
4
  # load_library :file_chooser
4
5
  # class ...
5
6
  # def setup
6
- # java_signature 'void selectInput(String, String)'
7
- # selectInput('Select a file to process:', 'fileSelected')
7
+ # java_signature 'void selectInput(String, String)'
8
+ # selectInput('Select a file to process:', 'fileSelected')
8
9
  # end
9
- #
10
+ #
10
11
  # def fileSelected(selection)
11
- # if selection.nil?
12
- # puts 'Window was closed or the user hit cancel.'
13
- # else
14
- # puts format('User selected %s', selection.get_absolute_path)
15
- # end
12
+ # if selection.nil?
13
+ # puts 'Window was closed or the user hit cancel.'
14
+ # else
15
+ # puts format('User selected %s', selection.get_absolute_path)
16
+ # end
16
17
  # end
17
18
  # ...
18
19
  class Propane::App
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  java_import Java::MonkstoneCore::LibraryProxy
2
4
  java_import Java::ProcessingEvent::KeyEvent
3
5
  java_import Java::ProcessingEvent::MouseEvent
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @TODO usage
4
+ class Propane::App
5
+ java_import Java::ProcessingNet::Client
6
+ java_import Java::ProcessingNet::Server
7
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Propane::App
2
4
  SimplexNoise = Java::MonkstoneNoise::SimplexNoise
3
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Here's a little library for quickly hooking up in sketch sliders.
3
- # Copyright (c) 2016-19 Martin Prout.
4
+ # Copyright (c) 2015-20 Martin Prout.
4
5
 
5
6
  java_import 'monkstone.slider.CustomHorizontalSlider'
6
7
  java_import 'monkstone.slider.CustomVerticalSlider'
@@ -9,27 +10,27 @@ java_import 'monkstone.slider.CustomVerticalSlider'
9
10
  module Slider
10
11
  def self.slider(app:, x:, y:, name:, **opts)
11
12
  options = default.merge opts
12
- if options[:vertical]
13
- slider = CustomVerticalSlider.new(
14
- app,
15
- x,
16
- y,
17
- options[:length],
18
- options[:range].first,
19
- options[:range].last,
20
- name
21
- )
22
- else
23
- slider = CustomHorizontalSlider.new(
24
- app,
25
- x,
26
- y,
27
- options[:length],
28
- options[:range].first,
29
- options[:range].last,
30
- name
31
- )
32
- end
13
+ slider = if options[:vertical]
14
+ CustomVerticalSlider.new(
15
+ app,
16
+ x,
17
+ y,
18
+ options[:length],
19
+ options[:range].first,
20
+ options[:range].last,
21
+ name
22
+ )
23
+ else
24
+ CustomHorizontalSlider.new(
25
+ app,
26
+ x,
27
+ y,
28
+ options[:length],
29
+ options[:range].first,
30
+ options[:range].last,
31
+ name
32
+ )
33
+ end
33
34
  unless opts.empty?
34
35
  slider.bar_width(opts.fetch(:bar_width, 10))
35
36
  slider.set_value(opts.fetch(:initial_value, 0))
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  PHI ||= (1 + Math.sqrt(5)) / 2 # golden ratio
2
4
  GA = PHI * 2 * Math::PI # golden angle
3
5
 
@@ -48,6 +50,7 @@ module VectorUtil
48
50
  def self.cartesian_to_polar(vec:)
49
51
  res = Vec3D.new(vec.mag, 0, 0)
50
52
  return Vec3D.new unless res.x > 0
53
+
51
54
  res.y = -Math.atan2(vec.z, vec.x)
52
55
  res.z = Math.asin(vec.y / res.x)
53
56
  res
@@ -64,6 +67,7 @@ module VectorUtil
64
67
 
65
68
  def self.polar_to_cartesian(vec:)
66
69
  return Vec3D.new if vec.mag <= 0
70
+
67
71
  Vec3D.new(Math.asin(vec.y / vec.mag), vec.mag, -Math.atan2(vec.z, vec.x))
68
72
  end
69
73
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Propane::App
2
- include Java::MonkstoneVideoevent::VideoInterface
4
+ include Java::MonkstoneVideoevent::CaptureEvent
5
+ include Java::MonkstoneVideoevent::MovieEvent
3
6
  end
data/mvnw CHANGED
@@ -54,38 +54,16 @@ case "`uname`" in
54
54
  CYGWIN*) cygwin=true ;;
55
55
  MINGW*) mingw=true;;
56
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
- ;;
57
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59
+ if [ -z "$JAVA_HOME" ]; then
60
+ if [ -x "/usr/libexec/java_home" ]; then
61
+ export JAVA_HOME="`/usr/libexec/java_home`"
62
+ else
63
+ export JAVA_HOME="/Library/Java/Home"
64
+ fi
65
+ fi
66
+ ;;
89
67
  esac
90
68
 
91
69
  if [ -z "$JAVA_HOME" ] ; then
@@ -130,13 +108,12 @@ if $cygwin ; then
130
108
  CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
131
109
  fi
132
110
 
133
- # For Migwn, ensure paths are in UNIX format before anything is touched
111
+ # For Mingw, ensure paths are in UNIX format before anything is touched
134
112
  if $mingw ; then
135
113
  [ -n "$M2_HOME" ] &&
136
114
  M2_HOME="`(cd "$M2_HOME"; pwd)`"
137
115
  [ -n "$JAVA_HOME" ] &&
138
116
  JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
139
- # TODO classpath?
140
117
  fi
141
118
 
142
119
  if [ -z "$JAVA_HOME" ]; then
@@ -184,27 +161,28 @@ fi
184
161
 
185
162
  CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
186
163
 
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
164
  # traverses directory structure from process work directory to filesystem root
198
165
  # first directory with .mvn subdirectory is considered project base directory
199
166
  find_maven_basedir() {
200
- local basedir=$(pwd)
201
- local wdir=$(pwd)
167
+
168
+ if [ -z "$1" ]
169
+ then
170
+ echo "Path not specified to find_maven_basedir"
171
+ return 1
172
+ fi
173
+
174
+ basedir="$1"
175
+ wdir="$1"
202
176
  while [ "$wdir" != '/' ] ; do
203
177
  if [ -d "$wdir"/.mvn ] ; then
204
178
  basedir=$wdir
205
179
  break
206
180
  fi
207
- wdir=$(cd "$wdir/.."; pwd)
181
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
182
+ if [ -d "${wdir}" ]; then
183
+ wdir=`cd "$wdir/.."; pwd`
184
+ fi
185
+ # end of workaround
208
186
  done
209
187
  echo "${basedir}"
210
188
  }
@@ -216,10 +194,109 @@ concat_lines() {
216
194
  fi
217
195
  }
218
196
 
219
- export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
197
+ BASE_DIR=`find_maven_basedir "$(pwd)"`
198
+ if [ -z "$BASE_DIR" ]; then
199
+ exit 1;
200
+ fi
201
+
202
+ ##########################################################################################
203
+ # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
204
+ # This allows using the maven wrapper in projects that prohibit checking in binary data.
205
+ ##########################################################################################
206
+ if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
207
+ if [ "$MVNW_VERBOSE" = true ]; then
208
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
209
+ fi
210
+ else
211
+ if [ "$MVNW_VERBOSE" = true ]; then
212
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
213
+ fi
214
+ if [ -n "$MVNW_REPOURL" ]; then
215
+ jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
216
+ else
217
+ jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
218
+ fi
219
+ while IFS="=" read key value; do
220
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
221
+ esac
222
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
223
+ if [ "$MVNW_VERBOSE" = true ]; then
224
+ echo "Downloading from: $jarUrl"
225
+ fi
226
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
227
+ if $cygwin; then
228
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
229
+ fi
230
+
231
+ if command -v wget > /dev/null; then
232
+ if [ "$MVNW_VERBOSE" = true ]; then
233
+ echo "Found wget ... using wget"
234
+ fi
235
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
236
+ wget "$jarUrl" -O "$wrapperJarPath"
237
+ else
238
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
239
+ fi
240
+ elif command -v curl > /dev/null; then
241
+ if [ "$MVNW_VERBOSE" = true ]; then
242
+ echo "Found curl ... using curl"
243
+ fi
244
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
245
+ curl -o "$wrapperJarPath" "$jarUrl" -f
246
+ else
247
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248
+ fi
249
+
250
+ else
251
+ if [ "$MVNW_VERBOSE" = true ]; then
252
+ echo "Falling back to using Java to download"
253
+ fi
254
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
255
+ # For Cygwin, switch paths to Windows format before running javac
256
+ if $cygwin; then
257
+ javaClass=`cygpath --path --windows "$javaClass"`
258
+ fi
259
+ if [ -e "$javaClass" ]; then
260
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
261
+ if [ "$MVNW_VERBOSE" = true ]; then
262
+ echo " - Compiling MavenWrapperDownloader.java ..."
263
+ fi
264
+ # Compiling the Java class
265
+ ("$JAVA_HOME/bin/javac" "$javaClass")
266
+ fi
267
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
268
+ # Running the downloader
269
+ if [ "$MVNW_VERBOSE" = true ]; then
270
+ echo " - Running MavenWrapperDownloader.java ..."
271
+ fi
272
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
273
+ fi
274
+ fi
275
+ fi
276
+ fi
277
+ ##########################################################################################
278
+ # End of extension
279
+ ##########################################################################################
280
+
281
+ export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
282
+ if [ "$MVNW_VERBOSE" = true ]; then
283
+ echo $MAVEN_PROJECTBASEDIR
284
+ fi
220
285
  MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
221
286
 
222
- # Provide a "standardized" way to retrieve the CLI args that will
287
+ # For Cygwin, switch paths to Windows format before running java
288
+ if $cygwin; then
289
+ [ -n "$M2_HOME" ] &&
290
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
291
+ [ -n "$JAVA_HOME" ] &&
292
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
293
+ [ -n "$CLASSPATH" ] &&
294
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
295
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
296
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
297
+ fi
298
+
299
+ # Provide a "standardized" way to retrieve the CLI args that will
223
300
  # work with both Windows and non-Windows executions.
224
301
  MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
225
302
  export MAVEN_CMD_LINE_ARGS
@@ -230,5 +307,4 @@ exec "$JAVACMD" \
230
307
  $MAVEN_OPTS \
231
308
  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
232
309
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
233
- ${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS
234
-
310
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"