Index: src/infrastructure/celerity/CelerityResourceMap.php =================================================================== --- src/infrastructure/celerity/CelerityResourceMap.php +++ src/infrastructure/celerity/CelerityResourceMap.php @@ -108,7 +108,7 @@ return idx($this->resourceMap, $symbol); } - public function lookupFileInformation($path) { + private function lookupFileInformation($path) { if (empty($this->reverseMap)) { $this->reverseMap = array(); foreach ($this->resourceMap as $symbol => $data) { @@ -119,4 +119,36 @@ return idx($this->reverseMap, $path); } + + /** + * Return the fully-qualified, absolute URI for the resource associated with + * a resource name. This method is fairly low-level and ignores packaging. + * + * @param string Resource name to lookup. + * @return string Fully-qualified resource URI. + */ + public function getFullyQualifiedURIForName($name) { + $info = $this->lookupFileInformation($name); + if ($info) { + return idx($info, 'uri'); + } + return null; + } + + + /** + * Return the resource symbols required by a named resource. + * + * @param string Resource name to lookup. + * @return list List of required symbols. + */ + public function getRequiredSymbolsForName($name) { + $info = $this->lookupFileInformation($name); + if ($info) { + return idx($info, 'requires', array()); + } + return null; + } + + } Index: src/infrastructure/celerity/CelerityResourceTransformer.php =================================================================== --- src/infrastructure/celerity/CelerityResourceTransformer.php +++ src/infrastructure/celerity/CelerityResourceTransformer.php @@ -127,9 +127,9 @@ $uri = $this->rawResourceMap[$uri]['uri']; } } else if ($this->celerityMap) { - $info = $this->celerityMap->lookupFileInformation($uri); - if ($info) { - $uri = $info['uri']; + $resource_uri = $this->celerityMap->getFullyQualifiedURIForName($uri); + if ($resource_uri) { + $uri = $resource_uri; } } Index: src/infrastructure/celerity/api.php =================================================================== --- src/infrastructure/celerity/api.php +++ src/infrastructure/celerity/api.php @@ -52,10 +52,10 @@ function celerity_get_resource_uri($resource) { $map = CelerityResourceMap::getInstance(); - $info = $map->lookupFileInformation($resource); - if ($info) { - return $info['uri']; - } else { - return $resource; + $uri = $map->getFullyQualifiedURIForName($resource); + if ($uri) { + return $uri; } + + return $resource; } Index: src/infrastructure/lint/linter/PhabricatorJavelinLinter.php =================================================================== --- src/infrastructure/lint/linter/PhabricatorJavelinLinter.php +++ src/infrastructure/lint/linter/PhabricatorJavelinLinter.php @@ -147,21 +147,20 @@ $path); $need = $external_classes; - $info = $celerity->lookupFileInformation(substr($path, strlen('webroot'))); - if (!$info) { - $info = array(); + $resource_name = substr($path, strlen('webroot')); + $requires = $celerity->getRequiredSymbolsForName($resource_name); + if (!$requires) { + $requires = array(); } - $requires = idx($info, 'requires', array()); - - foreach ($requires as $key => $name) { - $symbol_info = $celerity->lookupSymbolInformation($name); + foreach ($requires as $key => $symbol_name) { + $symbol_info = $celerity->lookupSymbolInformation($symbol_name); if (!$symbol_info) { $this->raiseLintAtLine( 0, 0, self::LINT_UNKNOWN_DEPENDENCY, - "This file @requires component '{$name}', but it does not ". + "This file @requires component '{$symbol_name}', but it does not ". "exist. You may need to rebuild the Celerity map."); unset($requires[$key]); continue;