[jbpm-commits] JBoss JBPM SVN: r5870 - in projects/bbq/projects: bbq-core/java/org/bbq and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Oct 31 10:32:09 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-10-31 10:32:09 -0400 (Sat, 31 Oct 2009)
New Revision: 5870

Added:
   projects/bbq/projects/bbq-core/java/
   projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java
   projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java
   projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java
   projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java
   projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java
   projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java
   projects/bbq/projects/bbq-core/java/org/bbq/system/Repository.java
   projects/bbq/projects/bbq-test-project/java/
Removed:
   projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java
   projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java
   projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java
   projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java
   projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java
   projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java
   projects/bbq/projects/bbq-core/java/org/bbq/system/Repository.java
   projects/bbq/projects/bbq-core/src/
   projects/bbq/projects/bbq-test-project/src/
Modified:
   projects/bbq/projects/bbq-core/.classpath
   projects/bbq/projects/bbq-test-project/.classpath
Log:
changed src into java

Modified: projects/bbq/projects/bbq-core/.classpath
===================================================================
--- projects/bbq/projects/bbq-core/.classpath	2009-10-31 14:28:11 UTC (rev 5869)
+++ projects/bbq/projects/bbq-core/.classpath	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="java"/>
 	<classpathentry kind="src" output="gen/test-classes" path="test"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="lib/junit-4.4.jar"/>

Copied: projects/bbq/projects/bbq-core/java (from rev 5868, projects/bbq/projects/bbq-core/src)

