Package org.teavm.parsing

Examples of org.teavm.parsing.ClasspathClassHolderSource


            TeaVMBuilder vmBuilder = new TeaVMBuilder();
            if (incremental) {
                cacheDirectory.mkdirs();
                symbolTable = new FileSymbolTable(new File(cacheDirectory, "symbols"));
                fileTable = new FileSymbolTable(new File(cacheDirectory, "files"));
                ClasspathClassHolderSource innerClassSource = new ClasspathClassHolderSource(classLoader);
                ClassHolderSource classSource = new PreOptimizingClassHolderSource(innerClassSource);
                cachedClassSource = new DiskCachedClassHolderSource(cacheDirectory, symbolTable, fileTable,
                        classSource, innerClassSource);
                programCache = new DiskProgramCache(cacheDirectory, symbolTable, fileTable, innerClassSource);
                astCache = new DiskRegularMethodNodeCache(cacheDirectory, symbolTable, fileTable, innerClassSource);
                try {
                    symbolTable.update();
                    fileTable.update();
                } catch (IOException e) {
                    log.info("Cache was not read");
                }
                vmBuilder.setClassLoader(classLoader).setClassSource(cachedClassSource);
            } else {
                vmBuilder.setClassLoader(classLoader).setClassSource(new ClasspathClassHolderSource(classLoader));
            }
            vm = vmBuilder.build();
            if (progressListener != null) {
                vm.setProgressListener(progressListener);
            }
View Full Code Here


            resourceToFile(prefix + "/res/tick-small-red.png", "res/tick-small-red.png");
            resourceToFile(prefix + "/res/tick-small.png", "res/tick-small.png");
            resourceToFile(prefix + "/res/toggle-small-expand.png", "res/toggle-small-expand.png");
            resourceToFile(prefix + "/res/toggle-small.png", "res/toggle-small.png");
            resourceToFile(prefix + "/junit.html", "junit.html");
            ClassHolderSource classSource = new ClasspathClassHolderSource(classLoader);
            if (incremental) {
                classSource = new PreOptimizingClassHolderSource(classSource);
            }
            for (String testClass : testClasses) {
                ClassHolder classHolder = classSource.get(testClass);
                if (classHolder == null) {
                    throw new TeaVMToolException("Could not find class " + testClass);
                }
                findTests(classHolder);
            }

            includeAdditionalScripts(classLoader);
            astCache = new EmptyRegularMethodNodeCache();
            if (incremental) {
                astCache = new InMemoryRegularMethodNodeCache();
                programCache = new InMemoryProgramCache();
            }
            File allTestsFile = new File(outputDir, "tests/all.js");
            try (Writer allTestsWriter = new OutputStreamWriter(new FileOutputStream(allTestsFile), "UTF-8")) {
                allTestsWriter.write("prepare = function() {\n");
                allTestsWriter.write("    return new JUnitServer(document.body).readTests([");
                boolean first = true;
                for (String testClass : testClasses) {
                    Collection<MethodReference> methods = groupedMethods.get(testClass);
                    if (methods == null) {
                        continue;
                    }
                    if (!first) {
                        allTestsWriter.append(",");
                    }
                    first = false;
                    allTestsWriter.append("\n        { name : \"").append(testClass).append("\", methods : [");
                    boolean firstMethod = true;
                    for (MethodReference methodRef : methods) {
                        String scriptName = "tests/" + fileNames.size() + ".js";
                        fileNames.put(methodRef, scriptName);
                        if (!firstMethod) {
                            allTestsWriter.append(",");
                        }
                        firstMethod = false;
                        allTestsWriter.append("\n            { name : \"" + methodRef.getName() + "\", script : \"" +
                                scriptName + "\", expected : [");
                        MethodHolder methodHolder = classSource.get(testClass).getMethod(
                                methodRef.getDescriptor());
                        boolean firstException = true;
                        for (String exception : adapter.getExpectedExceptions(methodHolder)) {
                            if (!firstException) {
                                allTestsWriter.append(", ");
View Full Code Here

        URL url = classLoader.getResource("java/lang/Object" + CLASS_SUFFIX);
        String path = url.toString();
        if (!path.startsWith(JAR_PREFIX) || !path.endsWith(JAR_SUFFIX)) {
            throw new RuntimeException("Can't find JCL classes");
        }
        ClasspathClassHolderSource classSource = new ClasspathClassHolderSource(classLoader);
        path = path.substring(JAR_PREFIX.length(), path.length() - JAR_SUFFIX.length());
        File outDir = new File(outputDirectory).getParentFile();
        if (!outDir.exists()) {
            outDir.mkdirs();
        }
View Full Code Here

    ClassHolderSource classSource;
    ClassLoader classLoader;

    public TeaVMBuilder() {
        classLoader = TeaVMBuilder.class.getClassLoader();
        classSource = new ClasspathClassHolderSource(classLoader);
    }
View Full Code Here

TOP

Related Classes of org.teavm.parsing.ClasspathClassHolderSource

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.