From: Eric P. <th...@us...> - 2010-09-05 13:50:25
|
Update of /cvsroot/sandev/sand/apps/basics/build/generate/org/sandev/generator In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv14337 Modified Files: DataManagerInfoGenerator.java GeneratorCommon.java SandStringPersistConverterGenerator.java Log Message: Factored out getRootDirNameFromProjDir method to figure out how to get to the top level "sand" directory from a build project. See the method comments for details. Index: DataManagerInfoGenerator.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/build/generate/org/sandev/generator/DataManagerInfoGenerator.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DataManagerInfoGenerator.java 30 Nov 2005 04:10:04 -0000 1.1.1.1 --- DataManagerInfoGenerator.java 5 Sep 2010 13:50:16 -0000 1.2 *************** *** 1,5 **** /* * SAND development/deployment environment ! * Copyright (C) 2005 SAND Services Inc. * * This library is free software; you can redistribute it and/or --- 1,5 ---- /* * SAND development/deployment environment ! * Copyright (C) 2005,2010 SAND Services Inc. * * This library is free software; you can redistribute it and/or *************** *** 192,200 **** SandProject deployment=sbd.getBuildTrigger(); String prefix=deployment.getAntProject().getProperty("DeploymentPrefix"); ! String filename=projDir.toString(); ! if(filename.endsWith(File.separator)) { ! filename=filename.substring(0,filename.lastIndexOf(File.separator)); } ! while(!filename.endsWith("sand")) { ! filename=filename.substring(0,filename.lastIndexOf(File.separator)); } return filename + File.separator + "apps" + File.separator + "basics" + File.separator + "src" + File.separator + --- 192,196 ---- SandProject deployment=sbd.getBuildTrigger(); String prefix=deployment.getAntProject().getProperty("DeploymentPrefix"); ! String filename=getRootDirNameFromProjDir(projDir); return filename + File.separator + "apps" + File.separator + "basics" + File.separator + "src" + File.separator + Index: GeneratorCommon.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/build/generate/org/sandev/generator/GeneratorCommon.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** GeneratorCommon.java 31 Mar 2009 01:19:30 -0000 1.18 --- GeneratorCommon.java 5 Sep 2010 13:50:16 -0000 1.19 *************** *** 1,5 **** /* * SAND development/deployment environment ! * Copyright (C) 2003-2009 SAND Services Inc. * * This library is free software; you can redistribute it and/or --- 1,5 ---- /* * SAND development/deployment environment ! * Copyright (C) 2003-2010 SAND Services Inc. * * This library is free software; you can redistribute it and/or *************** *** 768,771 **** --- 768,802 ---- + /** + * Given a build project, return the root sand directory. This + * used to be done on a per-generator basis, usually by iterating + * upwards through the filename until it ends with "sand" and + * calling that the root. The reason for that was to allow for + * subproject builds. The need for supporting subprojects never + * materialized, but it would be nice to have the top level + * directory be able to be called something other than "sand", so + * this now works by assuming projDir is something like + * .../sand/deploy/someproject + * and then just doing a straight couple of substrings without + * actually looking for "sand". This is more flexible, but + * factoring the logic out into this method in case we need to + * revisit this in the future. + */ + protected String getRootDirNameFromProjDir(File projDir) + { + String filename=projDir.toString(); + //System.out.println("initial filename: " + filename); + //remove trailing slash if present + if(filename.endsWith(File.separator)) { + filename=filename.substring(0,filename.lastIndexOf(File.separator)); } + //now have something like "../sand/deploy/someproject" + filename=filename.substring(0,filename.lastIndexOf(File.separator)); + //now have something like ../sand/deploy + filename=filename.substring(0,filename.lastIndexOf(File.separator)); + //now have ../sand + return filename; + } + + //////////////////////////////////////// // Field management utilities Index: SandStringPersistConverterGenerator.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/build/generate/org/sandev/generator/SandStringPersistConverterGenerator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SandStringPersistConverterGenerator.java 14 Jun 2007 03:20:20 -0000 1.2 --- SandStringPersistConverterGenerator.java 5 Sep 2010 13:50:16 -0000 1.3 *************** *** 1,5 **** /* * SAND development/deployment environment ! * Copyright (C) 2005,2007 SAND Services Inc. * * This library is free software; you can redistribute it and/or --- 1,5 ---- /* * SAND development/deployment environment ! * Copyright (C) 2005,2007,2010 SAND Services Inc. * * This library is free software; you can redistribute it and/or *************** *** 394,402 **** protected String getSPCFileName(File projDir) { ! String filename=projDir.toString(); ! if(filename.endsWith(File.separator)) { ! filename=filename.substring(0,filename.lastIndexOf(File.separator)); } ! while(!filename.endsWith("sand")) { ! filename=filename.substring(0,filename.lastIndexOf(File.separator)); } return filename + File.separator + "apps" + File.separator + "basics" + File.separator + "src" + File.separator + --- 394,398 ---- protected String getSPCFileName(File projDir) { ! String filename=getRootDirNameFromProjDir(projDir); return filename + File.separator + "apps" + File.separator + "basics" + File.separator + "src" + File.separator + |