Closed thekid closed 13 years ago
I would like to move net.xp_framework.unittest.runner.cli.CliRunner and net.xp_framework.xar.Xar to skeleton/ somewhere to get rid of the dependency on xp-net.xp_framework-X.X.X.xar
friebe, Mon, 12 May 2008 17:14:05 +0200
The utilities opcodes and xcc only apply to the compiled version of XP, see xp-framework/rfc #52.
friebe, Mon, 12 May 2008 17:47:12 +0200
The utilities cgen and doclet are new!
friebe, Mon, 12 May 2008 17:52:04 +0200
The utility "qnt" is currently under development in the XP framework's experiments.
friebe, Mon, 12 May 2008 17:53:43 +0200
Scope of Change
This RFC defines the standards for the XP runners.
Rationale
Clarification is needed.
Functionality
XP runners make it easy to run XP classes.
Hello World-Example
Hello.class.php:
To run this code with php, we would have to type:
If we use the XP runner, we simply type:
Boot classpath
The boot classpath consists of the following entries:
Release:
Dev:
These files compose the essentials of the XP framework.
Path files
Inspired by a little-known feature in Python (
.pth
-files), the XP framework loads path files (which contain a list of paths, each on a line by itself) and adds them toinclude_path
.Paths inside
.pth
files are expanded relative to the file they are contained in. The special tilde character (~
) may be used to reference the home directory (getenv HOME
on Un*x and Cygwin,getenv HOMEPATH
on Windows).Path files are searched for in the following locations:
dirname $0
/*.pth)pwd
/*.pth)Order in path files is significant - paths will be added to the classpath in the order they appear inside the file!
Released versions
Every release comes bundled with the runners:
The runners all use
../lang.base.php
,../lib/xp-rt-VERSION.xar
and../lib/xp-net.xp_framework-VERSION.xar
to ensure no globalinclude_path
setting will "disturb" the class loading process. Assume you have installed the XP framework to/usr/local/lib
. By adding/usr/local/lib/xp-VERSION/bin
to yourPATH
, you can type "xp" in any shell to invoke the xp utility.To add XAR files to the class path temporarily, you can use the "-cp" option, e.g.
xp -cp "/path/to/thekid.xar" de.thekid.Hello
orxp -cp "/path/to/classes" de.thekid.Hello
. To permanently add paths or xar files to the classpath, create a file containing these and save it to /path/to/xp-VERSION/bin/. Its name is irrelevant, though it must end in ".pth".Development checkout
For a development checkout (needed for developing the XP framework itself), the directory tree looks as follows:
Because the env/bin directory contains the "raw" form of our utilities, it is required that the platform-specific versions be setup in another directory, for example as follows:
The boot.pth file would contain:
Another setup (if you don't mind you ~/bin/-directory being "cluttered" with XP binaries):
The boot.pth file would contain:
Project Development and the classpath
If you are developing applications ontop of the XP framework, you probably have the following directory layout:
In a slightly different setup, we'd have a "common" libdir:
To add the "classes" directory and the xars in "lib" (and "common/lib") to your classpath, add a path-file to the PROJECT directory (from which the work will be done):
Released projects and the classpath
The above project is released in a XAR file, and all libraries it depends on are bundled:
To add the "PROJECT-VERSION.xar" and all other xars in the "lib" directory to your classpath:
Framework*2
Developing an internal framework ontop of the released XP framework you'd have a directory layout as follows:
From this directory, the XARs in the common/lib directory would be created. While developing, it is easier to have the xp/classes directory in your classpath; to add it, add the directory to your XP installation.
Assuming the xp-directory from above is in
/home/thekid/devel/xp
and the public XP framework installed in/usr/local/lib/xp-VERSION
and you are fine with allowing this for all users:Websites
When running inside a webserver via PHP's Apache Module, the runners aren't invoked. The boot classpath must be set from within the web server configuration. Here's an example for apache (on Windows):
The index.php file is a generic file:
It determines the class path from
[DOCUMENT_ROOT]/../WEB-INF/web.ini
.Core utility: xp
Basic runner
Core utility: xpcli
The xp command class runner. An alias for
xp util.cmd.Runner
.Core utility: xar
Works with XAR archives. An alias for
xp net.xp_framework.xar.Xar
.Development utility: n
Starts editor.
Development utility: unittest
Runs classes that extend the unittest.TestCase class. An alias for
xp net.xp_framework.unittest.runner.cli.CliRunner
.Development utility: doclet
Runs doclets.
Development utility: qnt
Runs Quantum buildfiles (
build.cxml
).Development utility: cgen
Code generator utility.
Development utility: xcc
Compiles XP sourcecode to bytecode.
Development utility: opcodes
Dumps opcode instructions from compiled bytecode.
Security considerations
None.
Speed impact
None.
Dependencies
None.
Related documents