From e88203e4789c6832b18eed8654f5e26907a24145 Mon Sep 17 00:00:00 2001 From: crawshaw Date: Tue, 23 Nov 2004 19:25:38 +0000 Subject: [PATCH] only compile class if source file is newer than binary darcs-hash:20041123192538-2eb37-87ce91478004d8a7f439a4ae122e543a67b04caf.gz --- src/java/org/ibex/tool/Compiler.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/java/org/ibex/tool/Compiler.java b/src/java/org/ibex/tool/Compiler.java index aaf2828..a34a735 100644 --- a/src/java/org/ibex/tool/Compiler.java +++ b/src/java/org/ibex/tool/Compiler.java @@ -147,10 +147,20 @@ public class Compiler { public boolean accept(File path) { return path.isDirectory(); } }; private void filterSources(List s, File dir, char[][] pack) { + // add the java files in this directory + File bdir = new File(builddir, str(pack, File.separatorChar)); File[] ja = dir.listFiles(filterSrcs); - for (int i=0; i < ja.length; i++) - s.add(new Source(ja[i], name(classname(ja[i].getName())), pack)); + for (int i=0; i < ja.length; i++) { + char[] n = name(classname(ja[i].getName())); + // skip the file if the build version is newer than the source + File bfile = new File(bdir, new String(n) + ".class"); + if (bfile.lastModified() > ja[i].lastModified()) continue; + + s.add(new Source(ja[i], n, pack)); + } + + // add the subdirectories as packages File[] d = dir.listFiles(filterDirs); for (int i=0; i < d.length; i++) { char[][] newpack = new char[pack.length + 1][]; -- 1.7.10.4