Allow specifying custom celerity resource map

Summary:
We have custom static resources.
We currently include them in Phabricator's celerity resource map which is causing some pain - we need to regenerate the file without our custom resources before pushing upstream, we need to discard our changes before pulling from upstream and we need to rebuild with our changes to run Phabricator.

This diff allows writing and reading the map in other location.
The plan is this - I will run `celerity_mapper.php` twice - once to build Phabricator-only resources (to push to upstream) and once to build Phabricator + ours resoruces to put in our directory.

Better solution would be to create a map just with our resources and read and combine it with Phabricator resources.
But it is complicated because we have dependencies on Phabricator resources.

Test Plan:
`celerity_mapper.php webroot`
`celerity_mapper.php webroot ../facebook/src/__celerity_resource_map__.php`
Delete Phabricator's celerity map, set 'celerity.resource-path' and successfully load Phabricator.

Reviewers: epriestley, edward

Reviewed By: epriestley

CC: aran, Koolvin

Maniphest Tasks: T721

Differential Revision: https://secure.phabricator.com/D2630
This commit is contained in:
vrana
2012-05-31 16:04:10 -07:00
parent 06b0f0d8ab
commit 8883c9494f
4 changed files with 53 additions and 16 deletions

View File

@@ -35,7 +35,10 @@ final class CelerityResourceMap {
if (empty(self::$instance)) {
self::$instance = new CelerityResourceMap();
$root = phutil_get_library_root('phabricator');
$ok = include_once $root.'/__celerity_resource_map__.php';
$path = PhabricatorEnv::getEnvConfig(
'celerity.resource-map',
'__celerity_resource_map__.php');
$ok = include_once Filesystem::resolvePath($path, $root);
if (!$ok) {
throw new Exception("Failed to load Celerity resource map!");
}