Package net.sf.antcontrib.cpptasks.compiler

Examples of net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration


    public void visit(File parentDir, String filename) throws BuildException {
        File fullPath = new File(parentDir, filename);
        //
        //   see if any processor wants to bid
        //       on this one
        ProcessorConfiguration selectedCompiler = null;
        int bid = 0;
        if (processors != null) {
            for (int k = 0; k < processors.length; k++) {
                int newBid = processors[k].bid(fullPath.toString());
                if (newBid > bid) {
                    bid = newBid;
                    selectedCompiler = processors[k];
                }
            }
        }
        //
        //   no processor interested in file
        //      log diagnostic message
        if (bid <= 0) {
            if (linker != null) {
                int linkerbid = linker.bid(filename);
                if (linkerbid > 0) {
                    objectFiles.addElement(fullPath);
                    if (linkerbid == 1) {
                        task.log("Unrecognized file type " + fullPath.toString()
                                + " will be passed to linker");
                    }
                }
            }
        } else {
            //
            //  get output file name
            //
            String[] outputFileNames = selectedCompiler
                    .getOutputFileNames(filename, versionInfo);
            sourceFiles[0] = fullPath;
            //
            //   if there is some output for this task
            //      (that is a source file and not an header file)
            //
            for (int i = 0; i < outputFileNames.length; i++) {
                //
                //   see if the same output file has already been registered
                //
                TargetInfo previousTarget = (TargetInfo) targets
                        .get(outputFileNames[i]);
                if (previousTarget == null) {
                    targets.put(outputFileNames[i], new TargetInfo(
                            selectedCompiler, sourceFiles, null, new File(
                                    outputDir, outputFileNames[i]),
                            selectedCompiler.getRebuild()));
                } else {
                    if (!previousTarget.getSources()[0].equals(sourceFiles[0])) {
                        StringBuffer builder = new StringBuffer(
                                "Output filename conflict: ");
                        builder.append(outputFileNames[i]);
View Full Code Here


            Vector objectFiles, Vector sysObjectFiles, VersionInfo versionInfo) {
        //
        //    find the first eligible linker
        //
        //
        ProcessorConfiguration linkerConfig = null;
        LinkerDef selectedLinkerDef = null;
        Linker selectedLinker = null;
        Hashtable sysLibraries = new Hashtable();
        TargetDef targetPlatform = getTargetPlatform();
        FileVisitor objCollector = null;
View Full Code Here

        Vector biddingProcessors = new Vector(_compilers.size());
        for (int i = 0; i < _compilers.size(); i++) {
            CompilerDef currentCompilerDef = (CompilerDef) _compilers
                    .elementAt(i);
            if (currentCompilerDef.isActive()) {
                ProcessorConfiguration config = currentCompilerDef
                        .createConfiguration(this, linkType, compilerDef,
                            targetPlatform, versionInfo);
                //
                //   see if this processor had a precompile child element
                //
                PrecompileDef precompileDef = currentCompilerDef
                        .getActivePrecompile(compilerDef);
                ProcessorConfiguration[] localConfigs = new ProcessorConfiguration[]{config};
                //
                //    if it does then
                //
                if (precompileDef != null) {
                    File prototype = precompileDef.getPrototype();
                    //
                    //  will throw exceptions if prototype doesn't exist, etc
                    //
                    if (!prototype.exists()) {
                        throw new BuildException("prototype ("
                                + prototype.toString() + ") does not exist.");
                    }
                    if (prototype.isDirectory()) {
                        throw new BuildException("prototype ("
                                + prototype.toString() + ") is a directory.");
                    }
                    String[] exceptFiles = precompileDef.getExceptFiles();
                    //
                    //  create a precompile building and precompile using
                    //      variants of the configuration
                    //      or return null if compiler doesn't support
                    //      precompilation
                    CompilerConfiguration[] configs = ((CompilerConfiguration) config)
                            .createPrecompileConfigurations(prototype,
                                    exceptFiles);
                    if (configs != null && configs.length == 2) {
                        //
                        //   visit the precompiled file to add it into the
                        //      targets list (just like any other file if
                        //      compiler doesn't support precompilation)
                        TargetMatcher matcher = new TargetMatcher(this,
                                _objDir,
                                new ProcessorConfiguration[]{configs[0]},
                                linkerConfig, objectFiles, targets, versionInfo);
    
                        matcher.visit(new File(prototype.getParent()),
                                prototype.getName());
                        //
                        //   only the configuration that uses the
                        //      precompiled header gets added to the bidding list
                        biddingProcessors.addElement(configs[1]);
                        localConfigs = new ProcessorConfiguration[2];
                        localConfigs[0] = configs[1];
                        localConfigs[1] = config;
                    }
                }
                //
                //   if the compiler has a fileset
                //       then allow it to add its files
                //       to the set of potential targets
                if (currentCompilerDef.hasFileSets()) {
                    TargetMatcher matcher = new TargetMatcher(this, _objDir,
                            localConfigs, linkerConfig, objectFiles, targets,
              versionInfo);
                    currentCompilerDef.visitFiles(matcher);
                }
                biddingProcessors.addElement(config);
            }
        }
        //
        //    add fallback compiler at the end
        //
        ProcessorConfiguration config = compilerDef.createConfiguration(this,
                linkType, null, targetPlatform, versionInfo);
        biddingProcessors.addElement(config);
        ProcessorConfiguration[] bidders = new ProcessorConfiguration[biddingProcessors
                .size()];
        biddingProcessors.copyInto(bidders);
View Full Code Here

    //   get the first target and assume that it is representative
    //
    Iterator targetIter = targets.values().iterator();
    while (targetIter.hasNext()) {
      TargetInfo targetInfo = (TargetInfo) targetIter.next();
      ProcessorConfiguration config = targetInfo.getConfiguration();
      //
      //   for the first cl compiler
      //
      if (config instanceof CommandLineCompilerConfiguration) {
        compilerConfig = (CommandLineCompilerConfiguration) config;
View Full Code Here

    StringBuffer baseOptions = new StringBuffer(100);
    StringBuffer options = new StringBuffer(100);
    baseOptions.append("# ADD BASE LINK32");
    options.append("# ADD LINK32");

    ProcessorConfiguration config = linkTarget.getConfiguration();
    if (config instanceof CommandLineLinkerConfiguration) {
      CommandLineLinkerConfiguration linkConfig =
          (CommandLineLinkerConfiguration) config;

      File[] linkSources = linkTarget.getAllSources();
View Full Code Here

        //   get the first target and assume that it is representative
        //
        Iterator targetIter = targets.values().iterator();
        while (targetIter.hasNext()) {
            TargetInfo targetInfo = (TargetInfo) targetIter.next();
            ProcessorConfiguration config = targetInfo.getConfiguration();
            //
            //   for the first cl compiler
            //
            if (config instanceof CommandLineCompilerConfiguration) {
                compilerConfig = (CommandLineCompilerConfiguration) config;
View Full Code Here

    //   get the first target and assume that it is representative
    //
    Iterator targetIter = targets.values().iterator();
    while (targetIter.hasNext()) {
      TargetInfo targetInfo = (TargetInfo) targetIter.next();
      ProcessorConfiguration config = targetInfo.getConfiguration();
      String identifier = config.getIdentifier();
      //
      //   for the first gcc or bcc compiler
      //
      if (config instanceof CommandLineCompilerConfiguration) {
        compilerConfig = (CommandLineCompilerConfiguration) config;
View Full Code Here

  private void
      writeLinkOptions(final String baseDir,
                       final PropertyWriter writer,
                       final TargetInfo linkTarget) throws SAXException {
    if (linkTarget != null) {
      ProcessorConfiguration config = linkTarget.getConfiguration();
      if (config instanceof CommandLineLinkerConfiguration) {
        CommandLineLinkerConfiguration linkConfig =
            (CommandLineLinkerConfiguration) config;

        if (linkConfig.getLinker() instanceof BorlandLinker) {
View Full Code Here

                                    final TargetInfo linkTarget,
                                    final Map targets) throws SAXException {
        AttributesImpl attributes = new AttributesImpl();
        addAttribute(attributes, "Name", "VCLinkerTool");

        ProcessorConfiguration config = linkTarget.getConfiguration();
        if (config instanceof CommandLineLinkerConfiguration) {
            CommandLineLinkerConfiguration linkerConfig =
                    (CommandLineLinkerConfiguration) config;
            if (linkerConfig.getLinker() instanceof DevStudioCompatibleLinker) {
                addAttribute(attributes, "LinkIncremental",
View Full Code Here

        //   get the first target and assume that it is representative
        //
        Iterator targetIter = targets.values().iterator();
        while (targetIter.hasNext()) {
            TargetInfo targetInfo = (TargetInfo) targetIter.next();
            ProcessorConfiguration config = targetInfo.getConfiguration();
            //
            //   for the first cl compiler
            //
            if (config instanceof CommandLineCompilerConfiguration) {
                CommandLineCompilerConfiguration compilerConfig =
View Full Code Here

TOP

Related Classes of net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration

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.