Package flex2.compiler.common

Examples of flex2.compiler.common.CompilerConfiguration


        {
            benchmark.benchmark2(
                    ThreadLocalToolkit.getLocalizationManager().getLocalizedTextString(new BatchTime("start", "")), true);
        }

        CompilerConfiguration config = (configuration != null) ? configuration.getCompilerConfiguration() : null;
        List<Source> targets = new ArrayList<Source>(sources.size());

        units.clear();
        for (int i = 0, size = sources.size(); i < size; i++)
        {
            Source s = sources.get(i);
            if (s != null && s.isCompiled())
            {
                units.add(s.getCompilationUnit());
            }
            else
            {
                units.add(null);
            }
        }

        if (benchmarkCompilingDetails > 4)
        {
            benchmark.benchmark2(
                    ThreadLocalToolkit.getLocalizationManager().getLocalizedTextString(new BatchTime("init units", "")));
        }

        while (nextSource(sources, igraph, dgraph, targets, symbolTable, configuration) > 0)
        {
            int postprocessCount = 0;

            // 1. targets.size() == sources.size()
            // 2. targets.get(i) == sources.get(i) or targets.get(i) == null
            for (int i = 0, size = targets.size(); i < size; i++)
            {
                Source s = targets.get(i);
                if (s == null) continue;

                int w = getCompilationUnitWorkflow(s);

                if ((w & preprocess) == 0)
                {
                    // C: it returns false if it errors. There is no need to catch that. It's okay to
                    //    keep going because findSources() takes into account of errors.
                    preprocess(sources, compilers, i, i + 1, symbolTable.getSuppressWarningsIncremental());

                    if (benchmarkCompilingDetails > 4)
                    {
                        benchmark.benchmark2(
                                ThreadLocalToolkit.getLocalizationManager()
                                .getLocalizedTextString(
                                        new BatchTime("preprocess", s.getNameForReporting())));
                    }
                }
                else if ((w & parse1) == 0)
                {
                    parse1(sources, units, igraph, dgraph, compilers, symbolTable, i, i + 1);
                    resolveInheritance(sources, igraph, dgraph, symbolTable, sourceList, sourcePath, resources, swcContext, i, i + 1);
                    addGeneratedSources(sources, igraph, dgraph, resources, symbolTable, configuration, i, i + 1);

                    if (benchmarkCompilingDetails > 4)
                    {
                        ThreadLocalToolkit.getBenchmark().benchmark2(
                                ThreadLocalToolkit.getLocalizationManager().
                                getLocalizedTextString(
                                        new BatchTime("parse1", s.getNameForReporting())));
                    }
                }
                else if ((w & parse2) == 0)
                {
                    parse2(sources, compilers, symbolTable, i, i + 1);
                    addGeneratedSources(sources, igraph, dgraph, resources, symbolTable, configuration, i, i + 1);

                    if (benchmarkCompilingDetails > 4)
                    {
                        ThreadLocalToolkit.getBenchmark().benchmark2(
                                ThreadLocalToolkit.getLocalizationManager().
                                getLocalizedTextString(
                                        new BatchTime("parse2", s.getNameForReporting())));
                    }
                }
                else if ((w & analyze1) == 0)
                {
                    // analyze1
                    analyze(sources, compilers, symbolTable, i, i + 1, 1);
                    resolveNamespace(sources, igraph, dgraph, symbolTable, sourceList, sourcePath, resources, swcContext, i, i + 1);
                    addGeneratedSources(sources, igraph, dgraph, resources, symbolTable, configuration, i, i + 1);

                    if (benchmarkCompilingDetails > 4)
                    {
                        ThreadLocalToolkit.getBenchmark().benchmark2(
                                ThreadLocalToolkit.getLocalizationManager().
                                getLocalizedTextString(
                                        new BatchTime("analyze1", s.getNameForReporting())));
                    }
                }
                else if ((w & analyze2) == 0)
                {
                    // analyze2
                    analyze(sources, compilers, symbolTable, i, i + 1, 2);
                    resolveType(sources, units, igraph, dgraph, symbolTable, sourceList, sourcePath, resources, swcContext, i, i + 1);

                    if (config.strict())
                    {
                        resolveImportStatements(sources, units, sourcePath, swcContext, i, i + 1);
                    }

                    // C: we don't need this batch1-based memory optimization.
View Full Code Here


        data.configuration = localOEMConfiguration.configuration;
        data.cacheName = cacheName;

        NameMappings mappings = CompilerAPI.getNameMappings(localOEMConfiguration.configuration), copy = mappings.copy();

        CompilerConfiguration compilerConfig = localOEMConfiguration.configuration.getCompilerConfiguration();
        compilerConfig.setMetadataExport(true);

        if (output != null || directory != null)
        {
            OEMUtil.setGeneratedDirectory(compilerConfig, output != null ? output : directory);
        }

        Transcoder[] transcoders = WebTierAPI.getTranscoders( localOEMConfiguration.configuration );
        SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);

        if ((data.fileSet = processSources(compilerConfig)) == null)
        {
            return FAIL;
        }

        data.fileSet.addAll(processStylesheets());

        if (!setupSourceContainers(localOEMConfiguration.configuration, data.fileSet))
        {
            return FAIL;
        }

        // Setup SWC cache
        if (libraryCache != null)
        {
            ContextStatics contextStatics = libraryCache.getContextStatics();

            if (contextStatics != null)
            {
                // Clear out ASC's userDefined, so definitions from a
                // previous compilation don't spill over into this one.
                contextStatics.userDefined.clear();
                data.perCompileData = contextStatics;
                data.swcCache = libraryCache.getSwcCache();
            }
        }

        if (data.swcCache == null)
        {
            data.swcCache = new SwcCache();
        }
       
        // load SWCs
        CompilerSwcContext swcContext = new CompilerSwcContext(true);
        try
        {
            swcContext.load( compilerConfig.getLibraryPath(),
                             compilerConfig.getExternalLibraryPath(),
                             null,
                             compilerConfig.getIncludeLibraries(),
                             mappings,
                             I18nUtils.getTranslationFormat(compilerConfig),
                             data.swcCache );
        }
        catch (SwcException ex)
View Full Code Here

     * @param fileList
     * @return true, unless a CompilerException occurs.
     */
    private boolean setupSourceContainers(flex2.compiler.common.Configuration configuration, Set<VirtualFile> fileSet)
    {
        CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
        VirtualFile[] asClasspath = compilerConfig.getSourcePath();
        boolean result = false;

        try
        {
            // create a SourcePath...
            data.sourcePath = new SourcePath(WebTierAPI.getSourcePathMimeTypes(),
                                             compilerConfig.allowSourcePathOverlap());
            data.sourcePath.addPathElements( asClasspath );

            List<VirtualFile>[] array = CompilerAPI.getVirtualFileList(fileSet, data.sourcePath.getPaths());

            // create a FileSpec...
View Full Code Here

        data.sourcePath.clearCache();
        data.bundlePath.clearCache();
        data.resources.refresh();

        CompilerConfiguration compilerConfig = tempOEMConfiguration.configuration.getCompilerConfiguration();
        compilerConfig.setMetadataExport(true);

        if (output != null || directory != null)
        {
            OEMUtil.setGeneratedDirectory(compilerConfig, output != null ? output : directory);
        }

        Transcoder[] transcoders = WebTierAPI.getTranscoders(tempOEMConfiguration.configuration);
        SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);
       
        CompilerSwcContext swcContext = new CompilerSwcContext(true);
        try
        {
            swcContext.load( compilerConfig.getLibraryPath(),
                             compilerConfig.getExternalLibraryPath(),
                             null,
                             compilerConfig.getIncludeLibraries(),
                             mappings,
                             I18nUtils.getTranslationFormat(compilerConfig),
                             data.swcCache );
        }
        catch (SwcException ex)
View Full Code Here

            if (tooManyErrors() || forcedToStop()) break;

            resolveType(sources, units, igraph, dgraph, symbolTable, sourceList, sourcePath, resources, swcContext);

            final CompilerConfiguration config = (configuration != null) ? configuration.getCompilerConfiguration() : null;
            if (config != null && config.strict())
            {
                resolveImportStatements(sources, units, sourcePath, swcContext);
            }

            // C: If --coach is turned on, do resolveExpression() here...
            if (config != null && (config.strict() || config.warnings()))
            {
                resolveExpression(sources, units, igraph, dgraph, symbolTable, sourceList,
                                  sourcePath, resources, swcContext, configuration);
            }
View Full Code Here

        {
            benchmark.benchmark2(
                    ThreadLocalToolkit.getLocalizationManager().getLocalizedTextString(new BatchTime("start", "")), true);
        }

        CompilerConfiguration config = (configuration != null) ? configuration.getCompilerConfiguration() : null;
        List<Source> targets = new ArrayList<Source>(sources.size());

        units.clear();
        for (int i = 0, size = sources.size(); i < size; i++)
        {
            Source s = sources.get(i);
            if (s != null && s.isCompiled())
            {
                units.add(s.getCompilationUnit());
            }
            else
            {
                units.add(null);
            }
        }

        if (benchmarkCompilingDetails > 4)
        {
            benchmark.benchmark2(
                    ThreadLocalToolkit.getLocalizationManager().getLocalizedTextString(new BatchTime("init units", "")));
        }

        while (nextSource(sources, igraph, dgraph, targets, symbolTable, configuration) > 0)
        {
            int postprocessCount = 0;

            // 1. targets.size() == sources.size()
            // 2. targets.get(i) == sources.get(i) or targets.get(i) == null
            for (int i = 0, size = targets.size(); i < size; i++)
            {
                Source s = targets.get(i);
                if (s == null) continue;

                int w = getCompilationUnitWorkflow(s);

                if ((w & preprocess) == 0)
                {
                    // C: it returns false if it errors. There is no need to catch that. It's okay to
                    //    keep going because findSources() takes into account of errors.
                    preprocess(sources, compilers, i, i + 1, symbolTable.getSuppressWarningsIncremental());

                    if (benchmarkCompilingDetails > 4)
                    {
                        benchmark.benchmark2(
                                ThreadLocalToolkit.getLocalizationManager()
                                .getLocalizedTextString(
                                        new BatchTime("preprocess", s.getNameForReporting())));
                    }
                }
                else if ((w & parse1) == 0)
                {
                    parse1(sources, units, igraph, dgraph, compilers, symbolTable, i, i + 1);
                    resolveInheritance(sources, igraph, dgraph, symbolTable, sourceList, sourcePath, resources, swcContext, i, i + 1);
                    addGeneratedSources(sources, igraph, dgraph, resources, symbolTable, configuration, i, i + 1);

                    if (benchmarkCompilingDetails > 4)
                    {
                        ThreadLocalToolkit.getBenchmark().benchmark2(
                                ThreadLocalToolkit.getLocalizationManager().
                                getLocalizedTextString(
                                        new BatchTime("parse1", s.getNameForReporting())));
                    }
                }
                else if ((w & parse2) == 0)
                {
                    parse2(sources, compilers, symbolTable, i, i + 1);
                    addGeneratedSources(sources, igraph, dgraph, resources, symbolTable, configuration, i, i + 1);

                    if (benchmarkCompilingDetails > 4)
                    {
                        ThreadLocalToolkit.getBenchmark().benchmark2(
                                ThreadLocalToolkit.getLocalizationManager().
                                getLocalizedTextString(
                                        new BatchTime("parse2", s.getNameForReporting())));
                    }
                }
                else if ((w & analyze1) == 0)
                {
                    // analyze1
                    analyze(sources, compilers, symbolTable, i, i + 1, 1);
                    resolveNamespace(sources, igraph, dgraph, symbolTable, sourceList, sourcePath, resources, swcContext, i, i + 1);
                    addGeneratedSources(sources, igraph, dgraph, resources, symbolTable, configuration, i, i + 1);

                    if (benchmarkCompilingDetails > 4)
                    {
                        ThreadLocalToolkit.getBenchmark().benchmark2(
                                ThreadLocalToolkit.getLocalizationManager().
                                getLocalizedTextString(
                                        new BatchTime("analyze1", s.getNameForReporting())));
                    }
                }
                else if ((w & analyze2) == 0)
                {
                    // analyze2
                    analyze(sources, compilers, symbolTable, i, i + 1, 2);
                    resolveType(sources, units, igraph, dgraph, symbolTable, sourceList, sourcePath, resources, swcContext, i, i + 1);

                    if (config.strict())
                    {
                        resolveImportStatements(sources, units, sourcePath, swcContext, i, i + 1);
                    }

                    // C: we don't need this batch1-based memory optimization.
View Full Code Here

        {
            result = false;
        }
        else if (this.configuration != null)
        {
            CompilerConfiguration compilerConfiguration = configuration.getCompilerConfiguration();
            CompilerConfiguration cacheCompilerConfiguration = this.configuration.getCompilerConfiguration();

            if (compilerConfiguration.strict() != cacheCompilerConfiguration.strict())
            {
                result = false;
            }

            if (result && (compilerConfiguration.dialect() != cacheCompilerConfiguration.dialect()))
            {
                result = false;
            }

            if (result && configuration.getTargetPlayerTargetAVM() != this.configuration.getTargetPlayerTargetAVM())
            {
                result = false;
            }

            if (result && (compilerConfiguration.debug() != cacheCompilerConfiguration.debug()))
            {
                result = false;
            }

            if (result && (compilerConfiguration.omitTraceStatements() != cacheCompilerConfiguration.omitTraceStatements()))
            {
                result = false;
            }

            if (result && (compilerConfiguration.accessible() != cacheCompilerConfiguration.accessible()))
            {
                result = false;
            }

            ObjectList<ConfigVar> define = compilerConfiguration.getDefine();
            ObjectList<ConfigVar> cacheDefine = cacheCompilerConfiguration.getDefine();
                   
            if (result && !define.equals(cacheDefine))
            {
                result = false;
            }

            if (result && (compilerConfiguration.verboseStacktraces() != cacheCompilerConfiguration.verboseStacktraces()))
            {
                result = false;
            }

            if (result && !ApplicationCache.<String>equals(compilerConfiguration.getKeepAs3Metadata(),
                                                           cacheCompilerConfiguration.getKeepAs3Metadata()))
            {
                result = false;
            }

            if (result && (compilerConfiguration.keepGeneratedActionScript() != cacheCompilerConfiguration.keepGeneratedActionScript()))
            {
                result = false;
            }

            if (result && (compilerConfiguration.enableRuntimeDesignLayers() != cacheCompilerConfiguration.enableRuntimeDesignLayers()))
            {
                result = false;
            }

            if (result && !ApplicationCache.<String>equals(compilerConfiguration.getLocales(),
                                                           cacheCompilerConfiguration.getLocales()))
            {
                result = false;
            }

            if (result && !compilerConfiguration.getThemeNames().equals(cacheCompilerConfiguration.getThemeNames()))
            {
                result = false;
            }

            if (result && !ApplicationCache.<VirtualFile>equals(compilerConfiguration.getSourcePath(),
                                                                cacheCompilerConfiguration.getSourcePath()))
            {
                result = false;
            }
        }
View Full Code Here

     * @return true, unless a CompilerException occurs.
     */
    private boolean setupSourceContainers(OEMConfiguration localOEMConfiguration)
    {
        ToolsConfiguration configuration = localOEMConfiguration.configuration;
        CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
        VirtualFile[] asClasspath = compilerConfig.getSourcePath();
        boolean result = false;

        try
        {
            // If there are no files that means this is a resource module and this
            // is the first time compiling the module.  When the
            // ApplicationCompilerConfiguration was generated the validate() would
            // have failed if there were no source files and no included resource
            // bundles.  See ApplicationCompilerConfiguration.getTargetFile() to
            // see how the resource module is initially generated.
            if (files.size() == 0)
            {
                ApplicationCompilerConfiguration acc = (ApplicationCompilerConfiguration)localOEMConfiguration.configuration;
                files.add(CompilerAPI.getVirtualFile(acc.getTargetFile(), true));
                isGeneratedTargetFile = true;
            }
            else if (isGeneratedTargetFile)
            {
                // The resource module file has already been generated but we need to
                // regenerate it to do a fresh compile.  This file is impacted if
                // either the locales or bundleNames have changed.
                I18nUtils.regenerateResourceModule((ApplicationCompilerConfiguration)localOEMConfiguration.configuration);
            }

            VirtualFile targetFile = (VirtualFile) files.get(files.size() - 1);

            WebTierAPI.checkSupportedTargetMimeType(targetFile);

            // create a FileSpec...
            data.fileSpec = new FileSpec(Collections.<VirtualFile>emptyList(), WebTierAPI.getFileSpecMimeTypes());

            // create a SourceList
            data.sourceList = new SourceList(files, asClasspath, targetFile, WebTierAPI.getSourcePathMimeTypes());

            // create a SourcePath...
            data.sourcePath = new SourcePath(asClasspath, targetFile, WebTierAPI.getSourcePathMimeTypes(),
                                             compilerConfig.allowSourcePathOverlap());

            // create a ResourceContainer...
            data.resources = new ResourceContainer();

            if (applicationCache != null)
View Full Code Here

                return returnValue;
            }

            CompilerAPI.setupHeadless(tempOEMConfiguration.configuration);
   
            CompilerConfiguration compilerConfig = tempOEMConfiguration.configuration.getCompilerConfiguration();
            NameMappings mappings = CompilerAPI.getNameMappings(tempOEMConfiguration.configuration);
   
            Transcoder[] transcoders = WebTierAPI.getTranscoders(tempOEMConfiguration.configuration);
            SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);
   
            CompilerSwcContext swcContext = new CompilerSwcContext(true);
            try
            {
                swcContext.load( compilerConfig.getLibraryPath(),
                                 flex2.compiler.common.Configuration.getAllExcludedLibraries(compilerConfig, tempOEMConfiguration.configuration),
                                 compilerConfig.getThemeFiles(),
                                 compilerConfig.getIncludeLibraries(),
                                 mappings,
                                 I18nUtils.getTranslationFormat(compilerConfig),
                                 data.swcCache );
            }
            catch (SwcException ex)
View Full Code Here

        data.configuration = localOEMConfiguration.configuration;
        data.cacheName = cacheName;

        CompilerAPI.setupHeadless(localOEMConfiguration.configuration);

        CompilerConfiguration compilerConfig = localOEMConfiguration.configuration.getCompilerConfiguration();
        NameMappings mappings = CompilerAPI.getNameMappings(localOEMConfiguration.configuration);
        data.fontManager = compilerConfig.getFontsConfiguration().getTopLevelManager();

        if (output != null)
        {
            OEMUtil.setGeneratedDirectory(compilerConfig, output);
        }

        Transcoder[] transcoders = WebTierAPI.getTranscoders(localOEMConfiguration.configuration);
        SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);

        // NOT in compile
        if (!setupSourceContainers(localOEMConfiguration))
        {
            clean(true /* cleanData */,
                  false /* cleanCache */,
                  false /* cleanOutput */,
                  true /* cleanConfig */,
                  false /* cleanMessages */,
                  false /* cleanThreadLocals */);
            return FAIL;
        }

        // Setup SWC cache
        if (libraryCache != null)
        {
            ContextStatics contextStatics = libraryCache.getContextStatics();

            if (contextStatics != null)
            {
                // Clear out ASC's userDefined, so definitions from a
                // previous compilation don't spill over into this one.
                contextStatics.userDefined.clear();
                data.swcCache = libraryCache.getSwcCache();
                data.perCompileData = contextStatics;
            }
        }

        if (data.swcCache == null)
        {
            data.swcCache = new SwcCache();
        }
       
        // load SWCs
        CompilerSwcContext swcContext = new CompilerSwcContext(true);
        try
        {
            swcContext.load( compilerConfig.getLibraryPath(),
                             flex2.compiler.common.Configuration.getAllExcludedLibraries(compilerConfig, localOEMConfiguration.configuration),
                             compilerConfig.getThemeFiles(),
                             compilerConfig.getIncludeLibraries(),
                             mappings,
                             I18nUtils.getTranslationFormat(compilerConfig),
                             data.swcCache );
        }
        catch (SwcException ex)
View Full Code Here

TOP

Related Classes of flex2.compiler.common.CompilerConfiguration

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.