/** * Set the project associated with this class loader * * @param project the project instance */ public void setProject(Project project) { this.project = project; if (project != null) { project.addBuildListener(this); } }
/** * Logs a message through the project object if one has been provided. * * @param message The message to log. * Should not be <code>null</code>. * * @param priority The logging priority of the message. */ protected void log(String message, int priority) { if (project != null) { project.log(message, priority); } }
/** * Sets the 'useCommonsLang3' property of this class * * @param useCommonsLang3 */ public void setUseCommonsLang3(boolean useCommonsLang3) { super.log("useCommonsLang3 is deprecated. Please remove it from your config.", Project.MSG_WARN); }
public void execute() throws BuildException { if (taskClasspath==null || taskClasspath.size()==0) { throw new BuildException("no classpath given"); } Project project = getProject(); AntClassLoader loader = new AntClassLoader(makeRoot(),true); project.addReference(name,loader); }
DirectoryScanner scanner = new DirectoryScanner(); scanner.setIncludes(new String[]{"**/*.java"}); scanner.setBasedir("C:/Temp"); scanner.setCaseSensitive(false); scanner.scan(); String[] files = scanner.getIncludedFiles();
/** * Sets configuration file. * @param configuration the configuration file, URL, or resource to use */ public void setConfig(String configuration) { if (config != null) { throw new BuildException("Attribute 'config' has already been set"); } config = configuration; }
/** * Adds an element to the classpath to be searched. * * @param pathElement The path element to add. Must not be * <code>null</code>. * * @exception BuildException if the given path element cannot be resolved * against the project. */ public void addPathElement(String pathElement) throws BuildException { File pathComponent = project != null ? project.resolveFile(pathElement) : new File( pathElement); try { addPathFile(pathComponent); } catch (IOException e) { throw new BuildException(e); } }
public void setOnMissingExtensionPoint(final String onMissingExtensionPoint) { try { this.onMissingExtensionPoint = OnMissingExtensionPoint.valueOf(onMissingExtensionPoint); } catch (final IllegalArgumentException e) { throw new BuildException("Invalid onMissingExtensionPoint: " + onMissingExtensionPoint); } }
/** * Returns the location of the error and the error message. * * @return the location of the error and the error message */ public String toString() { return location.toString() + getMessage(); }
/** * Initialize a subproject. * @param subProject the subproject to initialize. */ public void initSubProject(final Project subProject) { ComponentHelper.getComponentHelper(subProject) .initSubProject(ComponentHelper.getComponentHelper(this)); subProject.setDefaultInputStream(getDefaultInputStream()); subProject.setKeepGoingMode(this.isKeepGoingMode()); subProject.setExecutor(getExecutor().getSubProjectExecutor()); }
/** * Get the project name or null * @param event the event * @return the project that raised this event * @since Ant1.7.1 */ protected String extractProjectName(BuildEvent event) { Project project = event.getProject(); return (project != null) ? project.getName() : null; } }
@Override public void buildFinished(BuildEvent event) { if (event.getException() != null) { super.buildFinished(event); } }
/** * Cleans up any resources held by this classloader at the end of * a subbuild if it has been created for the subbuild's project * instance. * * @param event the buildFinished event * * @since Ant 1.6.2 */ public void subBuildFinished(BuildEvent event) { if (event.getProject() == project) { cleanup(); } }
/** * Initialise the project. * * This involves setting the default task definitions and loading the * system properties. * * @exception BuildException if the default task list cannot be loaded. */ public void init() throws BuildException { initProperties(); ComponentHelper.getComponentHelper(this).initDefaultDefinitions(); }
private MethodAndObject createTopLevel( final ComponentHelper helper, final String elementName, final List<Method> methods) { final Class<?> clazz = helper.getComponentClass(elementName); if (clazz == null) { return null; } final Method addMethod = findMatchingMethod(clazz, addTypeMethods); if (addMethod == null) { return null; } final Object addedObject = helper.createComponent(elementName); return new MethodAndObject(addMethod, addedObject); }
/** * Return the class of the component name. * * @param componentName the name of the component, if * the component is in a namespace, the * name is prefixed with the namespace uri and ":". * @return the class if found or null if not. */ public Class<?> getComponentClass(String componentName) { AntTypeDefinition def = getDefinition(componentName); return def == null ? null : def.getExposedClass(project); }
/** * Check if two definitions are the same. * @param def the new definition. * @param old the old definition. * @return true if the two definitions are the same. */ private boolean sameDefinition(AntTypeDefinition def, AntTypeDefinition old) { boolean defValid = validDefinition(def); boolean sameValidity = (defValid == validDefinition(old)); //must have same validity; then if they are valid they must also be the same: return sameValidity && (!defValid || def.sameDefinition(old, project)); }
private void checkScopeProperties(Properties properties) { // make protected the default scope and check for invalid duplication int scopeCount = 0; if (packageScope) scopeCount++; if (privateScope) scopeCount++; if (protectedScope) scopeCount++; if (publicScope) scopeCount++; if (scopeCount == 0) { protectedScope = true; } else if (scopeCount > 1) { throw new BuildException("More than one of public, private, package, or protected scopes specified."); } }