Skip to content

Commit 06cbb36

Browse files
author
Christopher Frost
committed
Play Memory Options Formatting
This commit causes the output of the memory calculator to be wrapped in a little bash code to apply '-J' to all of the memory settings as required for Play applications. [#94311316]
1 parent 1b70c22 commit 06cbb36

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/java_buildpack/util/play/post22.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def java_opts
4848
fail "Invalid Java option contains more than one option: '#{option}'"
4949
end
5050

51-
java_opts.map { |java_opt| "-J#{java_opt}" }
51+
java_opts.map { |option| option == '$CALCULATED_MEMORY' ? '${CALCULATED_MEMORY//-/-J-}' : "-J#{option}" }
5252
end
5353

5454
# (see JavaBuildpack::Util::Play::Base#lib_dir)

spec/java_buildpack/util/play/post22_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
end
6060
end
6161

62+
context do
63+
let(:java_opts) { super() << '$CALCULATED_MEMORY' }
64+
65+
it 'does wraps the output of CALCULATED_MEMORY correctly' do
66+
expect(play_app.release).to include('${CALCULATED_MEMORY//-/-J-}')
67+
end
68+
end
69+
6270
context do
6371
let(:java_opts) do
6472
super() << '-Dappdynamics.agent.nodeName=$(expr "$VCAP_APPLICATION" : \'.' \

0 commit comments

Comments
 (0)