Kevin Jackson wrote:
>> (project :name "Ant" :default "echo"
>>   (target :name "echo"
>>     (echo :message "Hello World")))
>>
>> Tasks would be functions or macros.
>
> Anyone interested in a CLISP version of Ant?

You'd be surprised how much less lines of code you'd need when
compared to the Java version, really.

No really I wouldn't!  Java is a *very* verbose language, Lisp is
probably one of the least verbose languages (apart from the ())


I toyed with the idea when I first read Peter Seibel's "Practical
Common Lisp (online here[1], but it's well worth of buying) and even
managed to get something like the above snippet working, actually more
like

(defparameter *project*
  (project :name "Ant" :default "echo"
    (target :name "echo"
      (echo :message "Hello World"))))
(run-targets *project*)


I think a problem would be that CLISP Ant would also have to take
build files in two formats (build.xml & build.sexp) so as to be
partially bwc - of course CLISP can compile to native code and
therefore would (in some cases) be easier to install than Ant + JRE

My collegue julio added ant support to smartfrog a few months back, so we can run any ant task during deployment. What you dont get is rollback and liveness operations. Here's a bit of an an example:


sfConfig extends Ant {
  asynch true;
  echoTask extends echo {
    message "hellow world!";
  }

   echoAntTask extends echo {
message "Ant version '${ant.version}', java version '${ant.java.version}";
   }

  copyTask extends copy {
      todir "tmp";
      filtering "true";
      myFileSet extends fileset {
        dir ".";
        includes "*.xml";
      }
      myFilterSet extends filterset {
         myFiltersFile extends {
           AntElement "filtersfile";
           file "/filters.props";
         }
      }
  }
  echoMedTask extends echo {
    message "--------------------------------";
  }



  copyTask2 extends copy {
      todir "/juliotmp/kk";
      filtering "true";
      verbose "true";
      myFileSet extends fileset {
        dir "/";
        includes "*.txt";
      }


      globMapper extends globmapper {
        from "*";
        to "*.bak";
      }

  }

  copyTask3 extends copy {
      todir "/juliotmp/kk";
      filtering "true";
      verbose "true";
      myFileSet extends fileset {
        dir "/";
        includes "*.txt";
      }

      flattenmapper extends {AntElement "mapper"; type "flatten";}
  }
}

when you run this, the outer Ant runs everything and sets all the final ant properties as attributes of the deployed task, so other smartfrog stuff can work. Apparently getting <condition> to work caused problems, as it is not enough to run every task. Here's the LGPL runner:

private void executeNestedAntTasks() throws RemoteException, SmartFrogException {
        Object attribute = null;
        Object value = null;
        Iterator a = this.sfAttributes();
        try {
for (Iterator i = this.sfValues(); i.hasNext() && !exitAntNow;) {
                attribute = a.next();
                value = i.next();
                if (value instanceof ComponentDescription) {
                    try {
if (((ComponentDescription) value).sfContainsAttribute(ATTR_TASK_NAME)) { Task task = antProject.getTask((String) attribute, (ComponentDescription) value);
                            task.execute();
} else if (((ComponentDescription) value).sfContainsAttribute(ATTR_ANT_ELEMENT)) { Object element = antProject.getElement((String) attribute, (ComponentDescription) value);
                        } else {
//System.out.println("@todo: something with attribute: "+ attribute + " "+value+";");
                        }
                    } catch (Exception ex) {
                        Throwable thr = ex;
if (thr instanceof java.lang.reflect.InvocationTargetException) {
                            thr = ex.getCause();
                        }
throw SmartFrogException.forward("Error executing: " + attribute, thr);
                    }
                }
            }
        } finally {
            //set the static properties after we finish

runtime.setStaticProperties(antProject.getProject().getProperties());
        }

    }

Everything is configured using reflection.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to