Package flex2.tools.oem

Examples of flex2.tools.oem.Library


                File tmpFile = File.createTempFile("mbcompiler", ".xml");
                BufferedWriter bw = new BufferedWriter(new FileWriter(tmpFile));
                bw.write(config);
                bw.close();
               
                Configuration conf = job.app.getDefaultConfiguration();
                conf.addConfiguration(tmpFile);
                job.app.setConfiguration(conf);
              }
             
              File outFile = new File(outPath);
              File outDir = new File(outFile.getParent());
View Full Code Here


  public static void run(OEMConsole console, String[] args)
        throws ConfigurationException, IOException, URISyntaxException
  {
      ThreadLocalToolkit.setLogger(console);
       
    final Library lib = new Library();
    lib.setLogger(console);
    OEMConfiguration c1 = (OEMConfiguration) lib.getDefaultConfiguration();
    CompcConfiguration c2 = getCompcConfiguration(args);
    OEMConfiguration c3 = new OEMConfiguration(null, c2);
    c1.importDefaults(c3);
    lib.setConfiguration(c1);
 
    // transfer the value of compute-digest from CompcConfiguration to OEMConfiguration.
    c1.enableDigestComputation(c2.getComputeDigest());
   
    for (Iterator i = c2.getClasses().iterator(); i.hasNext(); )
    {
      lib.addComponent((String) i.next());
    }
   
    List fileList = flex2.compiler.CompilerAPI.getVirtualFileList(c2.getIncludeSources(),
                                new HashSet<String>(Arrays.asList(flex2.tools.WebTierAPI.getSourcePathMimeTypes())));

    for (Iterator i = fileList.iterator(); i.hasNext(); )
    {
      lib.addComponent(new File(((VirtualFile) i.next()).getName()));
    }

    Map ss = c2.getStylesheets();
    for (Iterator i = ss.keySet().iterator(); i.hasNext(); )
    {
      String key = (String) i.next();
      lib.addStyleSheet(key, new File(((VirtualFile) ss.get(key)).getName()));
    }

    for (Iterator i = c2.getIncludeResourceBundles().iterator(); i.hasNext(); )
    {
      lib.addResourceBundle((String) i.next());
    }

    for (Iterator i = c2.getNamespaces().iterator(); i.hasNext(); )
    {
      lib.addComponent(new URI((String) i.next()));
    }
   
    Map m = c2.getFiles();
    for (Iterator i = m.keySet().iterator(); i.hasNext(); )
    {
      String key = (String) i.next();
      lib.addArchiveFile(key, new File(((VirtualFile) m.get(key)).getName()));
    }
       
        try
    {
            lib.load(new BufferedInputStream(new FileInputStream(new File(c2.getOutput() + ".incr"))));
            // load() wipes out our ThreadLocal and we lose our logger
            ThreadLocalToolkit.setLogger(console);
    }
    catch (IOException ex)
    {
    }
       
    long size = 0;
    if ((size = lib.build(new BufferedOutputStream(new FileOutputStream(new File(c2.getOutput()))), true)) == 0)
    {
            ThreadLocalToolkit.logError("Build unsuccessful.");
    }
    else
    {
      System.out.println(c2.getOutput() + " (" + size + " bytes)");
        if (c2.generateRBList() && c2.getRBListFileName() != null)
        {
          Report r = lib.getReport();
          String[] rbNames = r.getResourceBundleNames();
          HashSet<String> set = new HashSet<String>();
          for (int i = 0, l = rbNames == null ? 0 : rbNames.length; i < l; i++)
          {
            set.add(rbNames[i]);
          }
          String list = FlexMovie.dumpRBList(set);
          FileUtil.writeFile(c2.getRBListFileName(), list);
        }

    }

    lib.save(new BufferedOutputStream(new FileOutputStream(new File(c2.getOutput() + ".incr"))));   
    lib.clean();
  }
