public InputReferences transform(Closure<?> closure) { InputReferences inputs = new InputReferences(); RuleMetadata ruleMetadata = getRuleMetadata(closure); inputs.absolutePaths( ruleMetadata.absoluteInputPaths(), ruleMetadata.absoluteInputLineNumbers()); return inputs; }
// TODO given that all the closures are from the same file, we should do the relativising once. // that would entail adding location information to the model {} outer closure. @Override public SourceLocation transform(Closure<?> closure) { RuleMetadata ruleMetadata = getRuleMetadata(closure); URI uri = URI.create(ruleMetadata.absoluteScriptSourceLocation()); String scheme = uri.getScheme(); String description; if ("file".equalsIgnoreCase(scheme)) { description = relativeFilePathResolver.resolveAsRelativePath( ruleMetadata.absoluteScriptSourceLocation()); } else { description = uri.toString(); } return new SourceLocation( uri.toString(), description, ruleMetadata.lineNumber(), ruleMetadata.columnNumber()); }