Author: jlboudart
Date: Wed May 22 10:07:09 2013
New Revision: 1485141

URL: http://svn.apache.org/r1485141
Log:
Remove injectTargetIntoExtensionPoint method in favor of 
ProjectHelper.resolveExtensionOfAttributes

Modified:
    
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
    
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
    
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
    ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java

Modified: 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
URL: 
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java?rev=1485141&r1=1485140&r2=1485141&view=diff
==============================================================================
--- 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java 
(original)
+++ 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java 
Wed May 22 10:07:09 2013
@@ -100,9 +100,8 @@ public class EasyAntEngine {
         IvyConfigure easyantIvyConfigure = new IvyConfigure();
         
easyantIvyConfigure.setSettingsId(EasyAntMagicNames.EASYANT_IVY_INSTANCE);
 
-        project.setNewProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS,
-                
this.getClass().getResource("/org/apache/easyant/core/default-easyant-ivysettings.xml")
-                        .toExternalForm());
+        project.setNewProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS, 
this.getClass().getResource(
+                
"/org/apache/easyant/core/default-easyant-ivysettings.xml").toExternalForm());
 
         project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_JAR_URL, 
guessEasyantCoreJarUrl().toExternalForm());
 
@@ -229,8 +228,8 @@ public class EasyAntEngine {
         }
         // if no property is set check the default location
         if (path == null) {
-            File defaultGlboalEasyAntIvySettings = new File(
-                    
helper.replaceProperties(EasyAntConstants.DEFAULT_GLOBAL_EASYANT_IVYSETTINGS));
+            File defaultGlboalEasyAntIvySettings = new File(helper
+                    
.replaceProperties(EasyAntConstants.DEFAULT_GLOBAL_EASYANT_IVYSETTINGS));
             if (!defaultGlboalEasyAntIvySettings.exists()) {
                 return null;
             }
@@ -260,8 +259,8 @@ public class EasyAntEngine {
 
         for (int i = 0; i < configuration.getListeners().size(); i++) {
             String className = (String) 
configuration.getListeners().elementAt(i);
-            BuildListener listener = (BuildListener) 
ClasspathUtils.newInstance(className,
-                    EasyAntEngine.class.getClassLoader(), BuildListener.class);
+            BuildListener listener = (BuildListener) 
ClasspathUtils.newInstance(className, EasyAntEngine.class
+                    .getClassLoader(), BuildListener.class);
             project.setProjectReference(listener);
 
             project.addBuildListener(listener);
@@ -283,8 +282,8 @@ public class EasyAntEngine {
         if (configuration.getInputHandlerClassname() == null) {
             handler = new DefaultInputHandler();
         } else {
-            handler = (InputHandler) 
ClasspathUtils.newInstance(configuration.getInputHandlerClassname(),
-                    Main.class.getClassLoader(), InputHandler.class);
+            handler = (InputHandler) 
ClasspathUtils.newInstance(configuration.getInputHandlerClassname(), Main.class
+                    .getClassLoader(), InputHandler.class);
             project.setProjectReference(handler);
         }
         project.setInputHandler(handler);
@@ -403,7 +402,7 @@ public class EasyAntEngine {
         try {
             project.init();
             project.addReference(EasyAntMagicNames.EASYANT_ENGINE_REF, this);
-    
+
             // set user-define properties
             Enumeration<?> properties = 
configuration.getDefinedProps().propertyNames();
             while (properties.hasMoreElements()) {
@@ -411,14 +410,14 @@ public class EasyAntEngine {
                 String value = (String) 
configuration.getDefinedProps().get(arg);
                 project.setUserProperty(arg, value);
             }
-    
+
             project.setUserProperty(EasyAntMagicNames.EASYANT_OFFLINE, 
Boolean.toString(configuration.isOffline()));
-    
+
             ProjectHelper helper = 
ProjectUtils.configureProjectHelper(project);
-    
+
             IvyAntSettings easyantIvySettings = 
configureEasyAntIvyInstance(project);
             configurePluginService(project, easyantIvySettings);
-    
+
             // Profile
             if (configuration.getActiveBuildConfigurations().size() != 0) {
                 String buildConfigurations = null;
@@ -428,30 +427,29 @@ public class EasyAntEngine {
                     } else {
                         buildConfigurations = buildConfigurations + "," + conf;
                     }
-    
+
                 }
                 project.log("Active build configurations : " + 
buildConfigurations, Project.MSG_INFO);
                 
project.setProperty(EasyAntMagicNames.ACTIVE_BUILD_CONFIGURATIONS, 
buildConfigurations);
             }
             loadSystemPlugins(project, true);
-    
+
             locateBuildModuleAndBuildFile(project);
-    
+
             if (configuration.getBuildModule() != null || 
configuration.getBuildFile() != null) {
                 LoadModule lm = new LoadModule();
                 lm.setBuildModule(configuration.getBuildModule());
                 lm.setBuildFile(configuration.getBuildFile());
                 executeTask(lm, "load-module", project);
             }
-    
-            // FIXME:resolve extensionOf attributes this should be exposed by 
Apache Ant
-            ProjectUtils.injectTargetIntoExtensionPoint(project, helper);      
  
-        } catch (RuntimeException exc) {            
+
+            helper.resolveExtensionOfAttributes(project);
+        } catch (RuntimeException exc) {
             fireBuildFinished(project, exc);
             throw exc;
         } catch (Error e) {
             fireBuildFinished(project, e);
-            throw e;        
+            throw e;
         }
     }
 

Modified: 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
URL: 
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java?rev=1485141&r1=1485140&r2=1485141&view=diff
==============================================================================
--- 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
 (original)
+++ 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/ProjectUtils.java
 Wed May 22 10:07:09 2013
@@ -21,7 +21,6 @@ import java.io.File;
 import java.io.PrintStream;
 import java.lang.reflect.Field;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -29,11 +28,9 @@ import org.apache.tools.ant.BuildExcepti
 import org.apache.tools.ant.BuildListener;
 import org.apache.tools.ant.BuildLogger;
 import org.apache.tools.ant.DefaultLogger;
-import org.apache.tools.ant.ExtensionPoint;
 import org.apache.tools.ant.Location;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.ProjectHelper;
-import org.apache.tools.ant.ProjectHelper.OnMissingExtensionPoint;
 import org.apache.tools.ant.Target;
 
 /**
@@ -122,8 +119,10 @@ public class ProjectUtils {
      */
     public static void printMemoryDetails(Project project) {
         project.log("---- Memory Details ----");
-        project.log("  Used Memory  = "
-                + (Runtime.getRuntime().totalMemory() / MEGABYTE - 
Runtime.getRuntime().freeMemory() / MEGABYTE) + "MB");
+        project
+                .log("  Used Memory  = "
+                        + (Runtime.getRuntime().totalMemory() / MEGABYTE - 
Runtime.getRuntime().freeMemory() / MEGABYTE)
+                        + "MB");
         project.log("  Free Memory  = " + (Runtime.getRuntime().freeMemory() / 
MEGABYTE) + "MB");
         project.log("  Total Memory = " + (Runtime.getRuntime().totalMemory() 
/ MEGABYTE) + "MB");
         project.log("-----------------------");
@@ -160,32 +159,6 @@ public class ProjectUtils {
         return ret;
     }
 
-    public static void injectTargetIntoExtensionPoint(Project project, 
ProjectHelper helper) {
-        for (Object extensionInfos : helper.getExtensionStack()) {
-            String[] extensionInfo = (String[]) extensionInfos;
-            String tgName = extensionInfo[0];
-            String name = extensionInfo[1];
-            OnMissingExtensionPoint missingBehaviour = 
OnMissingExtensionPoint.FAIL;
-            Hashtable<?, ?> projectTargets = project.getTargets();
-            if (!projectTargets.containsKey(tgName)) {
-                String message = "can't add target " + name + " to 
extension-point " + tgName
-                        + " because the extension-point is unknown.";
-                if (missingBehaviour == OnMissingExtensionPoint.FAIL) {
-                    throw new BuildException(message);
-                } else if (missingBehaviour == OnMissingExtensionPoint.WARN) {
-                    Target target = (Target) projectTargets.get(name);
-                    project.log(target, "Warning: " + message, 
Project.MSG_WARN);
-                }
-            } else {
-                Target t = (Target) projectTargets.get(tgName);
-                if (!(t instanceof ExtensionPoint)) {
-                    throw new BuildException("referenced target " + tgName + " 
is not an extension-point");
-                }
-                t.addDependency(name);
-            }
-        }
-    }
-
     @SuppressWarnings("unchecked")
     public static ProjectHelper configureProjectHelper(Project project) {
         ProjectHelper helper = ProjectHelper.getProjectHelper();

Modified: 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
URL: 
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java?rev=1485141&r1=1485140&r2=1485141&view=diff
==============================================================================
--- 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
 (original)
+++ 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
 Wed May 22 10:07:09 2013
@@ -23,8 +23,8 @@ import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Properties;
+import java.util.Map.Entry;
 
 import org.apache.easyant.core.EasyAntConstants;
 import org.apache.easyant.core.EasyAntMagicNames;
@@ -119,8 +119,8 @@ public class DefaultPluginServiceImpl im
             ResolveOptions resolveOptions = new ResolveOptions();
             resolveOptions.setLog(ResolveOptions.LOG_QUIET);
             resolveOptions.setConfs(conf.split(","));
-            ResolveReport report = 
IvyContext.getContext().getIvy().getResolveEngine()
-                    .resolve(pluginIvyFile.toURI().toURL(), resolveOptions);
+            ResolveReport report = 
IvyContext.getContext().getIvy().getResolveEngine().resolve(
+                    pluginIvyFile.toURI().toURL(), resolveOptions);
             eaReport = new EasyAntReport();
             eaReport.setResolveReport(report);
             eaReport.setModuleDescriptor(report.getModuleDescriptor());
@@ -155,8 +155,8 @@ public class DefaultPluginServiceImpl im
             ResolveOptions resolveOptions = new ResolveOptions();
             resolveOptions.setLog(ResolveOptions.LOG_QUIET);
             resolveOptions.setConfs(conf.split(","));
-            final ResolveReport report = 
IvyContext.getContext().getIvy().getResolveEngine()
-                    .resolve(moduleRevisionId, resolveOptions, true);
+            final ResolveReport report = 
IvyContext.getContext().getIvy().getResolveEngine().resolve(moduleRevisionId,
+                    resolveOptions, true);
             eaReport = new EasyAntReport();
             eaReport.setResolveReport(report);
             eaReport.setModuleDescriptor(report.getModuleDescriptor());
@@ -177,8 +177,8 @@ public class DefaultPluginServiceImpl im
                         } else if ("jar".equals(artifact.getType())) {
                             
path.createPathElement().setLocation(artifact.getLocalFile());
                         } else {
-                            handleOtherResourceFile(moduleRevisionId, 
artifact.getName(), artifact.getExt(),
-                                    artifact.getLocalFile());
+                            handleOtherResourceFile(moduleRevisionId, 
artifact.getName(), artifact.getExt(), artifact
+                                    .getLocalFile());
                         }
                     }
                     if (antFile != null && antFile.exists()) {
@@ -249,8 +249,8 @@ public class DefaultPluginServiceImpl im
                 }
                 if (FileSet.class.isAssignableFrom(taskClass)) {
                     FileSet fileSet = (FileSet) maybeConfigureTask(task);
-                    
handleFilesetParameter(task.getRuntimeConfigurableWrapper().getId(), fileSet,
-                            task.getOwningTarget(), eaReport);
+                    
handleFilesetParameter(task.getRuntimeConfigurableWrapper().getId(), fileSet, 
task
+                            .getOwningTarget(), eaReport);
                 }
             }
         }
@@ -280,8 +280,8 @@ public class DefaultPluginServiceImpl im
         importedModuleReport.setMandatory(importTask.isMandatory());
         importedModuleReport.setMode(importTask.getMode());
         importedModuleReport.setAs(importTask.getAs());
-        importedModuleReport
-                
.setEasyantReport(getPluginInfo(ModuleRevisionId.parse(importedModuleReport.getModuleMrid())));
+        importedModuleReport.setEasyantReport(getPluginInfo(ModuleRevisionId
+                .parse(importedModuleReport.getModuleMrid())));
         eaReport.addImportedModuleReport(importedModuleReport);
 
         Message.debug("Ant file import another module called : " + 
importedModuleReport.getModuleMrid() + " with mode "
@@ -492,7 +492,8 @@ public class DefaultPluginServiceImpl im
         loadModule.setLocation(new 
Location(ProjectUtils.emulateMainScript(p).getAbsolutePath()));
         loadModule.setProject(p);
         loadModule.execute();
-        ProjectUtils.injectTargetIntoExtensionPoint(p, 
ProjectUtils.getConfiguredProjectHelper(p));
+        ProjectHelper projectHelper = 
ProjectUtils.getConfiguredProjectHelper(p);
+        projectHelper.resolveExtensionOfAttributes(p);
         analyseProject(p, eaReport, "default");
 
         return eaReport;

Modified: 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java
URL: 
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java?rev=1485141&r1=1485140&r2=1485141&view=diff
==============================================================================
--- 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java 
(original)
+++ 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java 
Wed May 22 10:07:09 2013
@@ -194,7 +194,7 @@ public class SubModule extends AbstractE
             lm.setUseBuildRepository(useBuildRepository);
             lm.execute();
 
-            ProjectUtils.injectTargetIntoExtensionPoint(subModule, helper);
+            helper.resolveExtensionOfAttributes(subModule);
 
             String targetsToRun = filterTargets(subModule);
             printExecutingTargetMsg(subModule);


Reply via email to