View Full Code Here

    {
      List<Message> filtered = new ArrayList<Message>();
     
      for (int i = 0, length = messages.size(); i < length; i++)
      {
        Message m = messages.get(i);
        if (m != null && !Message.INFO.equals(m.getLevel()))
        {
          filtered.add(m);
        }
      }
     
View Full Code Here

    final ProgressHelper ph = new ProgressHelper();
   
    //we output 101 chars so we can track progress without sending actual data
    response.setContentLength(101);
   
    String log = CompileManager.inst().compile(xml, new ProgressMeter() {
     
      public void start() { }
     
      public void percentDone(int p) {
        ph.set(p);
View Full Code Here

  }
 
  protected int compile(boolean incremental)
  {
    //File dumpConfigFile = null;
    OEMConfiguration config = null;
   
        // step over special-cased configuration options:
        //     FlexBuilder exposes some compiler options as UI (such as a checkbox for accessibility)
        //     and other compiler options like -help have no meaning when used in FB (since you press F1...)
        //     FB serialzes these and gives it to us as a commandline in OEMConfiguration.extra
        //     So we need to parse those...
    if (c != null)
    {
      String[] args = c.extra;
      if (args != null && args.length > 0)
      {
        config = (OEMConfiguration) c.configuration;
        if (config != null)
        {
          ConfigurationBuffer cfgbuf = OEMUtil.getCompcConfigurationBuffer(OEMUtil.getLogger(getLogger(), null), resolver, args);
          if (cfgbuf == null)
          {
            return -1;
          }
         
          List positions = cfgbuf.getPositions();
          for (int i = 0, length = positions.size(); i < length; i++)
          {
            Object[] a = (Object[]) positions.get(i);
            String var = (String) a[0];   
           
            if ("link-report".equals(var))
            {
              config.keepLinkReport(true);
            }
            else if ("compiler.debug".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                String debugPassword = cfgbuf.peekSimpleConfigurationVar("debug-password");
                if ("true".equals(value))
                {
                  config.enableDebugging(true, debugPassword);
                }
                else if ("false".equals(value))
                {
                  config.enableDebugging(false, debugPassword);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("compiler.verbose-stacktraces".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.enableVerboseStacktraces(true);
                }
                else if ("false".equals(value))
                {
                  config.enableVerboseStacktraces(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }             
            }
            else if ("compiler.accessible".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.enableAccessibility(true);
                }
                else if ("false".equals(value))
                {
                  config.enableAccessibility(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("compiler.strict".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.enableStrictChecking(true);
                }
                else if ("false".equals(value))
                {
                  config.enableStrictChecking(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("help".equals(var))
            {
              // do nothing
            }
            else if ("output".equals(var))
            {
              try
              {
                String isDirectory = cfgbuf.peekSimpleConfigurationVar("directory");
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(isDirectory))
                {
                  setDirectory(new File(value));
                }
                else
                {
                  setOutput(new File(value));
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("size-report".equals(var))
            {
              config.keepSizeReport(true);
            }
            else if ("directory".equals(var))
            {
              // do nothing
            }
            else if ("version".equals(var))
            {
              // do nothing
            }
            else if ("include-classes".equals(var))
            {
              try
              {
                List l = cfgbuf.peekConfigurationVar(var);
                for (int j = 0, len = l == null ? 0 : l.size(); j < len; j++)
                {
                  ConfigurationValue val = (ConfigurationValue) l.get(j);
                  List valArgs = val.getArgs();
                  for (int k = 0, size = valArgs == null ? 0 : valArgs.size(); k < size; k++)
                  {
                    this.addComponent((String) valArgs.get(k));
                  }
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("include-file".equals(var))
            {
              try
              {
                List l = cfgbuf.peekConfigurationVar(var);
                for (int j = 0, len = l == null ? 0 : l.size(); j < len; j++)
                {
                  ConfigurationValue val = (ConfigurationValue) l.get(j);
                  List valArgs = val.getArgs();
                  this.addArchiveFile((String) valArgs.get(0), new File((String) valArgs.get(1)));
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("include-namespaces".equals(var))
            {
              try
              {
                List l = cfgbuf.peekConfigurationVar(var);
                for (int j = 0, len = l == null ? 0 : l.size(); j < len; j++)
                {
                  ConfigurationValue val = (ConfigurationValue) l.get(j);
                  List valArgs = val.getArgs();
                  for (int k = 0, size = valArgs == null ? 0 : valArgs.size(); k < size; k++)
                  {
                    try
                    {
                      this.addComponent(new URI((String) valArgs.get(k)));
                    }
                    catch (URISyntaxException ex)
                    {
                      ex.printStackTrace();
                    }
                  }
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("include-resource-bundles".equals(var))
            {
              try
              {
                List l = cfgbuf.peekConfigurationVar(var);
                for (int j = 0, len = l == null ? 0 : l.size(); j < len; j++)
                {
                  ConfigurationValue val = (ConfigurationValue) l.get(j);
                  List valArgs = val.getArgs();
                  for (int k = 0, size = valArgs == null ? 0 : valArgs.size(); k < size; k++)
                  {
                    this.addResourceBundle((String) valArgs.get(k));
                  }
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("include-sources".equals(var))
            {
              try
              {
                List l = cfgbuf.peekConfigurationVar(var);
                for (int j = 0, len = l == null ? 0 : l.size(); j < len; j++)
                {
                  ConfigurationValue val = (ConfigurationValue) l.get(j);
                  List valArgs = val.getArgs();
                  for (int k = 0, size = valArgs == null ? 0 : valArgs.size(); k < size; k++)
                  {
                    this.addComponent(new File((String) valArgs.get(k)));
                  }
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
          }

          config.setConfiguration(OEMUtil.trim(args, cfgbuf, excludes));
          // c.extra = null;
        }
      }
    }
   
View Full Code Here

  }
 
  protected int compile(boolean incremental)
  {
    //File dumpConfigFile = null;
    OEMConfiguration config = null;
   
        // step over special-cased configuration options:
        //     FlexBuilder exposes some compiler options as UI (such as a checkbox for accessibility)
        //     and other compiler options like -help have no meaning when used in FB (since you press F1...)
        //     FB serialzes these and gives it to us as a commandline in OEMConfiguration.extra
        //     So we need to parse those...
    if (c != null)
    {
      String[] args = c.extra;
      if (args != null && args.length > 0)
      {
        config = (OEMConfiguration) c.configuration;
        if (config != null)
        {
          ConfigurationBuffer cfgbuf = OEMUtil.getCommandLineConfigurationBuffer(OEMUtil.getLogger(getLogger(), null), resolver, args);
          if (cfgbuf == null)
          {
            return -1;
          }
         
          List positions = cfgbuf.getPositions();
          for (int i = 0, length = positions.size(); i < length; i++)
          {
            Object[] a = (Object[]) positions.get(i);
            String var = (String) a[0];
           
            if ("link-report".equals(var))
            {
              config.keepLinkReport(true);
            }
            else if ("compiler.debug".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                String debugPassword = cfgbuf.peekSimpleConfigurationVar("debug-password");
                if ("true".equals(value))
                {
                  config.enableDebugging(true, debugPassword);
                }
                else if ("false".equals(value))
                {
                  config.enableDebugging(false, debugPassword);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("compiler.verbose-stacktraces".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.enableVerboseStacktraces(true);
                }
                else if ("false".equals(value))
                {
                  config.enableVerboseStacktraces(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }             
            }
            else if ("compiler.accessible".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.enableAccessibility(true);
                }
                else if ("false".equals(value))
                {
                  config.enableAccessibility(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("compiler.strict".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.enableStrictChecking(true);
                }
                else if ("false".equals(value))
                {
                  config.enableStrictChecking(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("help".equals(var))
            {
              // do nothing
            }
            else if ("output".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                setOutput(new File(value));
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("size-report".equals(var))
            {
              config.keepSizeReport(true);
            }
            else if ("version".equals(var))
            {
              // do nothing
            }
            else if ("warnings".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.showActionScriptWarnings(true);
                  config.showBindingWarnings(true);
                  config.showDeprecationWarnings(true);
                  config.showUnusedTypeSelectorWarnings(true);
                }
                else if ("false".equals(value))
                {
                  config.showActionScriptWarnings(false);
                  config.showBindingWarnings(false);
                  config.showDeprecationWarnings(false);
                  config.showUnusedTypeSelectorWarnings(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("compiler.show-actionscript-warnings".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.showActionScriptWarnings(true);
                }
                else if ("false".equals(value))
                {
                  config.showActionScriptWarnings(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("compiler.show-deprecation-warnings".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.showDeprecationWarnings(true);
                }
                else if ("false".equals(value))
                {
                  config.showDeprecationWarnings(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
                        else if ("compiler.show-shadowed-device-font-warnings".equals(var))
                        {
                            try
                            {
                                String value = cfgbuf.peekSimpleConfigurationVar(var);
                                if ("true".equals(value))
                                {
                                    config.showShadowedDeviceFontWarnings(true);
                                }
                                else if ("false".equals(value))
                                {
                                    config.showShadowedDeviceFontWarnings(false);
                                }
                            }
                            catch (ConfigurationException ex)
                            {
                            }
                        }
                        else if ("compiler.show-binding-warnings".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.showBindingWarnings(true);
                }
                else if ("false".equals(value))
                {
                  config.showBindingWarnings(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
            else if ("compiler.show-unused-type-selector-warnings".equals(var))
            {
              try
              {
                String value = cfgbuf.peekSimpleConfigurationVar(var);
                if ("true".equals(value))
                {
                  config.showUnusedTypeSelectorWarnings(true);
                }
                else if ("false".equals(value))
                {
                  config.showUnusedTypeSelectorWarnings(false);
                }
              }
              catch (ConfigurationException ex)
              {
              }
            }
          }

          config.setConfiguration(OEMUtil.trim(args, cfgbuf, excludes));
          // c.extra = null;
        }
      }
    }
   
View Full Code Here

        try
        {
        messages.clear();

        // if there is no configuration, use the default... but don't populate this.configuration.
        OEMConfiguration tempOEMConfiguration;

        if (oemConfiguration == null)
        {
            tempOEMConfiguration = (OEMConfiguration) getDefaultConfiguration(true);
        }
View Full Code Here

        try
        {
            messages.clear();
   
            // if there is no configuration, use the default... but don't populate this.configuration.
            OEMConfiguration tempOEMConfiguration;
            if (oemConfiguration == null)
            {
                tempOEMConfiguration = (OEMConfiguration) getDefaultConfiguration(true);
            }
            else
View Full Code Here

     * @inheritDoc
     */
    public Report getReport()
    {
        //OEMUtil.setupLocalizationManager();
        return new OEMReport(null,
                             null,
                             null,
                             null,
                             configurationReport,
                             messages, files);
View Full Code Here

     * @inheritDoc
     */
    public Report getReport()
    {
        //OEMUtil.setupLocalizationManager();
        return new OEMReport( sources,
                              movie,
                              null,
                              sourceList,
                             configurationReport,
                             messages);
View Full Code Here

TOP

Related Classes of flex2.tools.oem.Library

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.