projects
/
wix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d130478
)
add -f option
author
Adam Megacz
<adam@megacz.com>
Mon, 24 Jan 2011 00:15:43 +0000
(16:15 -0800)
committer
Adam Megacz
<adam@megacz.com>
Mon, 24 Jan 2011 00:15:43 +0000
(16:15 -0800)
Makefile
patch
|
blob
|
history
src/ScalaHelper.java
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index
a1373e3
..
cbf8c61
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-18,17
+18,19
@@
java = java $(jvmargs) $(profile) -cp src:$(ghclibs):$(sbp)/edu.berkeley.sbp.ja
scala = JAVA_OPTS="$(jvmargs)" scala
wix = $(java) HaskellHelper
scala = JAVA_OPTS="$(jvmargs)" scala
wix = $(java) HaskellHelper
+args =
install: wix.jar
aklog research.cs.berkeley.edu || true
install: wix.jar
aklog research.cs.berkeley.edu || true
- $(scala) -cp wix.jar:lib/edu.berkeley.sbp.jar Main ~/docs/wix/src/ ~/docs/wix/dest/
-
+ $(scala) -cp wix.jar:lib/edu.berkeley.sbp.jar Main $(args) ~/docs/wix/src/ ~/docs/wix/dest/
# --delete disabled until I can keep it from clobbering GArrow.v
rsync -arL --rsync-path=/usr/sww/bin/rsync \
--progress --verbose \
~/docs/wix/dest/cs.berkeley.edu/ \
login.eecs.berkeley.edu:public_html/
# --delete disabled until I can keep it from clobbering GArrow.v
rsync -arL --rsync-path=/usr/sww/bin/rsync \
--progress --verbose \
~/docs/wix/dest/cs.berkeley.edu/ \
login.eecs.berkeley.edu:public_html/
+force:; make install args='-f'
+
docs:
$(wix) xt2/docs/ ~/docs/
docs:
$(wix) xt2/docs/ ~/docs/
diff --git
a/src/ScalaHelper.java
b/src/ScalaHelper.java
index
85065e2
..
520a979
100644
(file)
--- a/
src/ScalaHelper.java
+++ b/
src/ScalaHelper.java
@@
-48,20
+48,27
@@
public class ScalaHelper {
}
public static void main(String[] argv, TreeToString t2s) throws Throwable {
}
public static void main(String[] argv, TreeToString t2s) throws Throwable {
- if (argv.length != 2) {
- System.out.println("usage: java -jar wix.jar [-v] <indir> <outdir>");
+ if (argv.length == 0) {
+ System.out.println("usage: java -jar wix.jar [-v] [-f] <indir> <outdir>");
// FIXME: implement this
// FIXME: implement this
- System.out.println(" | java -jar wix.jar [-v] <infile>.wix");
+ System.out.println(" | java -jar wix.jar [-v] [-f] <infile>.wix");
System.out.println("");
// FIXME: implement these
System.out.println(" -v print text as it is parsed (sbp.verbose=true)");
System.out.println(" -vv like -v, but also dump parse tree");
System.out.println(" -vvv like -vv, but also dump wix tree");
System.out.println("");
// FIXME: implement these
System.out.println(" -v print text as it is parsed (sbp.verbose=true)");
System.out.println(" -vv like -v, but also dump parse tree");
System.out.println(" -vvv like -vv, but also dump wix tree");
+ System.out.println(" -f recompile documents regardless of last-modified-time");
System.exit(-1);
return;
}
System.exit(-1);
return;
}
- File indir = new File(argv[0]);
- File outdir = new File(argv[1]);
+ int i = 0;
+ for(;; i++) {
+ if (argv[i].equals("-v")) { verbose = true; continue; }
+ if (argv[i].equals("-f")) { force = true; continue; }
+ break;
+ }
+ File indir = new File(argv[i]);
+ File outdir = new File(argv[i+1]);
if (!indir.isDirectory()) {
process(new File(indir.getParent()), indir.getName(), outdir, t2s);
} else {
if (!indir.isDirectory()) {
process(new File(indir.getParent()), indir.getName(), outdir, t2s);
} else {
@@
-69,6
+76,9
@@
public class ScalaHelper {
}
}
}
}
+ private static boolean verbose = false;
+ private static boolean force = false;
+
private static void process(File indir, String suffix, File outdir, TreeToString t2s) throws Throwable {
File f = new File(indir.getAbsolutePath()+File.separatorChar+suffix);
//System.out.println(f+" "+indir + " " + suffix + " " + outdir);
private static void process(File indir, String suffix, File outdir, TreeToString t2s) throws Throwable {
File f = new File(indir.getAbsolutePath()+File.separatorChar+suffix);
//System.out.println(f+" "+indir + " " + suffix + " " + outdir);
@@
-112,7
+122,7
@@
public class ScalaHelper {
//System.out.println();
String outPath = outdir.getAbsolutePath()+File.separatorChar+suffix;
outPath = outPath.substring(0, outPath.length()-".wix".length())+".html";
//System.out.println();
String outPath = outdir.getAbsolutePath()+File.separatorChar+suffix;
outPath = outPath.substring(0, outPath.length()-".wix".length())+".html";
- if (new File(outPath).exists() && new File(outPath).lastModified() > f.lastModified()) return;
+ if (new File(outPath).exists() && new File(outPath).lastModified() > f.lastModified() && !force) return;
Tree tree = parseFile(f.getAbsolutePath());
String ret = t2s.run(tree);
Tree tree = parseFile(f.getAbsolutePath());
String ret = t2s.run(tree);