Ant task - added classpath/classpathref

CompileEnvironment - added addToClasspath(File[] / String[])
Switching to CompileEnvironmentException to throw fatal errors
This commit is contained in:
Evgeny Goldin
2012-01-28 00:13:06 +02:00
parent 8a79088698
commit 5cc9ce8a98
3 changed files with 107 additions and 33 deletions
@@ -335,19 +335,39 @@ public class CompileEnvironment {
}
}
public void setStdlib(String stdlib) {
File path = new File(stdlib);
if (!path.exists()) {
throw new CompileEnvironmentException("'" + stdlib + "' does not exist");
/**
* Add path specified to the compilation environment.
* @param paths paths to add
*/
public void addToClasspath(File ... paths) {
for (File path : paths) {
if ( ! path.exists()) {
throw new CompileEnvironmentException("'" + path + "' does not exist");
}
myEnvironment.addToClasspath(path);
}
}
/**
* Add path specified to the compilation environment.
* @param paths paths to add
*/
public void addToClasspath(String ... paths) {
for (String path : paths) {
addToClasspath( new File(path));
}
}
public void setStdlib(String stdlib) {
File file = new File(stdlib);
addToClasspath(file);
try {
myStdlib = path.toURL();
myStdlib = file.toURL();
}
catch (MalformedURLException e) {
throw new RuntimeException(e);
}
myEnvironment.addToClasspath(path);
}
}