*/\r
public class SlcAntConfig {\r
// SLC ROOT PROPERTIES\r
+ /** Property for the root file (SLC root property file). */\r
public final static String ROOT_FILE_PROPERTY = "slc.rootFile";\r
+ /** Property for the root dir (SLC root property file). */\r
public final static String ROOT_DIR_PROPERTY = "slc.rootDir";\r
+ /** Property for the conf dir (SLC root property file). */\r
public final static String CONF_DIR_PROPERTY = "slc.confDir";\r
+ /** Property for the work dir (SLC root property file). */\r
public final static String WORK_DIR_PROPERTY = "slc.workDir";\r
/**\r
* Comma-separated list of property file names to load from the conf dir and\r
public static String DEFAULT_TEST_RUN_PROPERTY = "slc.defaultTestRun";\r
\r
// SLC LOCAL PROPERTIES\r
+ /** Property for the dir description (SLC local property file). */\r
public static String DIR_DESCRIPTION_PROPERTY = "slc.dirDescription";\r
\r
private String slcRootFileName = "slcRoot.properties";\r
* \r
* @param project\r
* the Ant <code>Project</code> being run.\r
+ * @return whether the project could be initialized for SLC usage (e.g.\r
+ * presence of an SLC root file)\r
*/\r
- public void initProject(Project project) {\r
+ public boolean initProject(Project project) {\r
File projectBaseDir = project.getBaseDir();\r
File slcRootFile = findSlcRootFile(projectBaseDir);\r
if (slcRootFile == null) {\r
- throw new SlcAntException("Cannot find SLC root file");\r
+ return false;\r
}\r
+\r
// pass the project properties through the System properties\r
System.getProperties().putAll((Map<?, ?>) project.getUserProperties());\r
Properties all = prepareAllProperties(slcRootFile);\r
project.setUserProperty(key, all.getProperty(key));\r
}\r
}\r
+ return true;\r
}\r
\r
/**\r
*/\r
protected Properties prepareAllProperties(File slcRootFile) {\r
try {\r
+ final String fileUrlPrefix = "";\r
+\r
Properties all = new Properties();\r
all.putAll(System.getProperties());\r
all.put(ROOT_FILE_PROPERTY, slcRootFile.getCanonicalPath());\r
final File workDir;\r
// Root dir\r
final File rootDir = slcRootFile.getParentFile();\r
- all.setProperty(ROOT_DIR_PROPERTY, rootDir.getCanonicalPath());\r
+ all.setProperty(ROOT_DIR_PROPERTY, fileUrlPrefix\r
+ + rootDir.getCanonicalPath());\r
\r
// Conf dir\r
if (all.getProperty(CONF_DIR_PROPERTY) == null) {\r
confDir = new File(rootProps.getProperty(CONF_DIR_PROPERTY,\r
rootDir.getAbsolutePath() + "/../conf"))\r
.getCanonicalFile();\r
- all.setProperty(CONF_DIR_PROPERTY, confDir.getAbsolutePath());\r
+ all.setProperty(CONF_DIR_PROPERTY, fileUrlPrefix\r
+ + confDir.getAbsolutePath());\r
} else {\r
confDir = new File(all.getProperty(CONF_DIR_PROPERTY))\r
.getCanonicalFile();\r
workDir = new File(rootProps.getProperty(WORK_DIR_PROPERTY,\r
rootDir.getAbsolutePath() + "/../work"))\r
.getCanonicalFile();\r
- all.setProperty(WORK_DIR_PROPERTY, workDir.getAbsolutePath());\r
+ all.setProperty(WORK_DIR_PROPERTY, fileUrlPrefix\r
+ + workDir.getAbsolutePath());\r
} else {\r
workDir = new File(all.getProperty(WORK_DIR_PROPERTY))\r
.getCanonicalFile();\r