-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Milestone
Description
Scope of Change
This RFC intends to change the XP runners to a single entry point with multiple subcommands. E.g., instead of writing unittest src/test/php
, we'd write xp test src/test/php
.
Rationale
There are a couple of problems with the current implementation, especially in conjunction with the splitting of the framework:
- Running
unittest
will not work if you don't have the unittest library in your class path once Remove unittests from core core#95 is merged. You can already see this withxcc
, for example. - Even if you have
unittest
in your class path, the command will not work because the unittest runner classes are loaded too late on. - We do not integrate well with Composer's scripts as our runners really are platform-specific executables and need an installer to work well.
- Creating new runners, e.g. for the measure library, means introducing a new shell and a C# implementation, plus putting it in a rather proprietary place.
- We might run out of good names for command line utilities as we seek to find memorizeable names which don't conflict with existing tools.
Functionality
General idea:
Basic functionality
$ xp run Test
$ xp ar cvf app.xar src/main/php=.
$ xp ar xvf app.xar
$ xp eval {code}
$ xp version
$ xp write {code}
$ xp dump {code}
From other packages
$ xp reflect {ref} # = xp lang.mirrors.Inspect {ref}
$ xp test unittest.ini # = unittest unittest.ini
$ xp serve . # = xpws -r .
$ xp measure src/prof/php # = xp xp.measure.Runner src/prof/php
Providing subcommands
Libraries should be able to provide subcommands in an easy way. Inside a project, we usually state our dependencies by using Composer, therefore being able to provide subcommands via its infrastructure would be awesome.
These kinds of subcommands exist:
- The entry point class. This is the easiest of all subcommands. Running "xp test ...", which invokes the subcommand named xp-test, for example, is the same as running "xp unittest.Runner ..."
- The foreground process. For example, "xp serve" (the new "xpws") needs to keep the process running until a certain event, in this case a key press by the user.
- The daemon. Something like the service system; see XPWS Service Mode xp-runners#28.
Security considerations
Speed impact
Dependencies
The form xp Test
which runs Test::main($argv)
must continue to work, as an alias for xp run Test
.
Related documents
- https://golang.org/doc/articles/go_command.html and https://golang.org/cmd/go/
- XP Runners #166 - the original XP Runners RFC