Closed thekid closed 8 years ago
Unfortunately, this does not seem to work; the autoload
section references files that either do not exist or are referenced with a wrong path. When fixed, composer.json would include a section like:
"autoload" : {
"files" : ["core/tools/__xp.php", "core/src/main/php/autoload.php"]
},
... and the autoload.php file would need to be created in the appropriate path. However, I have not succeeded in getting that to work because it doesn't work:
core/tools/__xp.php
as first item, it ends up with PHP Fatal error: Cannot bootstrap class lang.Object
as the src/main/php
path is available as classpath.src/main/php/autoload.php
as first item, to make it available as classpath before attempting to load classes from it, it fails with PHP Fatal error: Class 'lang\ClassLoader' not found...
as the class wasn't bootstrapped, yet, by lang.base.php
.Yes, I see:
Timm@slate ~/devel/xp-5x [backport/classpath-precedence]
$ XP_RT=5.6 USE_XP=core xp -cp core/tools/__xp.php -v
Fatal error: Cannot bootstrap class lang.Object
This is broken because of the explicit bootstrapping and aliasing of the omnipresent classes done inside lang.base.php.
It now works with __xp.php (or better yet, directly with lang.base.php, we do not need this indirection in XP5!):
Timm@slate ~/devel/xp-5x [backport/classpath-precedence]
$ XP_RT=5.6 USE_XP=core xp -cp core/tools/lang.base.php -v
XP 5.12.1-dev { PHP 5.6.12 & ZE 2.6.0 } @ Windows NT SLATE 10.0 build 10586 (Windows 10) i586
Copyright (c) 2001-2016 the XP group
FileSystemCL<./core/src/main/php>
FileSystemCL<./core/src/main/resources>
FileSystemCL<./core/src/test/php>
FileSystemCL<./core/src/test/resources>
FileSystemCL<.>
Please have a look after my changes, @kiesel. I'm not sure this will work in all constellations, e.g. when USE_XP
(or use=...
via xp.ini) is not set or points to something other than an XP5 framework.
It would also be nice if you could describe your test setup and how to reproduce it with a bunch of shell commands (or a Dockerfile?), this would help greatly. Otherwise we'll have to debug this on-site.
Figured out we can't make this work reliably... really, upgrade to XP7 (or XP6, if you must!)
See https://github.com/xp-framework/xp-runners/pull/39 (relevant for XP6)
:warning: Needs real-life testing, unit tests don't cover all necessary paths