private Resource getFileAttributeResource() { // Paths are relative to the build file they're imported from, // *not* the current directory (same as entity includes). if (file != null) { if (isExistingAbsoluteFile(file)) { return new FileResource(FILE_UTILS.normalize(file)); } File buildFile = new File(getLocation().getFileName()).getAbsoluteFile(); if (buildFile.exists()) { File buildFileParent = new File(buildFile.getParent()); File importedFile = FILE_UTILS.resolveFile(buildFileParent, file); return new FileResource(importedFile); } // maybe this import tasks is inside an imported URL? try { URL buildFileURL = new URL(getLocation().getFileName()); URL importedFile = new URL(buildFileURL, file); return new URLResource(importedFile); } catch (MalformedURLException ex) { log(ex.toString(), Project.MSG_VERBOSE); } throw new BuildException("failed to resolve %s relative to %s", file, getLocation().getFileName()); } return null; }
if (getLocation() == null || getLocation().getFileName() == null) { throw new BuildException("Unable to get location of import task");
private void importResource(ProjectHelper helper, Resource importedResource) { getProject().log("Importing file " + importedResource + " from " + getLocation().getFileName(), Project.MSG_VERBOSE); + getLocation().getFileName(); if (optional) { getProject().log(message, Project.MSG_VERBOSE);
@Override public String getFilePath() { return getLocation().getFileName(); } };
/** * Try to build a script name for the script of the groovy task to have an helpful value in stack traces in case of exception * @return the name to use when compiling the script */ private String computeScriptName() { if (srcFile != null) { return srcFile.getAbsolutePath(); } else { String name = PREFIX; if (getLocation().getFileName().length() > 0) name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_"); else name += SUFFIX; return name; } }
/** * Try to build a script name for the script of the groovy task to have an helpful value in stack traces in case of exception * * @return the name to use when compiling the script */ private String computeScriptName() { if (srcFile != null) { return srcFile.getAbsolutePath(); } else { String name = PREFIX; if (getLocation().getFileName().length() > 0) name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_").replaceAll("[\\.]", "_dot_"); else name += SUFFIX; return name; } }
/** * Try to build a script name for the script of the groovy task to have an helpful value in stack traces in case of exception * * @return the name to use when compiling the script */ private String computeScriptName() { if (srcFile != null) { return srcFile.getAbsolutePath(); } else { String name = PREFIX; if (getLocation().getFileName().length() > 0) name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_").replaceAll("[\\.]", "_dot_"); else name += SUFFIX; return name; } }
/** * Try to build a script name for the script of the groovy task to have an helpful value in stack traces in case of exception * * @return the name to use when compiling the script */ private String computeScriptName() { if (srcFile != null) { return srcFile.getAbsolutePath(); } else { String name = PREFIX; if (getLocation().getFileName().length() > 0) name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_").replaceAll("[\\.]", "_dot_"); else name += SUFFIX; return name; } }
/** * Try to build a script name for the script of the groovy task to have an helpful value in stack traces in case of exception * * @return the name to use when compiling the script */ private String computeScriptName() { if (srcFile != null) { return srcFile.getAbsolutePath(); } else { String name = PREFIX; if (getLocation().getFileName().length() > 0) name += getLocation().getFileName().replaceAll("[^\\w_\\.]", "_"); else name += SUFFIX; return name; } }
public MessageBean setLocation(final Location location) { final MessageBean ret = new MessageBean(this); ret.srcFile = toURI(location.getFileName()); ret.srcLine = location.getLineNumber(); ret.srcColumn = location.getColumnNumber(); return ret; }
private void setExternalInformation(Task newTask, AntTaskNode newNode) { String taskFileName = newTask.getLocation().getFileName(); boolean external = isNodeExternal(taskFileName); newNode.setExternal(external); if (external) { newNode.setFilePath(taskFileName); } }
|| buildException.getLocation().getFileName() == null ) File antFile = new File( buildException.getLocation().getFileName() ); if ( !antFile.exists() )
@Override public void addTarget(Target newTarget, int line, int column) { AntTargetNode targetNode = AntTargetNode.newAntTargetNode(newTarget); fProjectNode.addChildNode(targetNode); fCurrentTargetNode = targetNode; fStillOpenElements.push(targetNode); if (fNodeBeingResolved instanceof AntImportNode) { targetNode.setImportNode(fNodeBeingResolved); targetNode.setExternal(true); targetNode.setFilePath(newTarget.getLocation().getFileName()); } else { String targetFileName = newTarget.getLocation().getFileName(); boolean external = isNodeExternal(targetFileName); targetNode.setExternal(external); if (external) { targetNode.setFilePath(targetFileName); } } computeOffset(targetNode, line, column); }