[kepler-code] r28770 - trunk/modules/build-area/src/org/kepler/build
crawl at ecoinformatics.org
crawl at ecoinformatics.org
Fri Oct 7 11:46:05 PDT 2011
Author: crawl
Date: 2011-10-07 11:46:05 -0700 (Fri, 07 Oct 2011)
New Revision: 28770
Modified:
trunk/modules/build-area/src/org/kepler/build/MakeModule.java
Log:
creating additional directories
notify user if creation fails
Modified: trunk/modules/build-area/src/org/kepler/build/MakeModule.java
===================================================================
--- trunk/modules/build-area/src/org/kepler/build/MakeModule.java 2011-10-06 14:03:57 UTC (rev 28769)
+++ trunk/modules/build-area/src/org/kepler/build/MakeModule.java 2011-10-07 18:46:05 UTC (rev 28770)
@@ -38,41 +38,57 @@
{
String name;
- /**
- * set the name of the new module
- *
- * @param name
- */
+ /** Set the name of the new module. */
public void setName(String name)
{
this.name = name;
}
- /**
- * run the task
- */
+ /** Create a module. */
public void run() throws Exception
{
//Sanity check: make sure that the user has defined a name for the module.
if (name.equals("undefined"))
{
System.out.println("You must define a name for the module.");
- System.out.println("e.g. ant make-source-module -Dname=the-module");
+ System.out.println("e.g., ant make-source-module -Dname=the-module");
return;
}
System.out.println("Making a module named " + name + ".");
//Make the directories associated with a source module.
- //System.out.println("Making a new module named " + name);
File moduleDir = new File(basedir, name);
+
File srcDir = new File(moduleDir, "src");
+ _mkdirIfDoesNotExist(srcDir);
+
+ // FIXME these locations are duplicated in Module.java
+
File systemPropDir = new File(moduleDir, "resources/system.properties");
+ _mkdirIfDoesNotExist(systemPropDir);
+
File libExeDir = new File(moduleDir, "lib/exe");
- srcDir.mkdirs();
- systemPropDir.mkdirs();
- libExeDir.mkdirs();
+ _mkdirIfDoesNotExist(libExeDir);
+
+ File libJarDir = new File(moduleDir, "lib/jar");
+ _mkdirIfDoesNotExist(libJarDir);
+
+ File lib64Dir = new File(moduleDir, "lib64");
+ _mkdirIfDoesNotExist(lib64Dir);
+ File moduleInfoDir = new File(moduleDir, "module-info");
+ _mkdirIfDoesNotExist(moduleInfoDir);
+
}
+
+ /** Create a directory if it does not exist. */
+ private void _mkdirIfDoesNotExist(File dir)
+ {
+ if(!dir.exists() && !dir.mkdirs())
+ {
+ System.err.println("WARNING: could not create " + dir);
+ }
+ }
}
More information about the Kepler-cvs
mailing list