use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class CeylonDocToolTests method bug2285.
@Test
public void bug2285() throws Exception {
String pathname = "test/ceylondoc-doesnotexist";
String moduleName = "org.eclipse.ceylon.ceylondoc.test.modules.bug2285";
Module module = new Module();
module.setName(Arrays.asList(moduleName));
module.setVersion("1");
try {
CeylonDocTool tool = tool(Arrays.asList(new File(pathname)), Arrays.asList(new File("doc")), Arrays.asList(moduleName), true, false, false);
tool.run();
Assert.fail();
} catch (RuntimeException x) {
Assert.assertEquals("Can't find module: org.eclipse.ceylon.ceylondoc.test.modules.bug2285", x.getMessage());
}
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class CeylonDocToolTests method makeDefaultModule.
private Module makeDefaultModule() {
Module module = new Module();
module.setName(Arrays.asList(Module.DEFAULT_MODULE_NAME));
// module.setDefault(true);
return module;
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class CeylonDocToolTests method ceylonSdk.
@Test
public void ceylonSdk() throws Exception {
Assume.assumeTrue(CompilerTests.allowSdkTests());
File sdkDir = new File("../../ceylon-sdk");
if (!sdkDir.exists() || !sdkDir.isDirectory()) {
Assert.fail("You don't have ceylon-sdk checked out at " + sdkDir.getAbsolutePath() + " so this test doesn't apply");
}
String[] fullModuleNames = { "ceylon.buffer", "ceylon.collection", "ceylon.dbc", "ceylon.decimal", "ceylon.file", "ceylon.html", "ceylon.http.client", "ceylon.http.common", "ceylon.http.server", "ceylon.interop.browser", "ceylon.interop.java", "ceylon.io", "ceylon.json", "ceylon.locale", "ceylon.logging", "ceylon.math", "ceylon.numeric", "ceylon.process", "ceylon.promise", "ceylon.random", "ceylon.regex", "ceylon.test", "ceylon.time", "ceylon.unicode", "ceylon.uri", "ceylon.whole", "org.eclipse.ceylon.war" };
compileSdkJavaFiles();
CeylonDocTool tool = tool(Arrays.asList(new File("../../ceylon-sdk/source")), new String[0], null, Collections.<File>emptyList(), Arrays.asList(fullModuleNames), true, false, false);
tool.setIncludeNonShared(false);
tool.setIncludeSourceCode(true);
tool.run();
Map<String, String> nameToVersion = new HashMap<String, String>();
for (Module module : tool.getDocumentedModules()) {
nameToVersion.put(module.getNameAsString(), module.getVersion());
}
for (String moduleName : fullModuleNames) {
File destDir = getOutputDir(tool, moduleName, nameToVersion.get(moduleName));
assertFileExists(destDir, "index.html");
}
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class AbstractModelLoader method addLocalDeclarations.
private void addLocalDeclarations(LocalDeclarationContainer container, ClassMirror classContainerMirror, AnnotatedMirror annotatedMirror) {
if (!needsLocalDeclarations())
return;
AnnotationMirror annotation = annotatedMirror.getAnnotation(CEYLON_LOCAL_DECLARATIONS_ANNOTATION);
if (annotation == null)
return;
List<String> values = getAnnotationStringValues(annotation, "value");
String parentClassName = classContainerMirror.getQualifiedName();
Package pkg = ModelUtil.getPackageContainer(container);
Module module = pkg.getModule();
for (String scope : values) {
// assemble the name with the parent
String name;
if (scope.startsWith("::")) {
// interface pulled to toplevel
name = pkg.getNameAsString() + "." + scope.substring(2);
} else {
name = parentClassName;
name += "$" + scope;
}
Declaration innerDecl = convertToDeclaration(module, (Declaration) container, name, DeclarationType.TYPE);
if (innerDecl == null)
throw new ModelResolutionException("Failed to load local type " + name + " for outer type " + container.getQualifiedNameString());
}
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class AbstractModelLoader method findModuleForFile.
public Module findModuleForFile(File file) {
File path = file.getParentFile();
while (path != null) {
String name = path.getPath().replaceAll("[\\\\/]", ".");
// FIXME: this would load any version of this module
Module m = getLoadedModule(name, null);
if (m != null) {
return m;
}
path = path.getParentFile();
}
return modules.getDefaultModule();
}
Aggregations