buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/AntDependencyTask.java
changeset 628 7c4a911dc066
parent 588 c7c26511138f
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5  * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description: 
    14  * Description: 
    15 *
    15  *
    16 */
    16  */
    17  
    17 
    18 package com.nokia.ant.taskdefs;
    18 package com.nokia.ant.taskdefs;
    19 
    19 
    20 import java.io.*;
    20 import java.io.BufferedReader;
    21 import java.util.*;
    21 import java.io.BufferedWriter;
    22 
    22 import java.io.ByteArrayInputStream;
       
    23 import java.io.File;
       
    24 import java.io.FileNotFoundException;
       
    25 import java.io.FileOutputStream;
       
    26 import java.io.IOException;
       
    27 import java.io.InputStreamReader;
       
    28 import java.io.OutputStreamWriter;
       
    29 import java.io.UnsupportedEncodingException;
       
    30 import java.io.Writer;
       
    31 import java.net.HttpURLConnection;
       
    32 import java.net.URL;
       
    33 import java.util.ArrayList;
       
    34 import java.util.Collections;
       
    35 import java.util.Enumeration;
       
    36 import java.util.HashSet;
       
    37 import java.util.Hashtable;
       
    38 import java.util.Iterator;
       
    39 import java.util.List;
       
    40 import java.util.Map;
       
    41 import java.util.jar.Attributes;
       
    42 import java.util.jar.JarFile;
       
    43 import java.util.jar.Manifest;
       
    44 import java.util.zip.ZipEntry;
       
    45 
       
    46 import org.apache.tools.ant.DirectoryScanner;
    23 import org.apache.tools.ant.Project;
    47 import org.apache.tools.ant.Project;
    24 import org.apache.tools.ant.Task;
    48 import org.apache.tools.ant.Task;
    25 import org.apache.tools.ant.types.FileSet;
    49 import org.apache.tools.ant.types.FileSet;
    26 import org.apache.tools.ant.DirectoryScanner;
    50 import org.dom4j.Document;
    27 
    51 import org.dom4j.DocumentException;
    28 import java.util.jar.*;
    52 import org.dom4j.Element;
    29 import java.util.zip.ZipEntry;
       
    30 import java.net.*;
       
    31 import org.dom4j.io.SAXReader;
    53 import org.dom4j.io.SAXReader;
    32 import org.dom4j.Document;
       
    33 import org.dom4j.Element;
       
    34 import org.dom4j.DocumentException;
       
    35 
    54 
    36 /**
    55 /**
    37  * Outputs a directed graph of Ant library dependencies, reads information from dependency jars
    56  * Outputs a directed graph of Ant library dependencies, reads information from dependency jars
    38  */
    57  */
    39 public class AntDependencyTask extends Task
    58 public class AntDependencyTask extends Task {
    40 {
       
    41     private ArrayList<FileSet> antFileSetList = new ArrayList<FileSet>();
    59     private ArrayList<FileSet> antFileSetList = new ArrayList<FileSet>();
    42     private String outputFile;
    60     private String outputFile;
    43     
    61 
    44     public AntDependencyTask()
    62     public AntDependencyTask() {
    45     {
       
    46         setTaskName("AntDependencyTask");
    63         setTaskName("AntDependencyTask");
    47     }
    64     }
    48     
    65 
    49     /**
    66     /**
    50      * Add a set of files to copy.
    67      * Add a set of files to copy.
       
    68      * 
    51      * @param set a set of files to AntDependencyTask.
    69      * @param set a set of files to AntDependencyTask.
    52      * @ant.required
    70      * @ant.required
    53      */
    71      */
    54     public void addFileset(FileSet set) {
    72     public void addFileset(FileSet set) {
    55         antFileSetList.add(set);
    73         antFileSetList.add(set);
    56     }
    74     }
    57     
    75 
    58     /**
    76     /**
    59      * Location of graph file to output to
    77      * Location of graph file to output to
       
    78      * 
    60      * @ant.required
    79      * @ant.required
    61      */
    80      */
    62     public void setOutputFile(String path)
    81     public void setOutputFile(String path) {
    63     {
       
    64         outputFile = path;
    82         outputFile = path;
    65     }
    83     }
    66     
    84 
    67     public String classToJar(Class aclass)
    85     public String classToJar(Class aclass) {
    68     {
       
    69         String name = aclass.getName().replace(".", "/") + ".class";
    86         String name = aclass.getName().replace(".", "/") + ".class";
    70       
    87 
    71         for (Iterator iterator = antFileSetList.iterator(); iterator.hasNext();)
    88         for (Iterator iterator = antFileSetList.iterator(); iterator.hasNext();) {
    72         {
       
    73             FileSet fs = (FileSet) iterator.next();
    89             FileSet fs = (FileSet) iterator.next();
    74             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
    90             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
    75             String[] srcFiles = ds.getIncludedFiles();
    91             String[] srcFiles = ds.getIncludedFiles();
    76             String basedir = ds.getBasedir().getPath();
    92             String basedir = ds.getBasedir().getPath();
    77             //log(basedir);
    93             // log(basedir);
    78             
    94 
    79             for (int i = 0; i < srcFiles.length; i++)
    95             for (int i = 0; i < srcFiles.length; i++) {
    80             {
       
    81                 String fileName = basedir + File.separator + srcFiles[i];
    96                 String fileName = basedir + File.separator + srcFiles[i];
    82                 //log(fileName);
    97                 // log(fileName);
    83                 try {
    98                 try {
    84                     JarFile jar = new JarFile(fileName);
    99                     JarFile jar = new JarFile(fileName);
    85                     
   100 
    86                     //for (Enumeration e = jar.entries(); e.hasMoreElements() ;) {log(e.nextElement().toString()); }
   101                     // for (Enumeration e = jar.entries(); e.hasMoreElements() ;)
    87                     
   102                     // {log(e.nextElement().toString()); }
    88                     if (jar.getJarEntry(name) != null)
   103 
       
   104                     if (jar.getJarEntry(name) != null) {
    89                         return fileName;
   105                         return fileName;
    90                 }
   106                     }
    91                 catch (IOException e) { 
   107                 }
       
   108                 catch (IOException e) {
    92                     // We are Ignoring the errors as no need to fail the build.
   109                     // We are Ignoring the errors as no need to fail the build.
    93                     log(e.getMessage(), Project.MSG_DEBUG);
   110                     log(e.getMessage(), Project.MSG_DEBUG);
    94                 }
   111                 }
    95             }
   112             }
    96         }
   113         }
    97         log(name + " not found", Project.MSG_DEBUG);
   114         log(name + " not found", Project.MSG_DEBUG);
    98         return null;
   115         return null;
    99     }
   116     }
   100     
   117 
   101     public String getJarAttr(JarFile jar, String nameOfAttr)
   118     public String getJarAttr(JarFile jar, String nameOfAttr) {
   102     {
       
   103         try {
   119         try {
   104             String attr = jar.getManifest().getMainAttributes().getValue(nameOfAttr);
   120             String attr = jar.getManifest().getMainAttributes().getValue(nameOfAttr);
   105             if (attr != null)
   121             if (attr != null) {
   106                 return attr;
   122                 return attr;
   107         
   123             }
       
   124 
   108             Manifest manifest = jar.getManifest();
   125             Manifest manifest = jar.getManifest();
   109             Map map = manifest.getEntries();
   126             Map map = manifest.getEntries();
   110         
   127 
   111             for (Iterator it = map.keySet().iterator(); it.hasNext(); ) {
   128             for (Iterator it = map.keySet().iterator(); it.hasNext();) {
   112                 String entryName = (String)it.next();
   129                 String entryName = (String) it.next();
   113                 Attributes attrs = (Attributes)map.get(entryName);
   130                 Attributes attrs = (Attributes) map.get(entryName);
   114         
   131 
   115                 for (Iterator it2 = attrs.keySet().iterator(); it2.hasNext(); )
   132                 for (Iterator it2 = attrs.keySet().iterator(); it2.hasNext();) {
   116                 {
   133                     Attributes.Name attrName = (Attributes.Name) it2.next();
   117                     Attributes.Name attrName = (Attributes.Name)it2.next();
   134                     if (attrName.toString() == nameOfAttr) {
   118                         if (attrName.toString() == nameOfAttr)
   135                         return attrs.getValue(attrName).replace("\"", "");
   119                             return attrs.getValue(attrName).replace("\"", "");
   136                     }
   120                 }
   137                 }
   121             }
   138             }
   122         } catch (IOException e) {
   139         }
       
   140         catch (IOException e) {
   123             // We are Ignoring the errors as no need to fail the build.
   141             // We are Ignoring the errors as no need to fail the build.
   124             log("Not able to get the JAR file attribute information. " + e.getMessage(), Project.MSG_DEBUG);
   142             log("Not able to get the JAR file attribute information. " + e.getMessage(), Project.MSG_DEBUG);
   125         }
   143         }
   126         return null;
   144         return null;
   127     }
   145     }
   128     
   146 
   129     public HashSet<String> getJarInfo()
   147     public HashSet<String> getJarInfo() {
   130     {
       
   131         HashSet<String> classlist = new HashSet<String>();
   148         HashSet<String> classlist = new HashSet<String>();
   132         
   149 
   133         for (Iterator iterator = antFileSetList.iterator(); iterator.hasNext();)
   150         for (Iterator iterator = antFileSetList.iterator(); iterator.hasNext();) {
   134         {
       
   135             FileSet fs = (FileSet) iterator.next();
   151             FileSet fs = (FileSet) iterator.next();
   136             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
   152             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
   137             String[] srcFiles = ds.getIncludedFiles();
   153             String[] srcFiles = ds.getIncludedFiles();
   138             String basedir = ds.getBasedir().getPath();
   154             String basedir = ds.getBasedir().getPath();
   139             //log(basedir);
   155             // log(basedir);
   140             
   156 
   141             for (int i = 0; i < srcFiles.length; i++)
   157             for (int i = 0; i < srcFiles.length; i++) {
   142             {
       
   143                 String fileName = basedir + File.separator + srcFiles[i];
   158                 String fileName = basedir + File.separator + srcFiles[i];
   144                 //log(fileName);
   159                 // log(fileName);
   145                 try {
   160                 try {
   146                     JarFile jar = new JarFile(fileName);
   161                     JarFile jar = new JarFile(fileName);
   147                     
   162 
   148                     String vendor = getJarAttr(jar, "Implementation-Vendor");
   163                     String vendor = getJarAttr(jar, "Implementation-Vendor");
   149                     String version = getJarAttr(jar, "Implementation-Version");
   164                     String version = getJarAttr(jar, "Implementation-Version");
   150                     if (version == null)
   165                     if (version == null) {
   151                         version = getJarAttr(jar, "Specification-Version");
   166                         version = getJarAttr(jar, "Specification-Version");
       
   167                     }
   152                     String name = convertJarName(fileName);
   168                     String name = convertJarName(fileName);
   153                     
   169 
   154                     //findLicense(srcFiles[i], jar);
   170                     // findLicense(srcFiles[i], jar);
   155                     
   171 
   156                     String nameandversion = name;
   172                     String nameandversion = name;
   157                     
   173 
   158                     if (version != null)
   174                     if (version != null) {
   159                     {
       
   160                         version = version.replace("$", "");
   175                         version = version.replace("$", "");
   161                         if (!digitInString(name))
   176                         if (!digitInString(name)) {
   162                             nameandversion = name + " " + version;
   177                             nameandversion = name + " " + version;
   163                     }
   178                         }
   164                     if (vendor == null)
   179                     }
       
   180                     if (vendor == null) {
   165                         vendor = "";
   181                         vendor = "";
   166                     classlist.add(name + " [style=filled,shape=record,label=\"" + nameandversion + "|" + vendor + "\"];");
   182                     }
   167                 }
   183                     classlist.add(name + " [style=filled,shape=record,label=\"" + nameandversion
   168                 catch (IOException e) { 
   184                         + "|" + vendor + "\"];");
       
   185                 }
       
   186                 catch (IOException e) {
   169                     // We are Ignoring the errors as no need to fail the build.
   187                     // We are Ignoring the errors as no need to fail the build.
   170                     e.printStackTrace(); 
   188                     e.printStackTrace();
   171                 }
   189                 }
   172             }
   190             }
   173         }
   191         }
   174 
   192 
   175         return classlist;
   193         return classlist;
   176     }
   194     }
   177     
   195 
   178     public void findLicense(String name, JarFile jar)
   196     public void findLicense(String name, JarFile jar) {
   179     {
       
   180         try {
   197         try {
   181             ZipEntry entry = jar.getEntry("META-INF/LICENSE");
   198             ZipEntry entry = jar.getEntry("META-INF/LICENSE");
   182             if (entry == null)
   199             if (entry == null) {
   183                 entry = jar.getEntry("META-INF/LICENSE.txt");
   200                 entry = jar.getEntry("META-INF/LICENSE.txt");
   184             if (entry != null)
   201             }
   185             {
   202             if (entry != null) {
   186               /**/
   203                 /**/
   187                 log("File in " + name + " in jar file ", Project.MSG_DEBUG);
   204                 log("File in " + name + " in jar file ", Project.MSG_DEBUG);
   188                 byte[] data = new byte[1024];
   205                 byte[] data = new byte[1024];
   189                 jar.getInputStream(entry).read(data);
   206                 jar.getInputStream(entry).read(data);
   190                 for (String line : new String(data).split("\n"))
   207                 for (String line : new String(data).split("\n")) {
   191                 {
   208                     if (line.contains("License") || line.contains("LICENSE ")
   192                     if (line.contains("License") || line.contains("LICENSE ") || line.contains("Copyright"))
   209                         || line.contains("Copyright")) {
   193                     {
       
   194                         log("Replace License information with * " + line.replace("*", "").trim(), Project.MSG_INFO);
   210                         log("Replace License information with * " + line.replace("*", "").trim(), Project.MSG_INFO);
   195                         break;
   211                         break;
   196                     }
   212                     }
   197                 }
   213                 }
   198             }
   214             }
   199             else
   215             else {
   200             {   
   216                 // http://mirrors.ibiblio.org/pub/mirrors/maven2/
   201                 //http://mirrors.ibiblio.org/pub/mirrors/maven2/
       
   202                 String mavenUrl = "http://repo2.maven.org/maven2/";
   217                 String mavenUrl = "http://repo2.maven.org/maven2/";
   203                 Enumeration jarfiles = jar.entries();
   218                 Enumeration jarfiles = jar.entries();
   204                 boolean found = false;
   219                 boolean found = false;
   205                 while (!found && jarfiles.hasMoreElements()) {
   220                 while (!found && jarfiles.hasMoreElements()) {
   206                     ZipEntry file = (ZipEntry) jarfiles.nextElement();
   221                     ZipEntry file = (ZipEntry) jarfiles.nextElement();
   207                     if (file.isDirectory())
   222                     if (file.isDirectory()) {
   208                     {   
       
   209                         String filename = file.getName();
   223                         String filename = file.getName();
   210                         String[] split = file.getName().split("/");
   224                         String[] split = file.getName().split("/");
   211                         String end = split[split.length - 1];
   225                         String end = split[split.length - 1];
   212                         String specialfilename = filename + end;
   226                         String specialfilename = filename + end;
   213                         
   227 
   214                         URL url = new URL(mavenUrl + filename + end + "/maven-metadata.xml");
   228                         URL url = new URL(mavenUrl + filename + end + "/maven-metadata.xml");
   215                         if (!end.equals("apache"))
   229                         if (!end.equals("apache")) {
   216                         {
       
   217                             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
   230                             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
   218                             if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
   231                             if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
   219                             {
       
   220                                 filename = filename.replace(end, name.replace(".jar", ""));
   232                                 filename = filename.replace(end, name.replace(".jar", ""));
   221                                 end = name.replace(".jar", "");
   233                                 end = name.replace(".jar", "");
   222                                 specialfilename = filename;
   234                                 specialfilename = filename;
   223                                 url = new URL(mavenUrl + filename + "maven-metadata.xml");
   235                                 url = new URL(mavenUrl + filename + "maven-metadata.xml");
   224                                 connection = (HttpURLConnection) url.openConnection();
   236                                 connection = (HttpURLConnection) url.openConnection();
   225                             }
   237                             }
   226                             if (connection.getResponseCode() == HttpURLConnection.HTTP_OK)
   238                             if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
   227                             {   
   239 
   228                                 
       
   229                                 SAXReader xmlReader = new SAXReader();
   240                                 SAXReader xmlReader = new SAXReader();
   230                                 Document antDoc = xmlReader.read(url.openStream());
   241                                 Document antDoc = xmlReader.read(url.openStream());
   231                                 List versions = antDoc.selectNodes("//versioning/versions/version");
   242                                 List versions = antDoc.selectNodes("//versioning/versions/version");
   232                                 //if (version.equals(""))
   243                                 // if (version.equals(""))
   233                                 //{
   244                                 // {
   234                                 //    version = antDoc.valueOf("/metadata/version");
   245                                 // version = antDoc.valueOf("/metadata/version");
   235                                 //}
   246                                 // }
   236                                 Collections.reverse(versions);
   247                                 Collections.reverse(versions);
   237                                 for (Object tmpversion : versions)
   248                                 for (Object tmpversion : versions) {
   238                                 {
   249                                     String version = ((Element) tmpversion).getText();
   239                                     String version = ((Element)tmpversion).getText();
   250                                     URL url2 = new URL(mavenUrl + specialfilename + "/" + version
   240                                     URL url2 = new URL(mavenUrl + specialfilename + "/" + version + "/" + end + "-" + version + ".pom");
   251                                         + "/" + end + "-" + version + ".pom");
   241                                     HttpURLConnection connection2 = (HttpURLConnection) url2.openConnection();
   252                                     HttpURLConnection connection2 = (HttpURLConnection) url2.openConnection();
   242                                     if (connection2.getResponseCode() == HttpURLConnection.HTTP_OK)
   253                                     if (connection2.getResponseCode() == HttpURLConnection.HTTP_OK) {
   243                                     {
       
   244                                         BufferedReader din = new BufferedReader(new InputStreamReader(url2.openStream()));
   254                                         BufferedReader din = new BufferedReader(new InputStreamReader(url2.openStream()));
   245                                         StringBuffer sb = new StringBuffer();
   255                                         StringBuffer sb = new StringBuffer();
   246                                         String line = null;
   256                                         String line = null;
   247                                         while ((line = din.readLine()) != null) {
   257                                         while ((line = din.readLine()) != null) {
   248                                             line = line.replace("xmlns=\"http://maven.apache.org/POM/4.0.0\"", "");
   258                                             line = line.replace("xmlns=\"http://maven.apache.org/POM/4.0.0\"", "");
   250                                         }
   260                                         }
   251                                         xmlReader = new SAXReader();
   261                                         xmlReader = new SAXReader();
   252                                         //
   262                                         //
   253                                         Document antDoc2 = xmlReader.read(new ByteArrayInputStream(new String(sb).getBytes()));
   263                                         Document antDoc2 = xmlReader.read(new ByteArrayInputStream(new String(sb).getBytes()));
   254                                         String license = antDoc2.valueOf("/project/licenses/license/name");
   264                                         String license = antDoc2.valueOf("/project/licenses/license/name");
   255                                         if (!license.equals(""))
   265                                         if (!license.equals("")) {
   256                                         {
       
   257                                             found = true;
   266                                             found = true;
   258                                             break;
   267                                             break;
   259                                         }
   268                                         }
   260                                             
   269 
   261                                     }
   270                                     }
   262                                 }
   271                                 }
   263                             }
   272                             }
   264                         }
   273                         }
   265                     }   
   274                     }
   266                     
   275 
   267                 }
   276                 }
   268                 if (!found)
   277                 if (!found) {
   269                     log(name + " not found in " + jar, Project.MSG_INFO);
   278                     log(name + " not found in " + jar, Project.MSG_INFO);
   270             }
   279                 }
   271         } catch (IOException e) {
   280             }
   272             // We are Ignoring the errors as no need to fail the build.
   281         }
   273             e.printStackTrace(); 
   282         catch (IOException e) {
   274         } catch (DocumentException e) {
   283             // We are Ignoring the errors as no need to fail the build.
   275             // We are Ignoring the errors as no need to fail the build.
   284             e.printStackTrace();
   276             e.printStackTrace(); 
   285         }
   277         }
   286         catch (DocumentException e) {
   278     }
   287             // We are Ignoring the errors as no need to fail the build.
   279     
   288             e.printStackTrace();
       
   289         }
       
   290     }
       
   291 
   280     public boolean digitInString(String s) {
   292     public boolean digitInString(String s) {
   281         int j = s.length() - 1;
   293         int j = s.length() - 1;
   282         while (j >= 0 && Character.isDigit(s.charAt(j))) {
   294         while (j >= 0 && Character.isDigit(s.charAt(j))) {
   283             return true;
   295             return true;
   284         }
   296         }
   285         return false;
   297         return false;
   286     }
   298     }
   287 
   299 
   288     
   300     public String convertJarName(String jar) {
   289     public String convertJarName(String jar)
       
   290     {
       
   291         return new File(jar).getName().replace(".jar", "").replace("-", "_").replace(".", "_");
   301         return new File(jar).getName().replace(".jar", "").replace("-", "_").replace(".", "_");
   292     }
   302     }
   293     
   303 
   294     public final void execute()
   304     public final void execute() {
   295     {
       
   296         try {
   305         try {
   297             Project project = getProject();
   306             Project project = getProject();
   298             
   307 
   299             Hashtable taskdefs = project.getTaskDefinitions();
   308             Hashtable taskdefs = project.getTaskDefinitions();
   300             
   309 
   301             HashSet<String> classlist = new HashSet<String>();
   310             HashSet<String> classlist = new HashSet<String>();
   302             
   311 
   303             Enumeration taskdefsenum = taskdefs.keys();
   312             Enumeration taskdefsenum = taskdefs.keys();
   304             while (taskdefsenum.hasMoreElements()) {
   313             while (taskdefsenum.hasMoreElements()) {
   305                 String key = (String) taskdefsenum.nextElement();
   314                 String key = (String) taskdefsenum.nextElement();
   306                 Class value = (Class) taskdefs.get(key);
   315                 Class value = (Class) taskdefs.get(key);
   307                 if (!key.contains("nokia") && !value.toString().contains("org.apache.tools.ant"))
   316                 if (!key.contains("nokia") && !value.toString().contains("org.apache.tools.ant")) {
   308                 {
       
   309                     String name = value.getPackage().getName();
   317                     String name = value.getPackage().getName();
   310                     String vendor = value.getPackage().getImplementationVendor();
   318                     String vendor = value.getPackage().getImplementationVendor();
   311                     
   319 
   312                     name = classToJar(value);
   320                     name = classToJar(value);
   313                     
   321 
   314                     if (name != null)
   322                     if (name != null) {
   315                     {
       
   316                         name = convertJarName(name);
   323                         name = convertJarName(name);
   317                       
   324 
   318                         classlist.add("helium_ant -> \"" + name + "\";");
   325                         classlist.add("helium_ant -> \"" + name + "\";");
   319                         
   326 
   320                         if (vendor == null)
   327                         if (vendor == null) {
   321                             vendor = "";
   328                             vendor = "";
   322                         
   329                         }
   323                         classlist.add(name + " [style=filled,shape=record,label=\"" + name + "|" + vendor + "\"];");
   330 
   324                     }
   331                         classlist.add(name + " [style=filled,shape=record,label=\"" + name + "|"
   325                 }
   332                             + vendor + "\"];");
   326             }
   333                     }
   327             
   334                 }
       
   335             }
       
   336 
   328             classlist.add("helium_ant -> nokia_ant;");
   337             classlist.add("helium_ant -> nokia_ant;");
   329             
   338 
   330             classlist.addAll(getJarInfo());
   339             classlist.addAll(getJarInfo());
   331         
   340 
   332             Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF8"));
   341             Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF8"));
   333             
   342 
   334             for (String value : classlist)
   343             for (String value : classlist) {
   335                 output.write(value + "\n");
   344                 output.write(value + "\n");
   336             
   345             }
       
   346 
   337             output.close();
   347             output.close();
   338         } catch (FileNotFoundException e) {
   348         }
   339             // We are Ignoring the errors as no need to fail the build.
   349         catch (FileNotFoundException e) {
   340             log("FileNotFoundException occured while getting the ANT task dependency information. " + e.getMessage(), Project.MSG_DEBUG);
   350             // We are Ignoring the errors as no need to fail the build.
   341         } catch (UnsupportedEncodingException e) {
   351             log("FileNotFoundException occured while getting the ANT task dependency information. "
   342             // We are Ignoring the errors as no need to fail the build.
   352                 + e.getMessage(), Project.MSG_DEBUG);
   343             log("UnsupportedEncodingException occured while getting the ANT task dependency information. " + e.getMessage(), Project.MSG_DEBUG);
   353         }
   344         } catch (IOException e) {
   354         catch (UnsupportedEncodingException e) {
   345             // We are Ignoring the errors as no need to fail the build.
   355             // We are Ignoring the errors as no need to fail the build.
   346             log("IOException occured while getting the ANT task dependency information. " + e.getMessage(), Project.MSG_DEBUG);
   356             log("UnsupportedEncodingException occured while getting the ANT task dependency information. "
       
   357                 + e.getMessage(), Project.MSG_DEBUG);
       
   358         }
       
   359         catch (IOException e) {
       
   360             // We are Ignoring the errors as no need to fail the build.
       
   361             log("IOException occured while getting the ANT task dependency information. "
       
   362                 + e.getMessage(), Project.MSG_DEBUG);
   347         }
   363         }
   348     }
   364     }
   349 
   365 
   350 }
   366 }