1 28 29 30 package org.objectweb.ecm.taskdefs; 31 32 35 public class ORBacusIDLtoJavaTask 36 extends IDLtoJavaTask 37 { 38 40 public 42 ORBacusIDLtoJavaTask() 43 { 44 } 46 47 51 final protected void 52 compileIDL(java.io.File idlfile, java.io.File compileto, 53 java.io.File [] includedirs, String prefix) 54 { 55 org.apache.tools.ant.taskdefs.ExecTask cmd = null; 57 cmd = (org.apache.tools.ant.taskdefs.ExecTask)getProject().createTask("exec"); 58 59 OSHelper.pathConvert(getProject(), "os.ORBacus.bin.dir", "ORBacus.bin.dir"); 61 62 String cmdname = "jidl"; 63 if (OSHelper.isUnix()) { 64 cmdname = getProject().getProperty("os.ORBacus.bin.dir")+"/jidl"; 65 } 66 else if (OSHelper.isWindows()) { 67 cmdname = getProject().getProperty("os.ORBacus.bin.dir")+"\\jidl"; 68 } 69 70 cmd.setExecutable(cmdname); 71 72 OSHelper.pathConvert(getProject(), "os.ORBacus.lib.dir", "ORBacus.lib.dir"); 74 String slibpath = getProject().getProperty("os.ORBacus.lib.dir")+ 75 java.io.File.pathSeparator+ 76 OSHelper.envVar("LD_LIBRARY_PATH"); 77 78 org.apache.tools.ant.types.Environment.Variable libpath_env = new org.apache.tools.ant.types.Environment.Variable(); 80 libpath_env.setKey("LD_LIBRARY_PATH"); 81 org.apache.tools.ant.types.Path libpath = new org.apache.tools.ant.types.Path(getProject()); 82 libpath.setPath(slibpath); 83 libpath_env.setPath(libpath); 84 cmd.addEnv(libpath_env); 85 86 OSHelper.pathConvert(getProject(), "os.ORBacus.idl.dir", "ORBacus.idl.dir"); 89 String argline = "-D__ORBACUS__"+ 90 " -I"+getProject().getProperty("os.ORBacus.idl.dir"); 91 for (int i=0;i<includedirs.length;i++) { 93 argline = argline+" -I"+includedirs[i].getPath(); 94 } 95 96 String ppline = " --prefix-package omg.org org.omg "+ 98 " --prefix-package coach.org org.coach "+ 99 " --prefix-package objectweb.org org.objectweb "; 100 101 org.apache.tools.ant.types.Commandline.Argument arg = cmd.createArg(); 103 argline = argline+ppline+" --tie --output-dir "+compileto.getPath()+" "+idlfile.getPath(); 104 arg.setLine(argline); 106 107 cmd.execute(); 109 } 110 } 111 | Popular Tags |