}
public static CeylonClassLoader getCeylonClassLoaderCachedInProject(final Project project) throws ClassLoaderSetupException {
Object classLoader = project.getReference(CEYLON_CLASSLOADER_REFERENCE);
if(classLoader != null){
CeylonClassLoader oldLoader = (CeylonClassLoader) classLoader;
// make sure it's still valid
try{
List<File> classPath = CeylonClassLoader.getClassPath();
if(oldLoader.hasSignature(CeylonClassLoader.getClassPathSignature(classPath))){
// compatible
return oldLoader;
}else{
project.log("Needs a new class loader: cp changed!", Project.MSG_VERBOSE);
CeylonClassLoader loader = CeylonClassLoader.newInstance(classPath);
project.addReference(CEYLON_CLASSLOADER_REFERENCE, loader);
return loader;
}
}catch(FileNotFoundException x){
throw new ClassLoaderSetupException(x);
} catch (URISyntaxException x) {
throw new ClassLoaderSetupException(x);
} catch (MalformedURLException x) {
throw new ClassLoaderSetupException(x);
}
}
CeylonClassLoader loader = Launcher.getClassLoader();
project.addReference(CEYLON_CLASSLOADER_REFERENCE, loader);
// only add the build listed once, even if we change the class loader later
project.addBuildListener(new BuildListener(){
@Override