}
// now compile the ceylon usage file
// remove the extension, make lowercase and add "test"
String testfile = ceylon.substring(0, ceylon.length()-7).toLowerCase()+"test.ceylon";
JavacTaskImpl task2 = getCompilerTask(testfile);
// get the context to grab the declarations
final Context context2 = task2.getContext();
// check the declarations after Enter but before the compilation is done otherwise we can't load lazy
// declarations from the jar anymore because we've overridden the jar and the javac jar index is corrupted
class Listener implements TaskListener{
@Override
public void started(TaskEvent e) {
}
@Override
public void finished(TaskEvent e) {
if(e.getKind() == Kind.ENTER){
AbstractModelLoader modelLoader = CeylonModelLoader.instance(context2);
Modules modules = LanguageCompiler.getCeylonContextInstance(context2).getModules();
// now see if we can find our declarations
compareDeclarations(modelCompare, decls, modelLoader, modules);
}
}
}
Listener listener = new Listener();
task2.setTaskListener(listener);
success = task2.call();
Assert.assertTrue("Compilation failed", success);
// now check with the runtime model loader too
String module = moduleForJavaModelLoading();
String version = "1";