Package flex2.compiler

Examples of flex2.compiler.CompilerSwcContext$Loaded


        {
            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)
        {
            if (Trace.error)
            {
                ex.printStackTrace();
            }
            return FAIL;
        }

        // save the generated cache if the caller provided a libraryCache.
        if (libraryCache != null)
        {
            libraryCache.setSwcCache(data.swcCache);
        }

        data.includes = new HashSet<String>(swcContext.getIncludes());
        data.excludes = new HashSet<String>(swcContext.getExterns());
        localOEMConfiguration.configuration.addExterns( swcContext.getExterns() );
        localOEMConfiguration.configuration.addIncludes( swcContext.getIncludes() );
        data.swcArchiveFiles = new HashMap<String, VirtualFile>(swcContext.getIncludeFiles());
       
        // The ToolsConfiguration expects class names in QName format.
        Set<String> qNameClasses = new HashSet<String>();
        for (String className : classes)
        {
            qNameClasses.add(NameFormatter.toColon(className));
        }

        // Allow -include-classes to override the -external-library-path.
        localOEMConfiguration.configuration.removeExterns(qNameClasses);

        // If we want only inheritance dependencies of -include-classes then
        // add the classes to the includes list. When
        // -include-inheritance-dependencies-only is turned on the dependency
        // walker will ignore all the classes except for the includes.
        if (localOEMConfiguration.configuration.getIncludeInheritanceDependenciesOnly())
        {
            localOEMConfiguration.configuration.addIncludes(qNameClasses);
        }

        data.cmdChecksum = localOEMConfiguration.cfgbuf.checksum_ts();
        data.linkChecksum = localOEMConfiguration.cfgbuf.link_checksum_ts();
        data.swcChecksum = swcContext.checksum();
        int[] checksums = new int[] { 0, data.cmdChecksum, data.linkChecksum, data.swcChecksum };
        boolean clearCache = false;

        // C: must do loadCompilationUnits() after checksum calculation...
        if (!fullRecompile)
