Examples of ICompilerConfiguration


Examples of net.flexmojos.oss.compiler.ICompilerConfiguration

    @Test
    public void compilerCfgParse()
        throws Exception
    {
        ICompcConfiguration cfg = mock( ICompcConfiguration.class, RETURNS_NULL );
        ICompilerConfiguration compilerCfg = mock( ICompilerConfiguration.class, RETURNS_NULL );
        IFontsConfiguration fontCfg = mock( IFontsConfiguration.class, RETURNS_NULL );
        ILanguages langsCfg = mock( ILanguages.class, RETURNS_NULL );
        ILanguageRange thaiLangRangeCfg = mock( ILanguageRange.class, RETURNS_NULL );
        ILanguageRange ptLangRangeCfg = mock( ILanguageRange.class, RETURNS_NULL );
        IMetadataConfiguration metadataCfg = mock( IMetadataConfiguration.class, RETURNS_NULL );
        IRuntimeSharedLibraryPath runtimeCfg = mock( IRuntimeSharedLibraryPath.class, RETURNS_NULL );
        Map<String, String> urls = new LinkedHashMap<String, String>();
        urls.put( "http://a.com/rsls/MyLibrary.swf", "http://a.com/rsls/crossdomain.xml" );
        urls.put( "MyLibrary.swf", null );
        IFramesConfiguration frameCfg = mock( IFramesConfiguration.class, RETURNS_NULL );
        IFrame frame = mock( IFrame.class, RETURNS_NULL );
        INamespacesConfiguration namespacesCfg = mock( INamespacesConfiguration.class, RETURNS_NULL );
        INamespace namespace = mock( INamespace.class, RETURNS_NULL );
        INamespace namespace2 = mock( INamespace.class, RETURNS_NULL );
        IDefine define = mock( IDefine.class, RETURNS_NULL );

        when( cfg.getIncludeClasses() ).thenReturn( Arrays.asList( "AClass", "BClass" ) );
        when( cfg.getCompilerConfiguration() ).thenReturn( compilerCfg );
        when( cfg.getMetadataConfiguration() ).thenReturn( metadataCfg );
        when( compilerCfg.getAccessible() ).thenReturn( true );
        when( compilerCfg.getFontsConfiguration() ).thenReturn( fontCfg );
        when( fontCfg.getLanguagesConfiguration() ).thenReturn( langsCfg );
        when( langsCfg.getLanguageRange() ).thenReturn( new ILanguageRange[] { thaiLangRangeCfg, ptLangRangeCfg } );
        when( thaiLangRangeCfg.lang() ).thenReturn( "Thai" );
        when( thaiLangRangeCfg.range() ).thenReturn( "U+0E01-0E5B" );
        when( ptLangRangeCfg.lang() ).thenReturn( "ptBR" );
        when( ptLangRangeCfg.range() ).thenReturn( "U+0A0C-0EAA" );
        when( metadataCfg.getCreator() ).thenReturn( new String[] { "Marvin", "VELO", "Froeder" } );
        when( cfg.getRuntimeSharedLibraryPath() ).thenReturn( new IRuntimeSharedLibraryPath[] { runtimeCfg } );
        when( runtimeCfg.pathElement() ).thenReturn( "MyLibrary.swc" );
        when( runtimeCfg.rslUrl() ).thenReturn( urls );
        when( cfg.getFramesConfiguration() ).thenReturn( frameCfg );
        when( frameCfg.getFrame() ).thenReturn( new IFrame[] { frame } );
        when( frame.label() ).thenReturn( "my-frame" );
        when( frame.classname() ).thenReturn( new String[] { "org.package.1", "org.package.2" } );
        when( compilerCfg.getNamespacesConfiguration() ).thenReturn( namespacesCfg );
        when( namespacesCfg.getNamespace() ).thenReturn( new INamespace[] { namespace, namespace2 } );
        when( namespace.uri() ).thenReturn( "http://www.adobe.com/2006/mxml" );
        when( namespace.manifest() ).thenReturn( "mx-manifest.xml" );
        when( namespace2.uri() ).thenReturn( "library://ns.adobe.com/flex/spark" );
        when( namespace2.manifest() ).thenReturn( "spark-manifest.xml" );
        when( compilerCfg.getDefine() ).thenReturn( new IDefine[] { define } );
        when( define.name() ).thenReturn( "CFG::AAA" );
        when( define.value() ).thenReturn( "true" );

        List<String> args = parser.getArgumentsList( cfg, ICompcConfiguration.class );
View Full Code Here

Examples of net.flexmojos.oss.compiler.ICompilerConfiguration

        when( cfg.getLoadConfig() ).thenReturn( getLoadConfig() );
        when( cfg.getIncludeResourceBundles() ).thenReturn( bundles );
        String output = PathUtil.path( baseRbSwc.getFile() ).replace( baseRbSwc.getClassifier(), rbSwc.getClassifier() );
        when( cfg.getOutput() ).thenReturn( output );

        ICompilerConfiguration compilerCfg = mock( ICompilerConfiguration.class, RETURNS_NULL );
        when( compilerCfg.getTheme() ).thenReturn( Collections.EMPTY_LIST );
        when( compilerCfg.getFontsConfiguration() ).thenReturn( getFontsConfiguration() );
        when( compilerCfg.getLocale() ).thenReturn( new String[] { requestedLocale } );
        when( compilerCfg.getSourcePath() ).thenReturn( new File[] { resourceBundleBaseDir } );
        when( compilerCfg.getExternalLibraryPath() ).thenReturn( this.getExternalLibraryPath() );
        when( compilerCfg.getLibraryPath() ).thenReturn( this.getLibraryPath( false ) );

        when( cfg.getCompilerConfiguration() ).thenReturn( compilerCfg );

        try
        {
View Full Code Here

Examples of net.flexmojos.oss.compiler.ICompilerConfiguration

    public IOptimizerConfiguration getOptimizerConfiguration( File input, File output )
    {
        // mocking real code doesn't seem to be a good idea, but produces a much cleaner code
        IOptimizerConfiguration cfg = mock( IOptimizerConfiguration.class, RETURNS_NULL );
        ICompilerConfiguration compilerCfg = mock( ICompilerConfiguration.class, RETURNS_NULL );
        when( cfg.getLoadConfig() ).thenReturn( getLoadConfig() );
        when( cfg.getInput() ).thenReturn( PathUtil.path( input ) );
        when( cfg.getOutput() ).thenReturn( PathUtil.path( output ) );
        when( cfg.getCompilerConfiguration() ).thenReturn( compilerCfg );
        when( compilerCfg.getKeepAs3Metadata() ).thenReturn( getKeepAs3Metadata() );
        return cfg;
    }
View Full Code Here

Examples of org.aspectj.ajde.core.ICompilerConfiguration

    buildEventNotifier = new AjdeCoreBuildNotifierAdapter(compiler.getBuildProgressMonitor());
    ajBuildManager.setProgressListener(buildEventNotifier);
  }

  private String getFormattedOptionsString() {
    ICompilerConfiguration compilerConfig = compiler.getCompilerConfiguration();
    return "Building with settings: " + "\n-> output paths: "
        + formatCollection(compilerConfig.getOutputLocationManager().getAllOutputLocations()) + "\n-> classpath: "
        + compilerConfig.getClasspath() + "\n-> -inpath " + formatCollection(compilerConfig.getInpath()) + "\n-> -outjar "
        + formatOptionalString(compilerConfig.getOutJar()) + "\n-> -aspectpath "
        + formatCollection(compilerConfig.getAspectPath()) + "\n-> -sourcePathResources "
        + formatMap(compilerConfig.getSourcePathResources()) + "\n-> non-standard options: "
        + compilerConfig.getNonStandardOptions() + "\n-> javaoptions:" + formatMap(compilerConfig.getJavaOptionsMap());
  }
View Full Code Here

Examples of org.aspectj.ajde.core.ICompilerConfiguration

   *
   * @return null if invalid configuration, corresponding AjBuildConfig otherwise
   */
  public AjBuildConfig generateAjBuildConfig() {
    File configFile = new File(compiler.getId());
    ICompilerConfiguration compilerConfig = compiler.getCompilerConfiguration();
    CountingMessageHandler handler = CountingMessageHandler.makeCountingMessageHandler(msgHandlerAdapter);

    String[] args = null;
    // Retrieve the set of files from either an arg file (@filename) or the compiler configuration
    if (configFile.exists() && configFile.isFile()) {
      args = new String[] { "@" + configFile.getAbsolutePath() };
    } else {
      List l = compilerConfig.getProjectSourceFiles();
      if (l == null) {
        return null;
      }
      List xmlfiles = compilerConfig.getProjectXmlConfigFiles();
      if (xmlfiles != null && !xmlfiles.isEmpty()) {
        args = new String[l.size() + xmlfiles.size() + 1];
        // TODO speedup
        int p = 0;
        for (int i = 0; i < l.size(); i++) {
          args[p++] = (String) l.get(i);
        }
        for (int i = 0; i < xmlfiles.size(); i++) {
          args[p++] = (String) xmlfiles.get(i);
        }
        args[p++] = "-xmlConfigured";
      } else {
        args = (String[]) l.toArray(new String[l.size()]);
      }
    }

    BuildArgParser parser = new BuildArgParser(handler);

    AjBuildConfig config = new AjBuildConfig();

    parser.populateBuildConfig(config, args, false, configFile);

    // Process the CLASSPATH
    String propcp = compilerConfig.getClasspath();
    if (propcp != null && propcp.length() != 0) {
      StringTokenizer st = new StringTokenizer(propcp, File.pathSeparator);
      List configClasspath = config.getClasspath();
      ArrayList toAdd = new ArrayList();
      while (st.hasMoreTokens()) {
        String entry = st.nextToken();
        if (!configClasspath.contains(entry)) {
          toAdd.add(entry);
        }
      }
      if (0 < toAdd.size()) {
        ArrayList both = new ArrayList(configClasspath.size() + toAdd.size());
        both.addAll(configClasspath);
        both.addAll(toAdd);
        config.setClasspath(both);
      }
    }

    // Process the OUTJAR
    if (config.getOutputJar() == null) {
      String outJar = compilerConfig.getOutJar();
      if (outJar != null && outJar.length() != 0) {
        config.setOutputJar(new File(outJar));
      }
    }

    // Process the OUTPUT LOCATION MANAGER
    IOutputLocationManager outputLocationManager = compilerConfig.getOutputLocationManager();
    if (config.getCompilationResultDestinationManager() == null && outputLocationManager != null) {
      config.setCompilationResultDestinationManager(new OutputLocationAdapter(outputLocationManager));
    }

    // Process the INPATH
    mergeInto(config.getInpath(), compilerConfig.getInpath());
    // bug 168840 - calling 'setInPath(..)' creates BinarySourceFiles which
    // are used to see if there have been changes in classes on the inpath
    if (config.getInpath() != null) {
      config.setInPath(config.getInpath());
    }

    // Process the SOURCE PATH RESOURCES
    config.setSourcePathResources(compilerConfig.getSourcePathResources());

    // Process the ASPECTPATH
    mergeInto(config.getAspectpath(), compilerConfig.getAspectPath());

    // Process the JAVA OPTIONS MAP
    Map jom = compilerConfig.getJavaOptionsMap();
    if (jom != null) {
      String version = (String) jom.get(CompilerOptions.OPTION_Compliance);
      if (version != null && (version.equals(CompilerOptions.VERSION_1_5) || version.equals(CompilerOptions.VERSION_1_6))) {
        config.setBehaveInJava5Way(true);
      }
      config.getOptions().set(jom);
    }

    // Process the NON-STANDARD COMPILER OPTIONS
    configureNonStandardOptions(config);

    compilerConfig.configurationRead();

    ISourceLocation location = null;
    if (config.getConfigFile() != null) {
      location = new SourceLocation(config.getConfigFile(), 0);
    }
View Full Code Here

Examples of org.aspectj.ajde.core.ICompilerConfiguration

        }
        ajBuildManager.batchBuild(buildConfig, msgHandlerAdapter);
      } else { // INCREMENTAL BUILD
        // Only rebuild the config object if the configuration has changed
        AjBuildConfig buildConfig = null;
        ICompilerConfiguration compilerConfig = compiler.getCompilerConfiguration();
        int changes = compilerConfig.getConfigurationChanges();
        if (changes != ICompilerConfiguration.NO_CHANGES) {

          // What configuration changes can we cope with? And besides just repairing the config object
          // what does it mean for any existing state that we have?

          buildConfig = generateAjBuildConfig();
          if (buildConfig == null) {
            return;
          }
        } else {
          buildConfig = ajBuildManager.getState().getBuildConfig();
          buildConfig.setChanged(changes); // pass it through for the state to use it when making decisions
          buildConfig.setModifiedFiles(compilerConfig.getProjectSourceFilesChanged());
          buildConfig.setClasspathElementsWithModifiedContents(compilerConfig.getClasspathElementsWithModifiedContents());
          compilerConfig.configurationRead();
        }
        ajBuildManager.incrementalBuild(buildConfig, msgHandlerAdapter);
      }
      IncrementalStateManager.recordSuccessfulBuild(compiler.getId(), ajBuildManager.getState());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.