Package com.redhat.ceylon.compiler.typechecker.io

Examples of com.redhat.ceylon.compiler.typechecker.io.VFS


            writer.write(buf);
        }
        reader.close();
        ModuleComplianceVisitor v = new ModuleComplianceVisitor(writer.toString());
        System.out.println("Checking Ceylon vs JS modules...");
        VFS vfs = new VFS();
        TypeChecker tc = new TypeCheckerBuilder().verbose(false)
                .addSrcDirectory(vfs.getFromZipFile(mod)).getTypeChecker();
        tc.process();
        for (PhasedUnit pu : tc.getPhasedUnits().getPhasedUnits()) {
            pu.getCompilationUnit().visit(v);
        }
    }
View Full Code Here


* @author Emmanuel Bernard <emmanuel@hibernate.org>
*/
public class MainHelper {

    public static final ClosableVirtualFile getLatestZippedLanguageSourceFile() {
        VFS vfs = new VFS();
        File langDir = new File(System.getProperty("user.home"), ".ceylon/repo/ceylon/language");
        if (!langDir.exists()) {
            System.err.println("Unable to test language module, not found in repository: " + langDir);
            System.exit(-1);
        }
        String[] versions = langDir.list();
        Arrays.sort(versions);
        String version = versions[versions.length-1]; //last
        return vfs.getFromZipFile( new File(langDir, version + "/ceylon.language-" + version + ".src") );
    }
View Full Code Here

    private final Module moduleDescriptor;

    public ModuleDescriptorReader(String moduleName, File srcDir) throws NoSuchModuleException {
        RepositoryManagerBuilder builder = new RepositoryManagerBuilder(new NullLogger(), DefaultToolOptions.getDefaultOffline(), (int)DefaultToolOptions.getDefaultTimeout());
        RepositoryManager repoManager = builder.buildRepository();
        VFS vfs = new VFS();
        Context context = new Context(repoManager, vfs);
        PhasedUnits pus = new PhasedUnits(context);
        List<String> name = ModuleManager.splitModuleName(moduleName);
        ModuleManager moduleManager = pus.getModuleManager();
        if(Module.DEFAULT_MODULE_NAME.equals(moduleName)){
            // visit every folder and skip modules
            boolean exists = findDefaultModuleSource(srcDir);
            if(!exists)
                throw new NoSuchModuleException("No source found for default module");
        }else{
            visitModule(vfs, pus, name, srcDir, vfs.getFromFile(srcDir), moduleManager);
        }
        for (PhasedUnit pu : pus.getPhasedUnits()) {
            pu.visitSrcModulePhase();
        }
        this.moduleDescriptor = moduleManager.getOrCreateModule(name, null);
View Full Code Here

    }
   
    protected void verifyRuntimeClassLoading(RunnableTest test) {
        RepositoryManager repoManager = CeylonUtils.repoManager()
                .buildManager();
        VFS vfs = new VFS();
        com.redhat.ceylon.compiler.typechecker.context.Context context = new com.redhat.ceylon.compiler.typechecker.context.Context(repoManager, vfs);
        RuntimeModuleManager moduleManager = new RuntimeModuleManager(context);
        moduleManager.initCoreModules();
        moduleManager.loadModule(AbstractModelLoader.CEYLON_LANGUAGE, Versions.CEYLON_VERSION_NUMBER, repoManager.getArtifactResult("ceylon.language", Versions.CEYLON_VERSION_NUMBER),
                getClass().getClassLoader());
View Full Code Here

        compile("JavaContainer1.java", "JavaContainer2.java");
        compile("JavaContainerTest.ceylon");
    }
   
    private static final ClosableVirtualFile getLatestZippedLanguageSourceFile() {
        VFS vfs = new VFS();
        File langDir = new File("../ceylon-dist/dist/repo/ceylon/language");
        if (!langDir.exists()) {
            System.err.println("Unable to test language module, not found in repository: " + langDir);
            System.exit(-1);
        }
        String[] versions = langDir.list();
        Arrays.sort(versions);
        String version = versions[versions.length-1]; //last
        return vfs.getFromZipFile( new File(langDir, version + "/ceylon.language-" + version + ".src") );
    }
View Full Code Here

    /** Get the Ceylon context instance for this context. */
    public static com.redhat.ceylon.compiler.typechecker.context.Context getCeylonContextInstance(Context context) {
        com.redhat.ceylon.compiler.typechecker.context.Context ceylonContext = context.get(ceylonContextKey);
        if (ceylonContext == null) {
            CeyloncFileManager fileManager = (CeyloncFileManager) context.get(JavaFileManager.class);
            VFS vfs = new VFS();
            ceylonContext = new com.redhat.ceylon.compiler.typechecker.context.Context(fileManager.getRepositoryManager(), vfs);
            context.put(ceylonContextKey, ceylonContext);
        }
        return ceylonContext;
    }
View Full Code Here

        if (!file.exists()) {
            throw new RuntimeException("Unable to find resource " + name);
        }
        RepositoryManagerBuilder builder = new RepositoryManagerBuilder(new NullLogger(), false, 20000);
        RepositoryManager repoManager = builder.buildRepository();
        VFS vfs = new VFS();
        Context context = new Context(repoManager, vfs);
        PhasedUnits pus = new PhasedUnits(context);
        // Make the module manager think we're looking at this package
        // even though there's no module descriptor
        pus.getModuleManager().push(PKGNAME);
        pus.parseUnit(vfs.getFromFile(file), vfs.getFromFile(new File("test-src")));
        final java.util.List<PhasedUnit> listOfUnits = pus.getPhasedUnits();
       
        PhasedUnit pu = listOfUnits.get(0);
        pu.validateTree();
        pu.scanDeclarations();
View Full Code Here

                System.err.println("DEBUG: "+str);
            }
           
        }, false, (int)com.redhat.ceylon.common.Constants.DEFAULT_TIMEOUT);
        RepositoryManager repoManager = builder.buildRepository();
        VFS vfs = new VFS();
        Context context = new Context(repoManager, vfs);
        moduleManager = new RuntimeModuleManager(context);
        moduleManager.initCoreModules();
        moduleManager.prepareForTypeChecking();
        typeCheckModelToRuntimeModel.clear();
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.typechecker.io.VFS

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.