Search in sources :

Example 41 with Module

use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.

the class CeylonClassWriter method writeClass.

@Override
public JavaFileObject writeClass(ClassSymbol c) throws IOException, PoolOverflow, StringOverflow {
    String packageName = c.packge().getQualifiedName().toString();
    Package pkg = modelLoader.findPackage(packageName);
    if (pkg == null)
        throw new RuntimeException("Failed to find package: " + packageName);
    Module module = pkg.getModule();
    fileManager.setModule(module);
    return super.writeClass(c);
}
Also used : Package(com.redhat.ceylon.model.typechecker.model.Package) Module(com.redhat.ceylon.model.typechecker.model.Module)

Example 42 with Module

use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.

the class CeylonDocToolTests method documentSingleModule.

@Test
public void documentSingleModule() throws Exception {
    String pathname = "test/ceylondoc";
    String moduleName = "com.redhat.ceylon.ceylondoc.test.modules.multi.a";
    CeylonDocTool tool = tool(pathname, moduleName, true, "build/ceylon-cars");
    tool.run();
    Module a = makeModule("com.redhat.ceylon.ceylondoc.test.modules.multi.a", "1");
    File destDirA = getOutputDir(tool, a);
    Module b = makeModule("com.redhat.ceylon.ceylondoc.test.modules.multi.b", "1");
    File destDirB = getOutputDir(tool, b);
    Module def = makeDefaultModule();
    File destDirDef = getOutputDir(tool, def);
    assertFileExists(destDirA, "index.html");
    assertFileNotExists(destDirB, "index.html");
    assertFileNotExists(destDirDef, "index.html");
}
Also used : CeylonDocTool(com.redhat.ceylon.ceylondoc.CeylonDocTool) Module(com.redhat.ceylon.model.typechecker.model.Module) File(java.io.File) Test(org.junit.Test)

Example 43 with Module

use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.

the class CeylonDocToolTests method ceylonSdk.

@Test
public void ceylonSdk() throws Exception {
    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.collection", "ceylon.dbc", "ceylon.file", "ceylon.html", "ceylon.interop.java", "ceylon.io", "ceylon.locale", "ceylon.logging", "ceylon.json", "ceylon.math", "ceylon.net", "ceylon.process", "ceylon.promise", "ceylon.regex", "ceylon.test", "ceylon.time", "ceylon.transaction", "ceylon.unicode" };
    compileSdkJavaFiles();
    CeylonDocTool tool = tool(Arrays.asList(new File("../ceylon-sdk/source")), 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) {
        Module module = makeModule(moduleName, nameToVersion.get(moduleName));
        File destDir = getOutputDir(tool, module);
        assertFileExists(destDir, "index.html");
    }
}
Also used : CeylonDocTool(com.redhat.ceylon.ceylondoc.CeylonDocTool) HashMap(java.util.HashMap) Module(com.redhat.ceylon.model.typechecker.model.Module) File(java.io.File) Test(org.junit.Test)

Example 44 with Module

use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.

the class CeylonDocToolTests method ceylonLanguage.

@Test
public void ceylonLanguage() throws Exception {
    String pathname = "../ceylon.language/src";
    String moduleName = AbstractModelLoader.CEYLON_LANGUAGE;
    CeylonDocTool tool = tool(pathname, moduleName, true, true);
    tool.setIncludeNonShared(false);
    tool.setIncludeSourceCode(true);
    tool.run();
    Module module = makeModule(AbstractModelLoader.CEYLON_LANGUAGE, LANGUAGE_MODULE_VERSION);
    File destDir = getOutputDir(tool, module);
    assertFileExists(destDir, "index.html");
    assertFileExists(destDir, "Nothing.type.html");
}
Also used : CeylonDocTool(com.redhat.ceylon.ceylondoc.CeylonDocTool) Module(com.redhat.ceylon.model.typechecker.model.Module) File(java.io.File) Test(org.junit.Test)

Example 45 with Module

use of com.redhat.ceylon.model.typechecker.model.Module in project ceylon-compiler by ceylon.

the class CeylonDocToolTests method bug2346.

@Test
public void bug2346() throws Exception {
    String pathname = "test/ceylondoc";
    String moduleName = "com.redhat.ceylon.ceylondoc.test.modules.bug2346";
    Module module = new Module();
    module.setName(Arrays.asList(moduleName));
    module.setVersion("1");
    CeylonDocTool tool = tool(Arrays.asList(new File(pathname)), Arrays.asList(new File("doc")), Arrays.asList(moduleName), true, false, false);
    tool.run();
}
Also used : CeylonDocTool(com.redhat.ceylon.ceylondoc.CeylonDocTool) Module(com.redhat.ceylon.model.typechecker.model.Module) File(java.io.File) Test(org.junit.Test)

Aggregations

Module (com.redhat.ceylon.model.typechecker.model.Module)50 Package (com.redhat.ceylon.model.typechecker.model.Package)16 File (java.io.File)14 Test (org.junit.Test)12 TypeDeclaration (com.redhat.ceylon.model.typechecker.model.TypeDeclaration)10 CeylonDocTool (com.redhat.ceylon.ceylondoc.CeylonDocTool)9 Declaration (com.redhat.ceylon.model.typechecker.model.Declaration)9 ArrayList (java.util.ArrayList)6 ClassOrInterface (com.redhat.ceylon.model.typechecker.model.ClassOrInterface)5 ModuleImport (com.redhat.ceylon.model.typechecker.model.ModuleImport)5 ImportModule (com.redhat.ceylon.compiler.typechecker.tree.Tree.ImportModule)4 Class (com.redhat.ceylon.model.typechecker.model.Class)4 TypedDeclaration (com.redhat.ceylon.model.typechecker.model.TypedDeclaration)4 ErrorCollector (com.redhat.ceylon.compiler.java.test.ErrorCollector)3 CeyloncTaskImpl (com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl)3 PhasedUnit (com.redhat.ceylon.compiler.typechecker.context.PhasedUnit)3 LazyModule (com.redhat.ceylon.model.loader.model.LazyModule)3 Function (com.redhat.ceylon.model.typechecker.model.Function)3 FunctionOrValue (com.redhat.ceylon.model.typechecker.model.FunctionOrValue)3 Type (com.redhat.ceylon.model.typechecker.model.Type)3