1 package org.antmod.conf; 2 3 import java.io.File ; 4 import java.util.Date ; 5 import java.util.Enumeration ; 6 7 import org.antmod.buildplugin.BuildPluginFactory; 8 import org.antmod.descriptor.DescriptorStoreFactory; 9 import org.antmod.descriptor.ReleaseDescriptor; 10 import org.antmod.util.Os; 11 import org.apache.tools.ant.BuildException; 12 import org.apache.tools.ant.Task; 13 14 21 public final class AntmodPropertiesTask extends Task { 22 23 27 public void execute() throws BuildException { 28 try { 29 AntmodProperties.loadIntoAnt(getProject()); 31 32 BuildPluginFactory.loadPluginHomesIntoAnt(getProject()); 34 35 String currentReleaseName = getProject().getProperty("antmod.release"); 37 if (currentReleaseName != null) { 38 ReleaseDescriptor currentRelease = DescriptorStoreFactory.getConfiguredDescriptorStore().getReleaseDescriptor(currentReleaseName); 39 if (currentRelease != null) { 40 Enumeration propNames = currentRelease.getProperties().propertyNames(); 42 String propName; 43 while (propNames.hasMoreElements()) { 44 propName = (String )propNames.nextElement(); 45 getProject().setProperty(propName, getProject().replaceProperties(currentRelease.getProperties().getProperty(propName))); 46 } 47 48 currentRelease.registerReleaseAttributesInto(getProject()); 50 } 51 } 52 } catch (IllegalArgumentException iae) { 53 throw new BuildException(iae); 54 } 55 56 getProject().setProperty("antmod.version.timestamp", new Date (new File (Os.getEnvironmentVariable("ANTMOD_HOME"), "lib" + File.separator + "antmod.jar").lastModified()).toString()); 58 } 59 60 } 61 | Popular Tags |