Deleted: projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/Bbq.java	2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.bbq;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Properties;
-
-import org.bbq.commands.Javac;
-import org.bbq.system.Console;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Bbq {
-  
-  public static final Properties properties = new Properties();
-
-  public static void main(String[] args) {
-    
-    // initialize default properties
-    properties.setProperty("build.src.dir", "build");
-    properties.setProperty("build.classes.dir", "gen/build-classes");
-    properties.setProperty("local.repo.dir", System.getProperty("user.home")+"/.bbq");
-    // optionally bbq.properties files could be read 
-    // from ${user.home}/.bbq/bbq.properties and ./bbq.properties
-    
-    String buildSrcDir = properties.getProperty("build.src.dir");
-    String buildClassesDir = properties.getProperty("build.classes.dir");
-    String buildClasspath = System.getProperty("java.class.path");
-
-    new Javac()
-      .srcDir(buildSrcDir)
-      .destDir(buildClassesDir)
-      .classPath(buildClasspath)
-      .execute();
-
-    try {
-      URL[] urls = {new File(buildClassesDir).toURL()};
-      ClassLoader classLoader = new URLClassLoader(urls , Bbq.class.getClassLoader());
-      Class<?> buildClass = Class.forName("Build", true, classLoader);
-      for (String operation: args) {
-        Method method = buildClass.getDeclaredMethod(operation);
-        Object result = method.invoke(null, (Object[])null);
-        if (result!=null) {
-          Console.log("result of "+operation+": "+result);
-        }
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-}

Copied: projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java (from rev 5869, projects/bbq/projects/bbq-core/src/org/bbq/Bbq.java)
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java	                        (rev 0)
+++ projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.bbq;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+
+import org.bbq.commands.Javac;
+import org.bbq.system.Console;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Bbq {
+  
+  public static final Properties properties = new Properties();
+
+  public static void main(String[] args) {
+    // initialize default properties
+    properties.setProperty("build.src.dir", "build");
+    properties.setProperty("build.classes.dir", "gen/build-classes");
+    properties.setProperty("local.repo.dir", System.getProperty("user.home")+"/.bbq");
+    // optionally bbq.properties files could be read 
+    // from ${user.home}/.bbq/bbq.properties and ./bbq.properties
+    
+    String buildSrcDir = properties.getProperty("build.src.dir");
+    String buildClassesDir = properties.getProperty("build.classes.dir");
+    String buildClassPath = System.getProperty("java.class.path");
+    
+    File buildSrcFile = new File(buildSrcDir);
+    if (!buildSrcFile.exists()) {
+      Console.log("no build source dir: "+buildSrcFile.getAbsolutePath()+" doesn't exist");
+      return;
+    }
+    if (buildSrcFile.isFile()) {
+      Console.log("no build source dir: "+buildSrcFile.getAbsolutePath()+" is a file");
+      return;
+    }
+
+    new Javac()
+      .srcDir(buildSrcDir)
+      .destDir(buildClassesDir)
+      .classPath(buildClassPath)
+      .execute();
+
+    try {
+      URL[] urls = {new File(buildClassesDir).toURL()};
+      ClassLoader classLoader = new URLClassLoader(urls , Bbq.class.getClassLoader());
+      Class<?> buildClass = Class.forName("Build", true, classLoader);
+      for (String operation: args) {
+        Method method = buildClass.getDeclaredMethod(operation);
+        Object result = method.invoke(null, (Object[])null);
+        if (result!=null) {
+          Console.log("result of "+operation+": "+result);
+        }
+      }
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+}

Deleted: projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java	2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.bbq.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.bbq.system.Repository;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ClassPath {
-  
-  List<String> elements = new ArrayList<String>();
-
-  public ClassPath add(Repository repository, String path) {
-    add(repository.getArtifactPath(path));
-    return this;
-  }
-
-  public ClassPath add(String path) {
-    StringTokenizer tokenizer = new StringTokenizer(path, ";");
-    while (tokenizer.hasMoreTokens()) {
-      elements.add(tokenizer.nextToken());
-    }
-    return this;
-  }
-
-  public ClassPath execute() {
-    
-    return this;
-  }
-}

Copied: projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java (from rev 5869, projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java)
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java	                        (rev 0)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.bbq.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.bbq.system.Repository;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ClassPath {
+  
+  List<String> elements = new ArrayList<String>();
+
+  public ClassPath add(Repository repository, String path) {
+    add(repository.getArtifactPath(path));
+    return this;
+  }
+
+  public ClassPath add(String path) {
+    StringTokenizer tokenizer = new StringTokenizer(path, ";");
+    while (tokenizer.hasMoreTokens()) {
+      elements.add(tokenizer.nextToken());
+    }
+    return this;
+  }
+
+  public ClassPath add(ClassPath other) {
+    elements.addAll(other.elements);
+    return this;
+  }
+  
+  public boolean isEmpty() {
+    return elements.isEmpty();
+  }
+
+  public String toString() {
+    return toString(";");
+  }
+  public String toString(String separator) {
+    StringBuilder stringBuilder = new StringBuilder();
+    for (int i=0; i<(elements.size()-1); i++) {
+      stringBuilder.append(elements.get(i));
+      stringBuilder.append(separator);
+    }
+    stringBuilder.append(elements.size()-1);
+    return stringBuilder.toString();
+  }
+}

Deleted: projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/commands/Exec.java	2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.bbq.commands;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.List;
-
-import org.bbq.BbqException;
-import org.bbq.system.Console;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Exec {
-
-  List<String> cmd;
-
-  public Exec(List<String> cmd) {
-    this.cmd = cmd;
-  }
-  
-  public void execute() {
-    try {
-      String msg = "exec";
-      for (String cmdPart: cmd) {
-        msg += " "+cmdPart;
-      }
-      Console.log(msg);
-      
-      ProcessBuilder processBuilder = new ProcessBuilder(cmd);
-      processBuilder.redirectErrorStream();
-      Process process = processBuilder.start();
-      
-      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
-      for (String line = bufferedReader.readLine(); line!=null; line = bufferedReader.readLine()) {
-        Console.log(" |"+line);
-      }
-      
-    } catch (Exception e) {
-      throw new BbqException("couldn't exec "+cmd, e);
-    }
-  }
-}

Copied: projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java (from rev 5869, projects/bbq/projects/bbq-core/src/org/bbq/commands/Exec.java)
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java	                        (rev 0)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.bbq.commands;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.List;
+
+import org.bbq.BbqException;
+import org.bbq.system.Console;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Exec {
+
+  List<String> cmd;
+  String description;
+
+  public Exec(List<String> cmd) {
+    this.cmd = cmd;
+  }
+  
+  public void execute() {
+    try {
+      String msg = description;
+      if (msg==null) {
+        msg = "exec ";
+        for (String cmdPart: cmd) {
+          msg += " "+cmdPart;
+        }
+      }
+      Console.log(msg);
+      
+      ProcessBuilder processBuilder = new ProcessBuilder(cmd);
+      processBuilder.redirectErrorStream();
+      Process process = processBuilder.start();
+      
+      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+      for (String line = bufferedReader.readLine(); line!=null; line = bufferedReader.readLine()) {
+        Console.log("  |"+line);
+      }
+      
+    } catch (Exception e) {
+      throw new BbqException("couldn't exec "+cmd, e);
+    }
+  }
+  
+  public Exec description(String description) {
+    this.description = description;
+    return this;
+  }
+}

Deleted: projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/commands/Javac.java	2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.bbq.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.bbq.system.FileList;
-import org.bbq.system.FileScan;
-import org.bbq.system.Os;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Javac {
-  
-  FileList sourceFiles = new FileList();
-  boolean verbose;
-  String destDir;
-  String classPath;
-  
-  public Javac srcDir(String srcDir) {
-    FileList sourceFiles = new FileScan(srcDir)
-        .filterEnd(".java")
-        .execute();
-    
-    this.sourceFiles.add( sourceFiles );
-    
-    return this;
-  }
-
-  public Javac srcFile(String srcFile) {
-    this.sourceFiles.add( srcFile );
-    
-    return this;
-  }
-  
-  public Javac destDir(String dirPath) {
-    this.destDir = dirPath;
-    return this;
-  }
-  
-  public Javac classPath(String classPath) {
-    this.classPath = classPath;
-    return this;
-  }
-
-  public Javac verbose() {
-    this.verbose = true;
-    return this;
-  }
-
-  public void execute() {
-    // create the destination directory
-    new MkDir(destDir)
-      .execute();
-
-    // build up the compile command
-    List<String> cmd = new ArrayList<String>();
-    cmd.add(Java.JAVA_HOME+Os.FILE_SEPARATOR+"bin"+Os.FILE_SEPARATOR+"javac");
-    cmd.add("-d");
-    cmd.add(destDir);
-    if (classPath!=null) {
-      cmd.add("-classpath");
-      cmd.add(classPath);
-    }
-    if (verbose) {
-      cmd.add("-verbose");
-    }
-    for (String fileName: sourceFiles.list()) {
-      cmd.add(fileName);
-    }
-
-    // execute the compile command
-    new Exec(cmd)
-      .execute();
-  }
-
-  public ClassPath classPath(ClassPath classPath) {
-    return null;
-  }
-}

Copied: projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java (from rev 5869, projects/bbq/projects/bbq-core/src/org/bbq/commands/Javac.java)
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java	                        (rev 0)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.bbq.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.bbq.system.FileList;
+import org.bbq.system.FileScan;
+import org.bbq.system.Os;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Javac {
+  
+  FileList sourceFiles = new FileList();
+  boolean verbose;
+  String destDir = "gen/classes";
+  ClassPath classPath = new ClassPath();
+  
+  public Javac srcDir(String srcDir) {
+    FileList sourceFiles = new FileScan(srcDir)
+        .filterEnd(".java")
+        .execute();
+    
+    this.sourceFiles.add( sourceFiles );
+    
+    return this;
+  }
+
+  public Javac srcFile(String srcFile) {
+    this.sourceFiles.add( srcFile );
+    
+    return this;
+  }
+  
+  public Javac destDir(String dirPath) {
+    this.destDir = dirPath;
+    return this;
+  }
+  
+  public Javac classPath(String classPath) {
+    this.classPath.add(classPath);
+    return this;
+  }
+
+  public Javac classPath(ClassPath classPath) {
+    this.classPath.add(classPath);
+    return this;
+  }
+
+  public Javac verbose() {
+    this.verbose = true;
+    return this;
+  }
+
+  public void execute() {
+    // create the destination directory
+    new MkDir(destDir)
+      .execute();
+
+    // build up the compile command
+    List<String> cmd = new ArrayList<String>();
+    cmd.add(Java.JAVA_HOME+Os.FILE_SEPARATOR+"bin"+Os.FILE_SEPARATOR+"javac");
+    cmd.add("-d");
+    cmd.add(destDir);
+    String description = "javac -d "+destDir;
+    if (!classPath.isEmpty()) {
+      cmd.add("-classpath");
+      cmd.add(classPath.toString());
+      for (String classPathElement: classPath.elements) {
+        description += Os.LINE_SEPARATOR+"  classpath-element: "+classPathElement;
+      }
+    }
+    if (verbose) {
+      cmd.add("-verbose");
+    }
+    for (String fileName: sourceFiles.list()) {
+      cmd.add(fileName);
+      description += Os.LINE_SEPARATOR+"  source-file: "+fileName;
+    }
+
+    // execute the compile command
+    new Exec(cmd)
+      .description(description)
+      .execute();
+  }
+}

Deleted: projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/system/FileScan.java	2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.bbq.system;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * @author Tom Baeyens
- */
-public class FileScan {
-
-  String rootDir;
-  List<ScanFilter> scanFilters = new ArrayList<ScanFilter>();
-  
-  public FileScan(String dirPath) {
-    rootDir = dirPath;
-  }
-  
-  public FileList execute() {
-    FileList fileList = new FileList();
-    scan(rootDir, fileList);
-    return fileList;
-  }
-
-  private void scan(String dir, FileList fileList) {
-    File dirFile = new File(dir);
-    for (File child: dirFile.listFiles()) {
-      String childPath = ("".equals(dir) ? child.getName() : dir+"/"+child.getName());
-      if (child.isDirectory()) {
-        scan(childPath, fileList);
-      } else if (passesFilters(childPath, child)) {
-        fileList.add(childPath);
-      }
-    }
-  }
-  
-  private boolean passesFilters(String relativePath, File file) {
-    for (ScanFilter scanFilter: scanFilters) {
-      if (!scanFilter.passes(relativePath, file)) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  private interface ScanFilter {
-    boolean passes(String relativePath, File file);
-  }
-  
-  private class EndScanFilter implements ScanFilter {
-    String text;
-    public EndScanFilter(String text) {
-      this.text = text;
-    }
-    public boolean passes(String relativePath, File file) {
-      return relativePath.endsWith(text);
-    }
-  }
-
-  public FileScan filterEnd(String text) {
-    scanFilters.add(new EndScanFilter(text));
-    return this;
-  }
-}

Copied: projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java (from rev 5869, projects/bbq/projects/bbq-core/src/org/bbq/system/FileScan.java)
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java	                        (rev 0)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.bbq.system;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class FileScan {
+
+  String rootDir;
+  List<ScanFilter> scanFilters = new ArrayList<ScanFilter>();
+  
+  public FileScan(String dirPath) {
+    rootDir = dirPath;
+  }
+  
+  public FileList execute() {
+    FileList fileList = new FileList();
+    scan(rootDir, fileList);
+    return fileList;
+  }
+
+  private void scan(String dir, FileList fileList) {
+    File dirFile = new File(dir);
+    if (dirFile.exists()) {
+      for (File child: dirFile.listFiles()) {
+        String childPath = ("".equals(dir) ? child.getName() : dir+"/"+child.getName());
+        if (child.isDirectory()) {
+          scan(childPath, fileList);
+        } else if (passesFilters(childPath, child)) {
+          fileList.add(childPath);
+        }
+      }
+    }
+  }
+  
+  private boolean passesFilters(String relativePath, File file) {
+    for (ScanFilter scanFilter: scanFilters) {
+      if (!scanFilter.passes(relativePath, file)) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  private interface ScanFilter {
+    boolean passes(String relativePath, File file);
+  }
+  
+  private class EndScanFilter implements ScanFilter {
+    String text;
+    public EndScanFilter(String text) {
+      this.text = text;
+    }
+    public boolean passes(String relativePath, File file) {
+      return relativePath.endsWith(text);
+    }
+  }
+
+  public FileScan filterEnd(String text) {
+    scanFilters.add(new EndScanFilter(text));
+    return this;
+  }
+}

Deleted: projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/system/Os.java	2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.bbq.system;
-
-import org.bbq.BbqException;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Os {
-
-  public static final String WINDOWS = "windows";
-
-  public static final String TYPE = getType();
-  public static final String FILE_SEPARATOR = System.getProperty("file.separator");
-
-  private static String getType() {
-    String name = System.getProperty("os.name");
-    if (name.indexOf("Windows")!=-1) {
-      return WINDOWS;
-    }
-    throw new BbqException("unknown os: "+name);
-  }
-}

Copied: projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java (from rev 5869, projects/bbq/projects/bbq-core/src/org/bbq/system/Os.java)
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java	                        (rev 0)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.bbq.system;
+
+import org.bbq.BbqException;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Os {
+
+  public static final String WINDOWS = "windows";
+
+  public static final String TYPE = getType();
+  public static final String FILE_SEPARATOR = System.getProperty("file.separator");
+  public static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+  private static String getType() {
+    String name = System.getProperty("os.name");
+    if (name.indexOf("Windows")!=-1) {
+      return WINDOWS;
+    }
+    throw new BbqException("unknown os: "+name);
+  }
+}

Deleted: projects/bbq/projects/bbq-core/java/org/bbq/system/Repository.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java	2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/Repository.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.bbq.system;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-
-import org.bbq.Bbq;
-import org.bbq.BbqException;
-
-
-/**
- * @author Tom Baeyens
- */
-public class Repository {
-
-  String remoteUrl;
-  String localRepositoryPath;
-
-  public Repository(String remoteUrl, String name) {
-    this.remoteUrl = remoteUrl;
-    this.localRepositoryPath = Bbq.properties.getProperty("local.repo.dir")+"/"+name;
-  }
-  
-  public String getArtifactPath(String path) {
-    String absoluteArtifactPath = localRepositoryPath+"/"+path;
-    
-    File artifactFile = new File(absoluteArtifactPath);
-    if (!artifactFile.exists()) {
-      Console.print("downloading repo artifact "+path);
-
-      // first make sure the directory exists
-      int index = absoluteArtifactPath.lastIndexOf('/');
-      String artifactDirPath = absoluteArtifactPath.substring(0, index);
-      File artifactDir = new File(artifactDirPath);
-      artifactDir.mkdirs();
-      
-      // download the artifact
-      try {
-        FileOutputStream fileStream = new FileOutputStream(artifactFile);
-        URL artifactUrl = new URL(remoteUrl+"/"+path);
-        pump(artifactUrl, fileStream);
-      } catch (Exception e) {
-        throw new BbqException("couldn't fetch repo artifact "+path);
-      }
-    }
-    
-    return absoluteArtifactPath;
-  }
-
-  protected void pump(URL artifactUrl, OutputStream out) throws Exception {
-    int bufferSize = 1024*10; // 10K
-    int total = 0;
-    byte[] buffer = new byte[bufferSize];
-    InputStream in = null;
-    try {
-      in = artifactUrl.openStream();
-      int bytesRead = in.read( buffer );
-      while ( bytesRead != -1 ) {
-        Console.print(".");
-        out.write( buffer, 0, bytesRead );
-        total += bytesRead;
-        bytesRead = in.read( buffer );
-      }
-    } finally {
-      Console.log("done");
-      if (in!=null) {
-        try {
-          in.close();
-        } catch (IOException e) {
-          e.printStackTrace();
-        }
-      }
-    }
-  }
-}

Copied: projects/bbq/projects/bbq-core/java/org/bbq/system/Repository.java (from rev 5869, projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java)
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/system/Repository.java	                        (rev 0)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/Repository.java	2009-10-31 14:32:09 UTC (rev 5870)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.bbq.system;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+import org.bbq.Bbq;
+import org.bbq.BbqException;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Repository {
+
+  String name;
+  String remoteUrl;
+  String localRepositoryPath;
+
+  public Repository(String name, String remoteUrl) {
+    this.name = name;
+    this.remoteUrl = remoteUrl;
+    this.localRepositoryPath = Bbq.properties.getProperty("local.repo.dir")+"/"+name;
+  }
+  
+  public String getArtifactPath(String path) {
+    String absoluteArtifactPath = localRepositoryPath+"/"+path;
+    
+    File artifactFile = new File(absoluteArtifactPath);
+    if (!artifactFile.exists()) {
+      Console.log("downloading "+path+" from "+name);
+
+      // first make sure the directory exists
+      int index = absoluteArtifactPath.lastIndexOf('/');
+      String artifactDirPath = absoluteArtifactPath.substring(0, index);
+      File artifactDir = new File(artifactDirPath);
+      artifactDir.mkdirs();
+      
+      // download the artifact
+      try {
+        FileOutputStream fileStream = new FileOutputStream(artifactFile);
+        URL artifactUrl = new URL(remoteUrl+"/"+path);
+        pump(artifactUrl, fileStream);
+      } catch (Exception e) {
+        throw new BbqException("couldn't fetch repo artifact "+path);
+      }
+    }
+    
+    return absoluteArtifactPath;
+  }
+
+  protected void pump(URL artifactUrl, OutputStream out) throws Exception {
+    int bufferSize = 1024*10; // 10K
+    int total = 0;
+    int dotCount = 0;
+    byte[] buffer = new byte[bufferSize];
+    InputStream in = null;
+    try {
+      in = artifactUrl.openStream();
+      int bytesRead = in.read( buffer );
+      while ( bytesRead != -1 ) {
+        if (dotCount<80) {
+          Console.print(".");
+          dotCount++;
+        } else {
+          dotCount = 0;
+          Console.log(" "+(total/1024)+" KBytes");
+        }
+        out.write( buffer, 0, bytesRead );
+        total += bytesRead;
+        bytesRead = in.read( buffer );
+      }
+    } finally {
+      Console.log("done");
+      if (in!=null) {
+        try {
+          in.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+      }
+    }
+  }
+}

Modified: projects/bbq/projects/bbq-test-project/.classpath
===================================================================
--- projects/bbq/projects/bbq-test-project/.classpath	2009-10-31 14:28:11 UTC (rev 5869)
+++ projects/bbq/projects/bbq-test-project/.classpath	2009-10-31 14:32:09 UTC (rev 5870)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="java"/>
 	<classpathentry kind="src" path="build"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/bbq-core"/>

Copied: projects/bbq/projects/bbq-test-project/java (from rev 5868, projects/bbq/projects/bbq-test-project/src)



More information about the jbpm-commits mailing list