-
- public String getClassPath() {
- String classpath = System.getProperty("java.class.path");
- String [] l = new File(Root.root + "/LIB/").list();
- for(int i=0; l != null && i<l.length; i++) {
- if (!l[i].endsWith(".jar")) continue;
- classpath += File.pathSeparatorChar;
- classpath += Root.root + "/LIB/" + l[i];
- }
- l = new File(this.path + File.separatorChar + "LIB").list();
- for(int i=0; l!=null && i<l.length; i++) {
- if (!l[i].endsWith(".jar")) continue;
- classpath += File.pathSeparatorChar;
- classpath += this.path + "/LIB/" + l[i];
- }
- return classpath + File.pathSeparatorChar + this.path + "/BIN";
- }
-
- private void compileSource() throws Exception {
- File srcdir = new File(this.path + File.separatorChar + "SRC");
- if (!srcdir.exists()) return;
- /*
- if (new File("/usr/bin/jikes").exists()) {
- File bindir = new File(this.path + File.separatorChar + "BIN"); bindir.mkdirs();
- String bootclasspath = System.getProperty("sun.boot.class.path", "");
- Vec args = new Vec();
- args.addElement("/usr/bin/jikes");
- args.addElement("+E");
- args.addElement("-nowarn");
- args.addElement("-bootclasspath");
- args.addElement(bootclasspath);
- args.addElement("-classpath");
- args.addElement(getClassPath());
- args.addElement("-sourcepath");
- args.addElement(srcdir.getAbsolutePath());
- args.addElement("-d");
- args.addElement(bindir.getAbsolutePath());
- fill(args, srcdir);
- String[] all = new String[args.size()];
- args.copyInto(all);
- Log.info(this, "invoking jikes");
- for(int i=0; i<all.length; i++) Log.info(this, " " + all[i]);
- final Process jikes = Runtime.getRuntime().exec(all);
- final BufferedReader out = new BufferedReader(new InputStreamReader(jikes.getInputStream()));
- final BufferedReader err = new BufferedReader(new InputStreamReader(jikes.getErrorStream()));
- new Thread() { public void run() {
- try { for(String s = out.readLine(); s != null; s = out.readLine()) Log.info("jikes[stdout]", s); }
- catch (Exception e) { Log.warn("jikes", e); } } }.start();
- new Thread() { public void run() {
- try { for(String s = err.readLine(); s != null; s = err.readLine()) Log.info("jikes[stderr]", s); }
- catch (Exception e) { Log.warn("jikes", e); } } }.start();
- jikes.waitFor();
- } else {
- Log.error(this, "ACK! jikes not found, javac not (yet) supported");
- }
- */
-
- File bindir = new File(this.path + File.separatorChar + "BIN"); bindir.mkdirs();
- Vec args = new Vec();
- args.addElement("/usr/bin/javac");
- args.addElement("-nowarn");
- args.addElement("-classpath");
- args.addElement(getClassPath());
- args.addElement("-sourcepath");
- args.addElement(srcdir.getAbsolutePath());
- args.addElement("-d");
- args.addElement(bindir.getAbsolutePath());
- fill(args, srcdir);
- String[] all = new String[args.size()];
- args.copyInto(all);
- Log.info(this, "invoking javac for " + srcdir.getAbsolutePath());
- final Process javac = Runtime.getRuntime().exec(all, new String[] { "PATH=/bin:/usr/bin" });
- final BufferedReader out = new BufferedReader(new InputStreamReader(javac.getInputStream()));
- final BufferedReader err = new BufferedReader(new InputStreamReader(javac.getErrorStream()));
- new Thread() { public void run() {
- try { for(String s = out.readLine(); s != null; s = out.readLine()) Log.info("javac [stdout]", s); }
- catch (Exception e) { Log.warn("javac", e); } } }.start();
- new Thread() { public void run() {
- try { for(String s = err.readLine(); s != null; s = err.readLine()) Log.info("javac [stderr]", s); }
- catch (Exception e) { Log.warn("javac", e); } } }.start();
- javac.waitFor();
-
- }
-
- // only watch SRC and LIB for changes
- public Watched slash(String path) {
- return (path.equals("LIB") ||
- path.equals("BIN") ||
- path.equals("SRC") ||
- path.endsWith(".jar") ) ? super.slash(path) : null; }
-
-