int result = this.preprocessor.preprocess( file.getFileName(), sourceCode );
String className = file.getFileName(); if (className.endsWith(".java")) { className = className.substring(0, className.length() - 5 ); className = TextUtil.replace(className, '/', '.' ); } int result = this.preprocessor.preprocess( className, sourceCode );
	private void preprocess( Device device ) {		System.out.println("now preprocessing for device [" +  device.getIdentifier() + "]." );		try {			String targetDir = this.buildSetting.getWorkDir().getAbsolutePath() 				+ File.separatorChar + device.getVendor() 				+ File.separatorChar + device.getName();			device.setBaseDir( targetDir );			targetDir += File.separatorChar + "source";			device.setSourceDir(targetDir);			this.preprocessor.setTargetDir( targetDir );			this.preprocessor.setSymbols( device.getFeatures() );			this.preprocessor.setVariables( device.getCapabilities() );			// get the last modfication time of the build.xml file			// so that it can be checked whether there are any changes at all:			File buildXml = new File( this.project.getBaseDir().getAbsolutePath() 						+ File.separatorChar + "build.xml" );			long buildXmlLastModified = buildXml.lastModified();			// check if the polish gui is used at all:			boolean usePolishGui = this.buildSetting.usesPolishGui()								  && device.supportsPolishGui();			for (int i = 0; i < this.sourceDirs.length; i++) {				File sourceDir = this.sourceDirs[i];				this.preprocessor.addVariable( "polish.source", sourceDir.getAbsolutePath() );				TextFile[] files = this.sourceFiles[i];				//System.out.println("current source dir: " + sourceDir );								for (int j = 0; j < files.length; j++) {					TextFile file = files[j];					// check if file needs to be preprocessed at all:					long sourceLastModified = file.lastModified();					File targetFile = new File( targetDir							+ File.separatorChar + file.getFileName() );					long targetLastModified = targetFile.lastModified();					// preprocess this file, but only when there can					// be changes at all - this could be when					// 1. The preprocessed file does not yet exists					// 2. The source file has been modified since the last run					// 3, The build.xml has been modified since the last run					boolean saveInAnyCase =  ( !targetFile.exists() )							 || ( sourceLastModified > targetLastModified );					/*					if (( sourceLastModified > targetLastModified )) {						System.out.println("File has been modified: " + file.getFileName() 								+ "\n last mod of source: " + sourceLastModified + " last mod of target: " + targetLastModified );					}					if (( buildXmlLastModified > targetLastModified ) ) {						System.out.println("build.xml has been modified: " + file.getFileName() 								+ "\n last mod of target: " + targetLastModified + " last mod of build.xml: " + buildXmlLastModified );					}					*/					if (   ( saveInAnyCase )						|| ( buildXmlLastModified > targetLastModified ) )					{						// preprocess this file:						StringList sourceCode = new StringList( file.getContent() );						int result = this.preprocessor.preprocess( file.getFileName(), sourceCode );						if (result != Preprocessor.SKIP_FILE) {							if (usePolishGui) {								// now replace the import statements:							}							// save modified file:							if ( ( saveInAnyCase ) 							  || (result == Preprocessor.CHANGED) ) 							{								file.saveToDir(targetDir, sourceCode.getArray(), false );							//} else {							//	System.out.println("not saving " + file.getFileName() );							}						} else {							System.out.println("Skipping file " + file.getFileName() );						}					} // when preprocessing should be done.				} // for each file			} // for each source folder		} catch (FileNotFoundException e) {			e.printStackTrace();			throw new BuildException( e.getMessage() );		} catch (IOException e) {			e.printStackTrace();			throw new BuildException( e.getMessage() );		} catch (PreprocessException e) {			e.printStackTrace();			throw new BuildException( e.getMessage() );		}	}