Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[#1744] Added parameter parsing for the command line option --jpda.po…

…rt=<port number>

Use the framework id when parsing the jpda.port so that we can specify a separate fixed port to use for debugging per mode
Fixed bug where adding the option '-f' would actually always randomise the jpda_port
Add documentation for the following command line options: http.port, https.port, jpda.port and pid_file
  • Loading branch information...
commit 4e6ff931bfbb551b09251e8857bb98783ccceba3 1 parent 2781512
Kai Inkinen kaiinkinen authored Notalifeform committed
10 documentation/commands/cmd-run.txt
View
@@ -4,7 +4,7 @@
~
~ Synopsis:
~ ~~~~~~~~~
-~ play run [app_path] [--deps] [--%fwk_id] [-f] [--java_options]
+~ play run [app_path] [-f] [--deps] [--%fwk_id] [--http[s].port=<value>] [--jpda.port=<value>] [--java_options]
~
~ Description:
~ ~~~~~~~~~~~~
@@ -37,3 +37,11 @@
~ --silent:
~ Suppress output of the Play ASCII art logo and framework version information.
~
+~ --http.port=<value>:
+~ Override the http.port and %fwk_id.http.port variables in application.conf, and listen to the specified http port
+~
+~ --https.port=<value>:
+~ Override the https.port and %fwk_id.https.port variables in application.conf, and listen to the specified https port
+~
+~ --jpda.port=<value>:
+~ Override the jpda.port and %fwk_id.jpda.port variables in application.conf. Use the specified port (<value>) as the remote debugging port for the application. Can be combined with the option -f
18 documentation/commands/cmd-start.txt
View
@@ -4,7 +4,7 @@
~
~ Synopsis:
~ ~~~~~~~~~
-~ play start [app_path] [--deps] [--%fwk_id] [--java_options]
+~ play start [app_path] ] [-f] [--deps] [--%fwk_id] [--http[s].port=<value>] [--jpda.port=<value>] [--pid_file=<file>] [--java_options]
~
~ Description:
~ ~~~~~~~~~~~~
@@ -25,9 +25,23 @@
~
~ Options:
~ ~~~~~~~~~
+~ -f:
+~ Disable the JPDA port checking and force the jpda.port value.
+~
~ --%fwk_id:
~ Use this ID to run the application (override the default framework ID)
~
~ --deps:
~ Resolve and install dependencies before running the command.
-~
+~
+~ --pid_file=<file>:
+~ Specify where to write the process id (pid) of the background server process.
+~
+~ --http.port=<value>:
+~ Override the http.port and %fwk_id.http.port variables in application.conf, and listen to the specified http port
+~
+~ --https.port=<value>:
+~ Override the https.port and %fwk_id.https.port variables in application.conf, and listen to the specified https port
+~
+~ --jpda.port=<value>:
+~ Override the jpda.port and %fwk_id.jpda.port variables in application.conf. Use the specified port (<value>) as the remote debugging port for the application. Can be combined with the option -f
22 framework/pym/play/application.py
View
@@ -33,7 +33,12 @@ def __init__(self, application_path, env, ignoreMissingModules = False):
else:
self.conf = None
self.play_env = env
- self.jpda_port = self.readConf('jpda.port')
+
+ if env.has_key('jpda.port'):
+ self.jpda_port = env['jpda.port']
+ else:
+ self.jpda_port = self.readConf('jpda.port')
+
self.ignoreMissingModules = ignoreMissingModules
# ~~~~~~~~~~~~~~~~~~~~~~ Configuration File
@@ -223,8 +228,12 @@ def check_jpda(self):
s.bind(('', int(self.jpda_port)))
s.close()
except socket.error, e:
- print 'JPDA port %s is already used. Will try to use any free port for debugging' % self.jpda_port
- self.jpda_port = 0
+ if self.play_env["disable_random_jpda"]:
+ print 'JPDA port %s is already used, and command line option "-f" was specified. Cannot start server\n' % self.jpda_port
+ sys.exit(-1)
+ else:
+ print 'JPDA port %s is already used. Will try to use any free port for debugging' % self.jpda_port
+ self.jpda_port = 0
def java_args_memory(self, java_args):
args_memory = []
@@ -259,7 +268,8 @@ def java_cmd(self, java_args, cp_args=None, className='play.server.Server', args
if cp_args is None:
cp_args = self.cp_args()
- self.jpda_port = self.readConf('jpda.port')
+ if self.play_env.has_key('jpda.port'):
+ self.jpda_port = self.play_env['jpda.port']
application_mode = self.readConf('application.mode').lower()
@@ -283,7 +293,7 @@ def java_cmd(self, java_args, cp_args=None, className='play.server.Server', args
java_args.append('-Dfile.encoding=utf-8')
if self.readConf('application.mode').lower() == 'dev':
- if not self.play_env["disable_check_jpda"]: self.check_jpda()
+ self.check_jpda()
java_args.append('-Xdebug')
java_args.append('-Xrunjdwp:transport=dt_socket,address=%s,server=y,suspend=n' % self.jpda_port)
java_args.append('-Dplay.debug=yes')
@@ -320,6 +330,8 @@ class PlayConfParser:
def __init__(self, confFolder, env):
self.id = env["id"]
self.entries = self.readFile(confFolder, "application.conf")
+ if env.has_key('jpda.port'):
+ self.entries['jpda.port'] = env['jpda.port']
if env.has_key('http.port'):
self.entries['http.port'] = env['http.port']
9 play
View
@@ -101,6 +101,7 @@ try:
# ~~~~~~~~~~~~~~~~~ Override port
get_opt(remaining_args, "http.port", play_env)
get_opt(remaining_args, "https.port", play_env)
+ get_opt(remaining_args, "jpda.port", play_env)
# ~~~~~~~~~~~~~~~~~ Override id
for a in remaining_args:
@@ -119,12 +120,12 @@ try:
print "~ framework ID is %s" % play_env["id"]
print "~"
- # ~~~~~~~~~~~~~~~~~ Checking for disable_check_jpda
- disable_check_jpda = False
+ # ~~~~~~~~~~~~~~~~~ Checking for disable_random_jpda
+ disable_random_jpda = False
if remaining_args.count('-f') == 1:
- disable_check_jpda = True
+ disable_random_jpda = True
remaining_args.remove('-f')
- play_env["disable_check_jpda"] = disable_check_jpda
+ play_env["disable_random_jpda"] = disable_random_jpda
play_app = PlayApplication(application_path, play_env, ignoreMissing)
Please sign in to comment.
Something went wrong with that request. Please try again.