1 12 package org.eclipse.jdt.apt.core.build; 13 14 import java.io.File ; 15 16 import org.apache.tools.ant.BuildException; 17 import org.apache.tools.ant.taskdefs.Java; 18 import org.apache.tools.ant.types.Path; 19 import org.eclipse.jdt.apt.core.internal.build.Messages; 20 21 35 public class JdtApt extends Java { 36 37 private static final String APP_CLASSNAME = "org.eclipse.core.launcher.Main"; private static final String APP_PLUGIN = "org.eclipse.jdt.apt.core.aptBuild"; 40 private File workspace; 41 private File startupJar; 42 43 public void setWorkspace(File file) { 44 if(!file.exists()) { 45 throw new BuildException(Messages.JdtApt_noWorkspace + file); 46 } 47 workspace = file; 48 } 49 50 public void setEclipseHome(File file) { 51 if(!file.exists()) { 52 throw new BuildException(Messages.JdtApt_noEclipse + file); 53 } 54 startupJar = new File (file, "startup.jar"); if(!startupJar.exists()) { 56 throw new BuildException(Messages.JdtApt_noStartupJar + file); 57 } 58 } 59 60 public void execute() throws BuildException { 61 if(workspace == null) { 62 throw new BuildException("Must set a workspace"); } 64 if(startupJar == null) { 65 throw new BuildException("Must set eclipse home"); } 67 68 setFork(true); 69 setLogError(true); 70 setClasspath(new Path(null, startupJar.getAbsolutePath())); 71 setClassname(APP_CLASSNAME); 72 createArg().setValue("-noupdate"); createArg().setValue("-application"); createArg().setValue(APP_PLUGIN); 75 createArg().setValue("-data"); createArg().setValue(workspace.getAbsolutePath()); 77 super.execute(); 78 } 79 80 81 } 82 | Popular Tags |