You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by gl...@locus.apache.org on 2000/11/09 15:45:45 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ide VAJImport.java

glennm      00/11/09 06:45:44

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ide
                        VAJImport.java
  Log:
  Patch to correctly import .java and resources files, and
  to add more verbose logging messages.
  
  Submitted by:             Wolf Siberski
  
  Revision  Changes    Path
  1.2       +21 -3     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java
  
  Index: VAJImport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VAJImport.java	2000/11/07 20:19:49	1.1
  +++ VAJImport.java	2000/11/09 14:45:44	1.2
  @@ -249,6 +249,7 @@
   			classes.copyInto(classesArr);
   			importSpec.setClassFiles(classesArr);
   			if (classesArr.length > 0) {
  +				logFiles(classes, "class");
   				msg.append( classesArr.length );
   				msg.append( " class " );
   				msg.append( classesArr.length > 1 ? "files" : "file" );
  @@ -261,6 +262,7 @@
   			sources.copyInto(sourcesArr);
   			importSpec.setJavaFiles(sourcesArr);
   			if (sourcesArr.length > 0) {
  +				logFiles(sources, "source");
   				msg.append( connector );
   				msg.append( sourcesArr.length );
   				msg.append( " source " );
  @@ -270,11 +272,14 @@
   		}
   
   		if (importResources) {
  +			String resourcePath = fileset.getDir(this.project).getAbsolutePath();
   			resourcesArr = new String[resources.size()];
   			resources.copyInto(resourcesArr);
  -			importSpec.setResourcePath(fileset.getDir(this.project).getAbsolutePath());
  +			importSpec.setResourcePath(resourcePath);
   			importSpec.setResourceFiles(resourcesArr);
   			if (resourcesArr.length > 0) {
  +				logFiles(resources, "resource");
  +				log( "  (relative to resource path '" + resourcePath + "')", org.apache.tools.ant.Project.MSG_VERBOSE );
   				msg.append( connector );
   				msg.append( resourcesArr.length );
   				msg.append( " resource " );
  @@ -309,14 +314,27 @@
   		Vector resources) {
   		for (int i = 0; i < files.length; i++) {
   			String file = (new File(dir, files[i])).getAbsolutePath();
  -			if (file.endsWith(".source") || file.endsWith(".SOURCE")) {
  +			if (file.endsWith(".java") || file.endsWith(".JAVA")) {
   				sources.addElement(file);
   			} else
   				if (file.endsWith(".class") || file.endsWith(".CLASS")) {
   					classes.addElement(file);
   				} else {
  -					resources.addElement(file);
  +					// for resources VA expects the path relative to the resource path
  +					resources.addElement(files[i]);
   				}
   		}
   	}
  +		
  +	/**
  +	 * Logs a list of file names to the message log
  +	 * @param fileNames java.util.Vector file names to be logged
  +	 * @param type java.lang.String file type
  +	 */
  +	protected void logFiles(Vector fileNames, String fileType) {
  +		log(  fileType + " files found for import:", org.apache.tools.ant.Project.MSG_VERBOSE);
  +		for ( Enumeration e = fileNames.elements(); e.hasMoreElements(); ) {
  +			log( "    " + e.nextElement(), org.apache.tools.ant.Project.MSG_VERBOSE );
  +		}
  +	} 
   }