[Swift-commit] r3160 - trunk/src/org/griphyn/vdl/karajan

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Oct 14 00:15:13 CDT 2009


Author: hategan
Date: 2009-10-14 00:15:06 -0500 (Wed, 14 Oct 2009)
New Revision: 3160

Modified:
   trunk/src/org/griphyn/vdl/karajan/Loader.java
Log:
added -recompile flag to force recompilation; while I thought we had this figured out, Dr. Tan has demonstrated otherwise today

Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/Loader.java	2009-10-14 05:03:06 UTC (rev 3159)
+++ trunk/src/org/griphyn/vdl/karajan/Loader.java	2009-10-14 05:15:06 UTC (rev 3160)
@@ -63,6 +63,7 @@
     public static final String ARG_LOGFILE = "logfile";
     public static final String ARG_RUNID = "runid";
     public static final String ARG_TUI = "tui";
+    public static final String ARG_RECOMPILE = "recompile";
 
     public static final String CONST_VDL_OPERATION = "vdl:operation";
     public static final String VDL_OPERATION_RUN = "run";
@@ -126,7 +127,7 @@
 
             if (project.endsWith(".swift")) {
                 try {
-                    project = compile(project);
+                    project = compile(project, ap.isPresent(ARG_RECOMPILE));
                 }
                 catch (ParsingException pe) {
                     // the compiler should have already logged useful
@@ -203,10 +204,16 @@
     private static void shortUsage() {
         System.err.print("For usage information:  swift -help\n\n");
     }
-
+    
     public static String compile(String project) throws FileNotFoundException,
             ParsingException, IncorrectInvocationException,
             CompilationException, IOException {
+        return compile(project, false);
+    }
+
+    public static String compile(String project, boolean forceRecompile) throws FileNotFoundException,
+            ParsingException, IncorrectInvocationException,
+            CompilationException, IOException {
         File swiftscript = new File(project);
         String projectBase = project.substring(0, project.lastIndexOf('.'));
         File xml = new File(projectBase + ".xml");
@@ -214,7 +221,7 @@
 
         loadBuildVersion();
 
-        boolean recompile = false;
+        boolean recompile = forceRecompile;
 
         if (swiftscript.lastModified() > kml.lastModified()) {
             logger.info(project + ": source file is new. Recompiling.");
@@ -342,6 +349,10 @@
         ap.addFlag(ARG_HELP, "Display usage information");
         ap.addAlias(ARG_HELP, "h");
 
+        ap.addFlag(ARG_RECOMPILE, 
+            "Forces Swift to re-compile the invoked Swift script. " +
+            "While Swift is meant to detect when recompilation is necessary, " +
+            "in some special cases it fails to do so. This flag helps with those special cases.");
         ap.addFlag(ARG_TYPECHECK,
             "Does a typecheck instead of executing the SwiftScript program");
 




More information about the Swift-commit mailing list