View Full Code Here


        }

        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)
        {
            if (Trace.error)
            {
                ex.printStackTrace();
            }
            clean(false /* cleanData */, false /* cleanCache */, false /* cleanOutput */);
            return FAIL;
        }

        // save the generated swcCache if the class has a libraryCache.
        if (libraryCache != null)
        {
            libraryCache.setSwcCache(data.swcCache);
        }

        // If checksum is different, rebuild.
        if (OEMUtil.isRecompilationNeeded(data, swcContext, tempOEMConfiguration))
        {
            if (benchmark != null)
            {
                benchmark.benchmark2("Starting full compile for " + getOutput(), true);
            }

            clean(true /* cleanData */,
                  false /* cleanCache */,
                  false /* cleanOutput */,
                  true /* cleanConfig */,
                  false /* cleanMessages */,
                  false /* cleanThreadLocals */);
            int returnValue = recompile(true, licenseMap, tempOEMConfiguration);

            if (benchmark != null)
            {
                benchmark.benchmark2("Ending full compile for " + getOutput(), true);
            }

            clean(returnValue != OK, false, false);
            return returnValue;
        }

        // If --include-sources is different, rebuild.
        Set<VirtualFile> fileSet = null;
        if ((fileSet = processSources(compilerConfig)) == null)
        {
            clean(false /* cleanData */, false /* cleanCache */, false /* cleanOutput */);
            return FAIL;
        }

        // If --include-stylesheets is different, rebuild.
        fileSet.addAll(processStylesheets());

        boolean isFileSpecDifferent = isDifferent(data.fileSet, fileSet);
        if (isFileSpecDifferent)
        {
            if (benchmark != null)
            {
                benchmark.benchmark2("Starting full compile for " + getOutput(), true);
            }

            clean(true /* cleanData */,
                  false /* cleanCache */,
                  false /* cleanOutput */,
                  true /* cleanConfig */,
                  false /* cleanMessages */,
                  false /* cleanThreadLocals */);
            int returnValue = recompile(true, licenseMap, tempOEMConfiguration);
           
            if (benchmark != null)
            {
                benchmark.benchmark2("Ending full compile for " + getOutput(), true);
            }

            clean(returnValue != OK, false, false);
            return returnValue;
        }

        if (benchmark != null)
        {
            // We aren't really starting the compile here, but it's
            // the earliest that we know that it's going to be an
            // active compilation.
            benchmark.benchmark2("Starting active compile for " + getOutput(), true);
        }

        data.includes = new HashSet<String>(swcContext.getIncludes());
        data.excludes = new HashSet<String>(swcContext.getExterns());
        tempOEMConfiguration.configuration.addExterns( swcContext.getExterns() );
        tempOEMConfiguration.configuration.addIncludes( swcContext.getIncludes() );
        data.swcArchiveFiles = new HashMap<String, VirtualFile>(swcContext.getIncludeFiles());

        // The ToolsConfiguration expects class names in QName format.
        Set<String> qNameClasses = new HashSet<String>();
        for (String className : classes)
        {
            qNameClasses.add(NameFormatter.toColon(className));
        }

        // Allow -include-classes to override the -external-library-path.
        tempOEMConfiguration.configuration.removeExterns(qNameClasses);

        // If we want only inheritance dependencies of -include-classes then
        // add the classes to the includes list. When
        // -include-inheritance-dependencies-only is turned on the dependency
        // walker will ignore all the classes except for the includes.
        if (tempOEMConfiguration.configuration.getIncludeInheritanceDependenciesOnly())
        {
            tempOEMConfiguration.configuration.addIncludes(qNameClasses);
        }
       
        int count = CompilerAPI.validateCompilationUnits(data.fileSpec, data.sourceList, data.sourcePath,
                                                         data.bundlePath, data.resources, swcContext,
                                                         data.classes, data.perCompileData,
                                                         tempOEMConfiguration.configuration);

        Map<String, Source> classes = new TreeMap<String, Source>();
        Set<SwcComponent> nsComponents = null;

        if ((nsComponents = processInputs(swcContext, copy, classes)) == null)
        {
            clean(false /* cleanData */, false /* cleanCache */, false /* cleanOutput */);
            return FAIL;
        }

        // If the other --include-* are different, build incrementally.
        boolean isDifferent = isDifferent(data.classes.keySet(), classes.keySet());
        if (count > 0 || isDifferent || isResourceBundleListDifferent() ||
            data.swcChecksum != swcContext.checksum())
        {
            // create a symbol table
            SymbolTable symbolTable = new SymbolTable(tempOEMConfiguration.configuration, data.perCompileData);
            data.configuration = tempOEMConfiguration.configuration;
            data.nsComponents = nsComponents;
            data.classes = classes;
            data.fileSet = fileSet;
            data.linkChecksum = tempOEMConfiguration.cfgbuf.link_checksum_ts();
            data.swcChecksum = swcContext.checksum();

            // compile
            data.sources = new ArrayList<Source>();
            data.units = compile(compilers, swcContext, symbolTable, mappings, licenseMap, classes, data.sources);

            boolean forcedToStop = CompilerAPI.forcedToStop();
            if (data.units == null || forcedToStop)
            {
                clean(true, false, false);
                return FAIL;
            }
            else
            {
                if (benchmark != null)
                {
                    benchmark.benchmark2("Ending active compile for " + getOutput(), true);
                }
                clean(false /* cleanData */, false /* cleanCache */, false /* cleanOutput */);
                return OK;
            }
        }
        else
        {
            if (benchmark != null)
            {
                benchmark.stopTime(Benchmark.PRECOMPILE, false);
                benchmark.startTime(Benchmark.POSTCOMPILE);
            }

            int retVal = SKIP;
            if (data != null)
            {
                CompilerAPI.displayWarnings(data.units);
                if (data.linkChecksum != tempOEMConfiguration.cfgbuf.link_checksum_ts())
                {
                    retVal = LINK;
                }
            }
            else
            {
                retVal = LINK;
            }
            data.linkChecksum = tempOEMConfiguration.cfgbuf.link_checksum_ts();
            data.swcChecksum = swcContext.checksum();

            if (CompilerAPI.forcedToStop()) retVal = FAIL;

            if (benchmark != null)
            {
View Full Code Here

        try
        {
          OEMUtil.init(OEMUtil.getLogger(null, new ArrayList<Message>()), new MimeMappings(), null, null, null);
         
            CompilerSwcContext swcContext = new CompilerSwcContext();
            SwcCache cache = new SwcCache();

            swcContext.load(toVirtualFiles(libraries),
                  new NameMappings(),
                  ".properties",
                  cache);
           
            info = new LibraryInfoImpl(swcContext, includeBytecodes);
           
            swcContext.close();
        }
        catch (Throwable t)
        {
            if (Trace.error)
            {
View Full Code Here

            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)
            {
                clean(false /* cleanData */,
                      false /* cleanCache */,
                      false /* cleanOutput */,
                      true /* cleanConfig */,
                      false /* cleanMessages */,
                      false /* cleanThreadLocals */);
                return FAIL;
            }
   
            // save the generated cache if the caller provided a libraryCache.
            if (libraryCache != null)
            {
                libraryCache.setSwcCache(data.swcCache);
            }
   
            data.includes = new HashSet<String>(swcContext.getIncludes());
            data.excludes = new HashSet<String>(swcContext.getExterns());
            tempOEMConfiguration.configuration.addExterns( swcContext.getExterns() );
            tempOEMConfiguration.configuration.addIncludes( swcContext.getIncludes() );
            tempOEMConfiguration.configuration.getCompilerConfiguration().addThemeCssFiles( swcContext.getThemeStyleSheets() );
   
            // recompile or incrementally compile...
            if (OEMUtil.isRecompilationNeeded(data, swcContext, tempOEMConfiguration))
            {
                data.resources = new ResourceContainer();
   
                if (benchmark != null)
                {
                    benchmark.benchmark2("Starting full compile for " + getOutput(), true);
                }
   
                clean(true /* cleanData */,
                      false /* cleanCache */,
                      false /* cleanOutput */,
                      true /* cleanConfig */,
                      false /* cleanMessages */,
                      false /* cleanThreadLocals */);
                int returnValue = recompile(true, licenseMap, tempOEMConfiguration);
   
                if (benchmark != null)
                {
                    benchmark.benchmark2("Ending full compile for " + getOutput(), true);
                }
   
                clean(returnValue == FAIL /* cleanData */,
                      false /* cleanCache */,
                      false /* cleanOutput */,
                      true /* cleanConfig */,
                      false /* cleanMessages */,
                      false /* cleanThreadLocals */);
                return returnValue;
            }
   
            if (benchmark != null)
            {
                // We aren't really starting the compile here, but it's
                // the earliest that we know that it's going to be an
                // active compilation.
                benchmark.benchmark2("Starting active compile for " + getOutput(), true);
            }

            boolean relink = false;

            if (applicationCache != null)
            {
                ContextStatics contextStatics = applicationCache.getContextStatics();
                data.perCompileData = contextStatics;

                if (applicationCache.isConsistent(tempOEMConfiguration.configuration))
                {
                    relink = (loadCachedSources(data.resources.sources()) ||
                              loadCachedSources(data.sourceList.sources()) ||
                              loadCachedSources(data.sourcePath.sources()));
                }
                else
                {
                    applicationCache.clear();
                }
            }

            // Clear out ASC's userDefined, so definitions from a
            // previous compilation don't spill over into this one.
            data.perCompileData.userDefined.clear();
   
            data.sourcePath.clearCache();
            data.bundlePath.clearCache();
            data.resources.refresh();
   
            // validate CompilationUnits
            final int count = CompilerAPI.validateCompilationUnits(data.fileSpec, data.sourceList, data.sourcePath, data.bundlePath,
                                                                   data.resources, swcContext, data.perCompileData, tempOEMConfiguration.configuration);
   
            if ((count > 0) || (data.swcChecksum != swcContext.checksum()))
            {
                data.configuration = tempOEMConfiguration.configuration;
                data.linkChecksum = tempOEMConfiguration.cfgbuf.link_checksum_ts();
                data.swcChecksum = swcContext.checksum();
   
                // create a symbol table
                SymbolTable symbolTable = new SymbolTable(tempOEMConfiguration.configuration, data.perCompileData);
   
                data.sources = new ArrayList<Source>();
                data.units = compile(compilers, swcContext, symbolTable, mappings, licenseMap, data.sources);
   
                boolean forcedToStop = CompilerAPI.forcedToStop();
                if (data.units == null || forcedToStop)
                {
                    data.sources = null;
                }

                if (benchmark != null)
                {
                    benchmark.benchmark2("Ending active compile for " + getOutput(), true);
                }
   
                clean(false /* cleanData */,
                      false /* cleanCache */,
                      false /* cleanOutput */,
                      true /* cleanConfig */,
                      false /* cleanMessages */,
                      false /* cleanThreadLocals */);
   
                return (data.units != null && !forcedToStop) ? OK : FAIL;
            }
            else
            {
                if (benchmark != null)
                {
                    benchmark.stopTime(Benchmark.PRECOMPILE, false);
                    benchmark.startTime(Benchmark.POSTCOMPILE);
                }
   
                int retVal = SKIP;
                if (data != null)
                {
                    CompilerAPI.displayWarnings(data.units);
                    if ((data.linkChecksum != tempOEMConfiguration.cfgbuf.link_checksum_ts()) || relink)
                    {
                        retVal = LINK;
                    }
                }
                else
                {
                    retVal = LINK;
                }

                data.linkChecksum = tempOEMConfiguration.cfgbuf.link_checksum_ts();
                data.swcChecksum = swcContext.checksum();
   
                if (benchmark != null)
                {
                    benchmark.benchmark2("Ending active compile for " + getOutput(), true);
                }
View Full Code Here

        {
            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)
        {
            clean(false /* cleanData */,
                  false /* cleanCache */,
                  false /* cleanOutput */,
                  true /* cleanConfig */,
                  false /* cleanMessages */,
                  false /* cleanThreadLocals */);
            return FAIL;
        }

        // save the generated swcCache if the class has a libraryCache.
        if (libraryCache != null)
        {
            libraryCache.setSwcCache(data.swcCache);
        }

        data.includes = new HashSet<String>(swcContext.getIncludes());
        data.excludes = new HashSet<String>(swcContext.getExterns());
        localOEMConfiguration.configuration.addExterns( swcContext.getExterns() );
        localOEMConfiguration.configuration.addIncludes( swcContext.getIncludes() );
        localOEMConfiguration.configuration.getCompilerConfiguration().addThemeCssFiles( swcContext.getThemeStyleSheets() );

        data.cmdChecksum = localOEMConfiguration.cfgbuf.checksum_ts(); // OEMUtil.calculateChecksum(data, swcContext, c);
        data.linkChecksum = localOEMConfiguration.cfgbuf.link_checksum_ts();
        data.swcChecksum = swcContext.checksum();
        int[] checksums = new int[] { 0, data.cmdChecksum, data.linkChecksum, data.swcChecksum };
        boolean relink = false;

        // C: must do loadCompilationUnits() after checksum calculation...
        if (!fullRecompile)
View Full Code Here

    {
      ThreadLocalToolkit.getBenchmark().benchmark(l10n.getLocalizedTextString(new flex2.tools.Mxmlc.InitialSetup()));
    }

    // load SWCs
    CompilerSwcContext swcContext = new CompilerSwcContext();
    SwcCache cache = new SwcCache();
   
    // lazy read should only be set by mxmlc/compc/asdoc
    cache.setLazyRead(true);
    // for asdoc the theme and include-libraries values have been purposely not passed in below.
    swcContext.load( compilerConfig.getLibraryPath(),
                     compilerConfig.getExternalLibraryPath(),
                     null,
                     null,
             mappings,
             I18nUtils.getTranslationFormat(compilerConfig),
             cache );
    configuration.addExterns( swcContext.getExterns() );

    // validate CompilationUnits in FileSpec and SourcePath
    flex2.compiler.CompilerAPI.validateCompilationUnits(fileSpec, sourceList, sourcePath, bundlePath,
                                                            resources, swcContext, null, configuration);
View Full Code Here

    //
    //--------------------------------------------------------------------------
   
    public static int errorCount()
    {
        Logger l = logger.get();
        if (l != null)
        {
            return l.errorCount();
        }
        else
        {
            return 0;
        }
View Full Code Here

        }
    }

    public static int warningCount()
    {
        Logger l = logger.get();
        if (l != null)
        {
            return l.warningCount();
        }
        else
        {
            return 0;
        }
View Full Code Here

        }
    }

    public static void logInfo(String info)
    {
        Logger l = logger.get();
        if (l != null)
        {
            l.logInfo(info);
        }
        else
        {
            System.out.println(info);
        }
View Full Code Here

        }
    }

    public static void logDebug(String debug)
    {
        Logger l = logger.get();
        if (l != null)
        {
            l.logDebug(debug);
        }
        else
        {
            System.err.println(debug);
        }
View Full Code Here

TOP

Related Classes of flex2.compiler.CompilerSwcContext$Loaded

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.