Package org.apache.flex.compiler.targets

Examples of org.apache.flex.compiler.targets.ITargetSettings


    }

    @Override
    protected void setKeepAS3MetadataLinkerSetting(ABCLinkerSettings linkSettings)
    {
        ITargetSettings settings = getTargetSettings();
        Collection<String> metadataNames = getASMetadataNames();
        if (settings.isDebugEnabled() && metadataNames != null)
        {
            Collection<String> names = new ArrayList<String>(metadataNames);
            names.add(IMetaAttributeConstants.ATTRIBUTE_GOTODEFINITIONHELP);
            names.add(IMetaAttributeConstants.ATTRIBUTE_GOTODEFINITION_CTOR_HELP);
            metadataNames = names;
View Full Code Here


        }

        Preconditions.checkNotNull(mainCU,
                "Main compilation unit can't be null");

        ITargetSettings settings = getTargetSettings();
        if (settings != null)
            project.setTargetSettings(settings);

        target = JSSharedData.backend.createTarget(project,
                getTargetSettings(), null);
View Full Code Here

        int result = 0;
        long startTime = System.nanoTime();
       
        if( configure(args) )
        {
            ITargetSettings targetSettings = getTargetSettings();

            final File inputFile = new File(getInputFilePath());
            File outputFile = new File(config.getOutput());
           
            InputStream in = null;
            try
            {
                if( inputFile.exists() )
                {
                    // Read in the SWF
                    in = new BufferedInputStream(new FileInputStream(inputFile));
                    SWFReader reader = new SWFReader();
                    try
                    {
                        ISWF swf = reader.readFrom(in, getInputFilePath());
                        // record any problems encountered reading the swf
                        problems.addAll(reader.getProblems());

                        List<ICompilerProblem> linkProblems = new ArrayList<ICompilerProblem>();
   
                        // do the optimization
                        OptimizerSWFTarget target = new OptimizerSWFTarget(swf, project, targetSettings, null);
                        ISWF optimizedSWF = target.build(linkProblems);

                        // record any problems found
                        problems.addAll(linkProblems);

                        if( !problems.hasErrors() )
                        {
                            Header.Compression compression = Header.decideCompression(true, swf.getVersion(), false);
   
                            final ISWFWriterFactory writerFactory = SWFWriterAndSizeReporter.getSWFWriterFactory(
                                    targetSettings.getSizeReport());
                            final ISWFWriter writer = writerFactory.createSWFWriter(optimizedSWF, compression, targetSettings.isDebugEnabled());
                            int swfSize = writer.writeTo(outputFile);
           
                            long endTime = System.nanoTime();
                            String seconds = String.format("%5.3f", (endTime - startTime) / 1e9);
                            Map<String, Object> params = new HashMap<String, Object>();
View Full Code Here

            return;
        }

        // SWC target will create a SWC model.
        ISWCTarget swcTarget;
        ITargetSettings targetSettings = projectConfigurator.getTargetSettings(TargetType.SWC);
        if (targetSettings == null)
            return;
       
        swcTarget = project.createSWCTarget(targetSettings, null);
        target = (SWFTarget)swcTarget.getLibrarySWFTarget();

        Collection<ICompilerProblem> swcProblems = new ArrayList<ICompilerProblem>();
        final ISWC swc = swcTarget.build(swcProblems);

        problems.addAll(swcProblems);

        // Don't create a SWC if there are errors unless a
        // developer requested otherwise.
        if (!config.getCreateTargetWithErrors() && problems.hasErrors())
            return;
       
        boolean useCompression = targetSettings.useCompression();
        if (config.getOutputSwcAsDirectory())
        {
            final String path = FilenameNormalization.normalize(outputOptionValue);
            final ISWCWriter swcWriter = new SWCDirectoryWriter(path, useCompression,
                    targetSettings.isDebugEnabled(),
                    SWFWriterAndSizeReporter.getSWFWriterFactory(targetSettings.getSizeReport()));
            swcWriter.write(swc);
            long endTime = System.nanoTime();
            String seconds = String.format("%5.3f", (endTime - startTime) / 1e9);
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("path", path);
            params.put("seconds", seconds);
            swcOutputMessage =
                    Messages.getString("COMPC.swc_written_open_directory_in_seconds_format",
                    params);
        }
        else
        {
            final ISWCWriter swcWriter = new SWCWriter(outputOptionValue, useCompression,
                    targetSettings.isDebugEnabled(),
                    SWFWriterAndSizeReporter.getSWFWriterFactory(targetSettings.getSizeReport()));
            swcWriter.write(swc);
            final File outputFile = new File(outputOptionValue);
            long endTime = System.nanoTime();
            String seconds = String.format("%5.3f", (endTime - startTime) / 1e9);
            Map<String, Object> params = new HashMap<String, Object>();
View Full Code Here

    @Override
    protected boolean setupTargetFile() throws InterruptedException
    {
        config.getTargetFile();

        ITargetSettings settings = getTargetSettings();
        if (settings != null)
            project.setTargetSettings(settings);
        else
            return false;
       
View Full Code Here

        result.setUseGPU(unLinked.getUseGPU());
        result.setUseNetwork(unLinked.getUseNetwork());
        result.setVersion(unLinked.getVersion());
        result.setProductInfo(unLinked.getProductInfo());
       
        ITargetSettings settings = getTargetSettings();

        ABCLinker.ABCLinkerSettings linkSettings = new ABCLinker.ABCLinkerSettings();

        linkSettings.setOptimize(settings.isOptimized());
        linkSettings.setEnableInlining(project.isInliningEnabled());
        linkSettings.setStripDebugOpcodes(!settings.isDebugEnabled());
        linkSettings.setStripGotoDefinitionHelp(!settings.isDebugEnabled());
        linkSettings.setStripFileAttributeFromGotoDefinitionHelp(settings.isOptimized());
        linkSettings.setProblemsCollection(this.problemCollection);
        linkSettings.setRemoveDeadCode(settings.getRemoveDeadCode());
       
        Collection<String> metadataNames = getASMetadataNames();
        if (settings.isDebugEnabled() && metadataNames != null)
        {
            Collection<String> names = new ArrayList<String>(metadataNames);
            names.add(IMetaAttributeConstants.ATTRIBUTE_GOTODEFINITIONHELP);
            names.add(IMetaAttributeConstants.ATTRIBUTE_GOTODEFINITION_CTOR_HELP);
            metadataNames = names;
View Full Code Here

    @Override
    protected boolean setupTargetFile() throws InterruptedException
    {
        config.getTargetFile();

        ITargetSettings settings = getTargetSettings();
        if (settings != null)
            project.setTargetSettings(settings);

        target = JSSharedData.backend.createTarget(project,
                getTargetSettings(), null);
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.targets.ITargetSettings

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.