JBoss JBPM SVN: r5872 - projects/bbq/projects/bbq-test-project/build.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-31 16:17:53 -0400 (Sat, 31 Oct 2009)
New Revision: 5872
Modified:
projects/bbq/projects/bbq-test-project/build/Build.java
Log:
Modified: projects/bbq/projects/bbq-test-project/build/Build.java
===================================================================
--- projects/bbq/projects/bbq-test-project/build/Build.java 2009-10-31 18:18:42 UTC (rev 5871)
+++ projects/bbq/projects/bbq-test-project/build/Build.java 2009-10-31 20:17:53 UTC (rev 5872)
@@ -34,17 +34,18 @@
public static void compile() {
ClassPath classPath = new ClassPath()
- .add(jbossRepository, "org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar")
- .add("../some/relative/path;/some/absolute/path");
+ .add(jbossRepository, "org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar");
new Javac()
.classPath(classPath)
.execute();
}
- public static void jar() {
+ public static void publish() {
+
}
- public static void publish() {
+ public static void test() {
+
}
}
16 years, 4 months
JBoss JBPM SVN: r5871 - in projects/bbq/projects: bbq-core/java/org/bbq and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-31 14:18:42 -0400 (Sat, 31 Oct 2009)
New Revision: 5871
Modified:
projects/bbq/projects/bbq-core/bin/bbq.bat
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/Javac.java
projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java
projects/bbq/projects/bbq-core/java/org/bbq/system/Path.java
projects/bbq/projects/bbq-test-project/build/Build.java
Log:
backup commit
Modified: projects/bbq/projects/bbq-core/bin/bbq.bat
===================================================================
--- projects/bbq/projects/bbq-core/bin/bbq.bat 2009-10-31 14:32:09 UTC (rev 5870)
+++ projects/bbq/projects/bbq-core/bin/bbq.bat 2009-10-31 18:18:42 UTC (rev 5871)
@@ -1,2 +1,3 @@
-echo using java %JAVA_HOME%
-"%JAVA_HOME%\bin\java" -cp %~dp0..\build\gen\classes org.bbq.Bbq %*
+@echo off
+echo using jdk %JAVA_HOME%
+"%JAVA_HOME%\bin\java" -cp %~dp0..\gen\classes org.bbq.Bbq %*
Modified: projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java 2009-10-31 14:32:09 UTC (rev 5870)
+++ projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java 2009-10-31 18:18:42 UTC (rev 5871)
@@ -23,12 +23,14 @@
import java.io.File;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Properties;
import org.bbq.commands.Javac;
import org.bbq.system.Console;
+import org.bbq.system.Path;
/**
@@ -40,6 +42,8 @@
public static void main(String[] args) {
// initialize default properties
+ properties.setProperty("javac.src.dir", "java");
+ properties.setProperty("javac.dest.dir", "gen/classes");
properties.setProperty("build.src.dir", "build");
properties.setProperty("build.classes.dir", "gen/build-classes");
properties.setProperty("local.repo.dir", System.getProperty("user.home")+"/.bbq");
@@ -48,7 +52,7 @@
String buildSrcDir = properties.getProperty("build.src.dir");
String buildClassesDir = properties.getProperty("build.classes.dir");
- String buildClassPath = System.getProperty("java.class.path");
+ String buildClassPath = Path.absolute(System.getProperty("java.class.path"));
File buildSrcFile = new File(buildSrcDir);
if (!buildSrcFile.exists()) {
@@ -59,7 +63,7 @@
Console.log("no build source dir: "+buildSrcFile.getAbsolutePath()+" is a file");
return;
}
-
+
new Javac()
.srcDir(buildSrcDir)
.destDir(buildClassesDir)
@@ -70,12 +74,24 @@
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);
+ // if the user specified build operations as arguments
+ if (args!=null && args.length>0) {
+ 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);
+ }
}
+ } else { // means user didn't pass build operations
+ Console.log("available build operations:");
+ for (Method method: buildClass.getDeclaredMethods()) {
+ if ( Modifier.isStatic(method.getModifiers())
+ && (method.getParameterTypes().length==0)
+ ) {
+ Console.log(" "+method.getName());
+ }
+ }
}
} catch (Exception e) {
e.printStackTrace();
Modified: projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java 2009-10-31 14:32:09 UTC (rev 5870)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java 2009-10-31 18:18:42 UTC (rev 5871)
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.StringTokenizer;
+import org.bbq.system.Console;
import org.bbq.system.Repository;
@@ -43,7 +44,8 @@
public ClassPath add(String path) {
StringTokenizer tokenizer = new StringTokenizer(path, ";");
while (tokenizer.hasMoreTokens()) {
- elements.add(tokenizer.nextToken());
+ String nextPathElement = tokenizer.nextToken();
+ elements.add(nextPathElement);
}
return this;
}
@@ -66,7 +68,7 @@
stringBuilder.append(elements.get(i));
stringBuilder.append(separator);
}
- stringBuilder.append(elements.size()-1);
+ stringBuilder.append(elements.get(elements.size()-1));
return stringBuilder.toString();
}
}
Modified: projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java 2009-10-31 14:32:09 UTC (rev 5870)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java 2009-10-31 18:18:42 UTC (rev 5871)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.bbq.Bbq;
import org.bbq.system.FileList;
import org.bbq.system.FileScan;
import org.bbq.system.Os;
@@ -36,7 +37,7 @@
FileList sourceFiles = new FileList();
boolean verbose;
- String destDir = "gen/classes";
+ String destDir = Bbq.properties.getProperty("javac.dest.dir");
ClassPath classPath = new ClassPath();
public Javac srcDir(String srcDir) {
@@ -44,7 +45,11 @@
.filterEnd(".java")
.execute();
- this.sourceFiles.add( sourceFiles );
+ if (this.sourceFiles==null) {
+ this.sourceFiles = sourceFiles;
+ } else {
+ this.sourceFiles.add( sourceFiles );
+ }
return this;
}
@@ -76,6 +81,11 @@
}
public void execute() {
+ if (sourceFiles==null) {
+ String defaultJavacSourceDir = Bbq.properties.getProperty("javac.src.dir");
+ srcDir(defaultJavacSourceDir);
+ }
+
// create the destination directory
new MkDir(destDir)
.execute();
Modified: projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java 2009-10-31 14:32:09 UTC (rev 5870)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/Os.java 2009-10-31 18:18:42 UTC (rev 5871)
@@ -42,4 +42,8 @@
}
throw new BbqException("unknown os: "+name);
}
+
+ public static boolean isWindows() {
+ return TYPE==WINDOWS;
+ }
}
Modified: projects/bbq/projects/bbq-core/java/org/bbq/system/Path.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/system/Path.java 2009-10-31 14:32:09 UTC (rev 5870)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/Path.java 2009-10-31 18:18:42 UTC (rev 5871)
@@ -21,12 +21,29 @@
*/
package org.bbq.system;
+import java.io.File;
+import java.io.IOException;
+
/**
* @author Tom Baeyens
*/
public class Path {
+ public static String absolute(String path) {
+ String absolutePath = null;
+ File file = new File(path);
+ try {
+ absolutePath = file.getCanonicalPath();
+ } catch (IOException e) {
+ absolutePath = file.getAbsolutePath();
+ }
+ if (Os.isWindows()) {
+ absolutePath = absolutePath.replace('\\', '/');
+ }
+ return absolutePath;
+ }
+
// public static String toOsSpecific(String path) {
// }
//
Modified: projects/bbq/projects/bbq-test-project/build/Build.java
===================================================================
--- projects/bbq/projects/bbq-test-project/build/Build.java 2009-10-31 14:32:09 UTC (rev 5870)
+++ projects/bbq/projects/bbq-test-project/build/Build.java 2009-10-31 18:18:42 UTC (rev 5871)
@@ -38,8 +38,6 @@
.add("../some/relative/path;/some/absolute/path");
new Javac()
- .srcDir("src")
- .destDir("gen/classes")
.classPath(classPath)
.execute();
}
16 years, 4 months
JBoss JBPM SVN: r5870 - in projects/bbq/projects: bbq-core/java/org/bbq and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)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)
16 years, 4 months
JBoss JBPM SVN: r5869 - in projects/bbq/projects: bbq-core/src/org/bbq/commands and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-31 10:28:11 -0400 (Sat, 31 Oct 2009)
New Revision: 5869
Modified:
projects/bbq/projects/bbq-core/src/org/bbq/Bbq.java
projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java
projects/bbq/projects/bbq-core/src/org/bbq/commands/Exec.java
projects/bbq/projects/bbq-core/src/org/bbq/commands/Javac.java
projects/bbq/projects/bbq-core/src/org/bbq/system/FileScan.java
projects/bbq/projects/bbq-core/src/org/bbq/system/Os.java
projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java
projects/bbq/projects/bbq-test-project/build/Build.java
Log:
backup commit
Modified: projects/bbq/projects/bbq-core/src/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/src/org/bbq/Bbq.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -39,7 +39,6 @@
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");
@@ -49,12 +48,22 @@
String buildSrcDir = properties.getProperty("build.src.dir");
String buildClassesDir = properties.getProperty("build.classes.dir");
- String buildClasspath = System.getProperty("java.class.path");
+ 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)
+ .classPath(buildClassPath)
.execute();
try {
Modified: projects/bbq/projects/bbq-core/src/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/src/org/bbq/commands/ClassPath.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -48,8 +48,25 @@
return this;
}
- public ClassPath execute() {
-
+ 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();
+ }
}
Modified: projects/bbq/projects/bbq-core/src/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/src/org/bbq/commands/Exec.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -35,6 +35,7 @@
public class Exec {
List<String> cmd;
+ String description;
public Exec(List<String> cmd) {
this.cmd = cmd;
@@ -42,9 +43,12 @@
public void execute() {
try {
- String msg = "exec";
- for (String cmdPart: cmd) {
- msg += " "+cmdPart;
+ String msg = description;
+ if (msg==null) {
+ msg = "exec ";
+ for (String cmdPart: cmd) {
+ msg += " "+cmdPart;
+ }
}
Console.log(msg);
@@ -54,11 +58,16 @@
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
for (String line = bufferedReader.readLine(); line!=null; line = bufferedReader.readLine()) {
- Console.log(" |"+line);
+ Console.log(" |"+line);
}
} catch (Exception e) {
throw new BbqException("couldn't exec "+cmd, e);
}
}
+
+ public Exec description(String description) {
+ this.description = description;
+ return this;
+ }
}
Modified: projects/bbq/projects/bbq-core/src/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/src/org/bbq/commands/Javac.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -36,8 +36,8 @@
FileList sourceFiles = new FileList();
boolean verbose;
- String destDir;
- String classPath;
+ String destDir = "gen/classes";
+ ClassPath classPath = new ClassPath();
public Javac srcDir(String srcDir) {
FileList sourceFiles = new FileScan(srcDir)
@@ -61,10 +61,15 @@
}
public Javac classPath(String classPath) {
- this.classPath = 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;
@@ -80,23 +85,25 @@
cmd.add(Java.JAVA_HOME+Os.FILE_SEPARATOR+"bin"+Os.FILE_SEPARATOR+"javac");
cmd.add("-d");
cmd.add(destDir);
- if (classPath!=null) {
+ String description = "javac -d "+destDir;
+ if (!classPath.isEmpty()) {
cmd.add("-classpath");
- 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();
}
-
- public ClassPath classPath(ClassPath classPath) {
- return null;
- }
}
Modified: projects/bbq/projects/bbq-core/src/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/src/org/bbq/system/FileScan.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -46,12 +46,14 @@
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);
+ 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);
+ }
}
}
}
Modified: projects/bbq/projects/bbq-core/src/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/src/org/bbq/system/Os.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -33,6 +33,7 @@
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");
Modified: projects/bbq/projects/bbq-core/src/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/src/org/bbq/system/Repository.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -37,10 +37,12 @@
*/
public class Repository {
+ String name;
String remoteUrl;
String localRepositoryPath;
- public Repository(String remoteUrl, String name) {
+ public Repository(String name, String remoteUrl) {
+ this.name = name;
this.remoteUrl = remoteUrl;
this.localRepositoryPath = Bbq.properties.getProperty("local.repo.dir")+"/"+name;
}
@@ -50,7 +52,7 @@
File artifactFile = new File(absoluteArtifactPath);
if (!artifactFile.exists()) {
- Console.print("downloading repo artifact "+path);
+ Console.log("downloading "+path+" from "+name);
// first make sure the directory exists
int index = absoluteArtifactPath.lastIndexOf('/');
@@ -74,13 +76,20 @@
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 ) {
- Console.print(".");
+ 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 );
Modified: projects/bbq/projects/bbq-test-project/build/Build.java
===================================================================
--- projects/bbq/projects/bbq-test-project/build/Build.java 2009-10-31 12:00:06 UTC (rev 5868)
+++ projects/bbq/projects/bbq-test-project/build/Build.java 2009-10-31 14:28:11 UTC (rev 5869)
@@ -30,16 +30,23 @@
*/
public class Build {
- static Repository jbossRepository = new Repository("http://repository.jboss.com/maven2/", "jboss");
+ static Repository jbossRepository = new Repository("jboss", "http://repository.jboss.com/maven2/");
public static void compile() {
ClassPath classPath = new ClassPath()
- .add(jbossRepository, "org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar");
+ .add(jbossRepository, "org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar")
+ .add("../some/relative/path;/some/absolute/path");
new Javac()
.srcDir("src")
- .destDir("build/gen/classes")
+ .destDir("gen/classes")
.classPath(classPath)
.execute();
}
+
+ public static void jar() {
+ }
+
+ public static void publish() {
+ }
}
16 years, 4 months
JBoss JBPM SVN: r5868 - in projects/bbq/projects: bbq-test-project and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-31 08:00:06 -0400 (Sat, 31 Oct 2009)
New Revision: 5868
Modified:
projects/bbq/projects/bbq-core/
projects/bbq/projects/bbq-test-project/
Log:
backup commit
Property changes on: projects/bbq/projects/bbq-core
___________________________________________________________________
Name: svn:ignore
+ gen
Property changes on: projects/bbq/projects/bbq-test-project
___________________________________________________________________
Name: svn:ignore
+ gen
16 years, 4 months
JBoss JBPM SVN: r5867 - in projects/bbq/projects: bbq-core/test/org/bbq/test and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-31 07:35:35 -0400 (Sat, 31 Oct 2009)
New Revision: 5867
Added:
projects/bbq/projects/bbq-core/test/org/bbq/test/RepositoryTest.java
Removed:
projects/bbq/projects/bbq-core/gen/
projects/bbq/projects/bbq-test-project/gen/
Log:
Added: projects/bbq/projects/bbq-core/test/org/bbq/test/RepositoryTest.java
===================================================================
--- projects/bbq/projects/bbq-core/test/org/bbq/test/RepositoryTest.java (rev 0)
+++ projects/bbq/projects/bbq-core/test/org/bbq/test/RepositoryTest.java 2009-10-31 11:35:35 UTC (rev 5867)
@@ -0,0 +1,37 @@
+/*
+ * 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.test;
+
+import org.bbq.system.Repository;
+
+import junit.framework.TestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryTest extends TestCase {
+
+ public void testRepoFetch() {
+ new Repository("http://repository.jboss.com/maven2/", "jboss");
+ }
+}
Property changes on: projects/bbq/projects/bbq-core/test/org/bbq/test/RepositoryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
JBoss JBPM SVN: r5866 - in projects/bbq/projects: bbq-core/src/org/bbq and 7 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-31 07:33:22 -0400 (Sat, 31 Oct 2009)
New Revision: 5866
Added:
projects/bbq/projects/bbq-core/lib/junit-4.4.jar
projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java
projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java
projects/bbq/projects/bbq-core/test/org/
projects/bbq/projects/bbq-core/test/org/bbq/
projects/bbq/projects/bbq-core/test/org/bbq/test/
projects/bbq/projects/bbq-test-project/build/Build.java
projects/bbq/projects/bbq-test-project/gen/
Removed:
projects/bbq/projects/bbq-test-project/build/src/
Modified:
projects/bbq/projects/bbq-core/src/org/bbq/Bbq.java
projects/bbq/projects/bbq-core/src/org/bbq/commands/Javac.java
projects/bbq/projects/bbq-core/src/org/bbq/system/Console.java
projects/bbq/projects/bbq-test-project/.classpath
Log:
backup commit
Added: projects/bbq/projects/bbq-core/lib/junit-4.4.jar
===================================================================
(Binary files differ)
Property changes on: projects/bbq/projects/bbq-core/lib/junit-4.4.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/bbq/projects/bbq-core/src/org/bbq/Bbq.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/Bbq.java 2009-10-31 11:32:01 UTC (rev 5865)
+++ projects/bbq/projects/bbq-core/src/org/bbq/Bbq.java 2009-10-31 11:33:22 UTC (rev 5866)
@@ -25,9 +25,9 @@
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.commands.MkDir;
import org.bbq.system.Console;
@@ -35,18 +35,30 @@
* @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("build/src")
- .destDir("build/gen/build-classes")
+ .srcDir(buildSrcDir)
+ .destDir(buildClassesDir)
.classPath(buildClasspath)
.execute();
try {
- URL[] urls = {new File("build/gen/build-classes").toURL()};
+ 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) {
Added: projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java (rev 0)
+++ projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java 2009-10-31 11:33:22 UTC (rev 5866)
@@ -0,0 +1,55 @@
+/*
+ * 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;
+ }
+}
Property changes on: projects/bbq/projects/bbq-core/src/org/bbq/commands/ClassPath.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: projects/bbq/projects/bbq-core/src/org/bbq/commands/Javac.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/commands/Javac.java 2009-10-31 11:32:01 UTC (rev 5865)
+++ projects/bbq/projects/bbq-core/src/org/bbq/commands/Javac.java 2009-10-31 11:33:22 UTC (rev 5866)
@@ -95,4 +95,8 @@
new Exec(cmd)
.execute();
}
+
+ public ClassPath classPath(ClassPath classPath) {
+ return null;
+ }
}
Modified: projects/bbq/projects/bbq-core/src/org/bbq/system/Console.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/system/Console.java 2009-10-31 11:32:01 UTC (rev 5865)
+++ projects/bbq/projects/bbq-core/src/org/bbq/system/Console.java 2009-10-31 11:33:22 UTC (rev 5866)
@@ -30,4 +30,8 @@
public static void log(String msg) {
System.err.println(msg);
}
+ public static void print(String msg) {
+ System.err.print(msg);
+ System.err.flush();
+ }
}
Added: projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java
===================================================================
--- projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java (rev 0)
+++ projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java 2009-10-31 11:33:22 UTC (rev 5866)
@@ -0,0 +1,99 @@
+/*
+ * 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();
+ }
+ }
+ }
+ }
+}
Property changes on: projects/bbq/projects/bbq-core/src/org/bbq/system/Repository.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: projects/bbq/projects/bbq-test-project/.classpath
===================================================================
--- projects/bbq/projects/bbq-test-project/.classpath 2009-10-31 11:32:01 UTC (rev 5865)
+++ projects/bbq/projects/bbq-test-project/.classpath 2009-10-31 11:33:22 UTC (rev 5866)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" output="build/gen/build-classes" path="build/src"/>
+ <classpathentry kind="src" path="build"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/bbq-core"/>
- <classpathentry kind="output" path="build/gen/classes"/>
+ <classpathentry kind="output" path="gen/classes"/>
</classpath>
Copied: projects/bbq/projects/bbq-test-project/build/Build.java (from rev 5864, projects/bbq/projects/bbq-test-project/build/src/Build.java)
===================================================================
--- projects/bbq/projects/bbq-test-project/build/Build.java (rev 0)
+++ projects/bbq/projects/bbq-test-project/build/Build.java 2009-10-31 11:33:22 UTC (rev 5866)
@@ -0,0 +1,45 @@
+import org.bbq.commands.ClassPath;
+import org.bbq.commands.Javac;
+import org.bbq.system.Repository;
+
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Tom Baeyens
+ */
+public class Build {
+
+ static Repository jbossRepository = new Repository("http://repository.jboss.com/maven2/", "jboss");
+
+ public static void compile() {
+ ClassPath classPath = new ClassPath()
+ .add(jbossRepository, "org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar");
+
+ new Javac()
+ .srcDir("src")
+ .destDir("build/gen/classes")
+ .classPath(classPath)
+ .execute();
+ }
+}
Property changes on: projects/bbq/projects/bbq-test-project/build/Build.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
JBoss JBPM SVN: r5865 - projects/bbq/projects/bbq-core.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-31 07:32:01 -0400 (Sat, 31 Oct 2009)
New Revision: 5865
Added:
projects/bbq/projects/bbq-core/gen/
projects/bbq/projects/bbq-core/lib/
projects/bbq/projects/bbq-core/test/
Removed:
projects/bbq/projects/bbq-core/build/
Modified:
projects/bbq/projects/bbq-core/.classpath
Log:
backup commit
Modified: projects/bbq/projects/bbq-core/.classpath
===================================================================
--- projects/bbq/projects/bbq-core/.classpath 2009-10-31 01:09:07 UTC (rev 5864)
+++ projects/bbq/projects/bbq-core/.classpath 2009-10-31 11:32:01 UTC (rev 5865)
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" output="gen/test-classes" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="build/gen/classes"/>
+ <classpathentry kind="lib" path="lib/junit-4.4.jar"/>
+ <classpathentry kind="output" path="gen/classes"/>
</classpath>
16 years, 4 months
JBoss JBPM SVN: r5864 - projects/bbq/projects/bbq-core/bin.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-30 21:09:07 -0400 (Fri, 30 Oct 2009)
New Revision: 5864
Modified:
projects/bbq/projects/bbq-core/bin/bbq.bat
Log:
added quotes around java executable in bat file
Modified: projects/bbq/projects/bbq-core/bin/bbq.bat
===================================================================
--- projects/bbq/projects/bbq-core/bin/bbq.bat 2009-10-31 01:02:13 UTC (rev 5863)
+++ projects/bbq/projects/bbq-core/bin/bbq.bat 2009-10-31 01:09:07 UTC (rev 5864)
@@ -1,2 +1,2 @@
echo using java %JAVA_HOME%
-%JAVA_HOME%/bin/java -cp %~dp0..\build\gen\classes org.bbq.Bbq %*
+"%JAVA_HOME%\bin\java" -cp %~dp0..\build\gen\classes org.bbq.Bbq %*
16 years, 4 months
JBoss JBPM SVN: r5863 - /.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-10-30 21:02:13 -0400 (Fri, 30 Oct 2009)
New Revision: 5863
Removed:
bbq-root/
Log:
deleting bbq-root
16 years, 4 months