-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load modules #306
Comments
The following was removed because I wasn't too happy with the complexity it added: The Composer integrationThe module path defaults to $COMPOSER_HOME/vendor/{vendor}/{name}, which is used by
Configuring the module pathThe path can also be set inside xp.ini as follows: [runtime]
date.timezone=Europe/Berlin
modules=~/devel/{vendor}/{name}
extension=php_com_dotnet.dll The module We're able to create the new relatively simple approach first without breaking anything in a way where this could not be added later. |
💚 There is no impact on the framework from this RFC and no change necessary, removed "framework" label and added note that this is compatible with XP5, XP6 and the upcoming XP7. |
Released in XP Runners 6.0.0 |
Scope of Change
This RFC suggests adding a command line switch to load modules:
xp -m [path-to-module]
being the (rough) equivalent ofxp -cp [path-to-module]/src/main/php
.Rationale
A central idea of XP 7 is framework modularity. This means many packages previously part of the framework now need to be referenced by either adding them to the class path or by spelling out all the class path entries (plus those of transitive dependencies) on the command line. Running a script to query the database will require either creating a composer.json and running composer or using the longish
xp -cp ~/xp/rdbms/src/main/php -cp ~/xp/networking/src/main/php -cp ~/xp/logging/src/main/php -cp ~/xp/math/src/main/php Script
.Functionality
Syntax:
xp [-m module [-m module [-m ...]]] <options> <Class>
The
module
argument references a module by its top-level directory. The determined directory is then scanned for path files which finally make up the class path.Security considerations
n/a
Speed impact
Supplying
-m module
is slightly slower than-cp module/src/main/php
since the first parses path files to determine the directories. As-cp
is retained, no harm is done.Dependencies
Since all module paths are simply added to the
use
path, this change is compatible with XP5, XP6 and the upcoming XP7!Related documents
The text was updated successfully, but these errors were encountered: