Package org.eclipse.cdt.managedbuilder.internal.macros

Examples of org.eclipse.cdt.managedbuilder.internal.macros.FileContextData


      try {
    // try to resolve the build macros in the tool command
    String resolvedCommand = ManagedBuildManager
      .getBuildMacroProvider()
      .resolveValueToMakefileFormat(command, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
        new FileContextData(null, null, null, tool)).replaceFirst(" -w ", " ");
    if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
        command = resolvedCommand;

      } catch (BuildMacroException e) {// JABA is not going to write this
               // code
      }
      String[] cmdInputs = inputs.toArray(new String[inputs.size()]);
      IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
      IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo(tool, command, flags, outflag, outputPrefix, primaryOutputs, cmdInputs,
        tool.getCommandLinePattern());

      // The command to build
      String buildCmd = null;
      if (cmdLInfo == null) {
    String toolFlags;
    try {
        toolFlags = tool.getToolCommandFlagsString(null, null);
    } catch (BuildException ex) {
        // TODO report error
        toolFlags = EMPTY_STRING;
    }
    buildCmd = command + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE
      + IN_MACRO;
      } else
    buildCmd = cmdLInfo.getCommandLine();

      // resolve any remaining macros in the command after it has been
      // generated
      try {
    String resolvedCommand = ManagedBuildManager
      .getBuildMacroProvider()
      .resolveValueToMakefileFormat(buildCmd, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
        new FileContextData(null, null, null, tool)).replaceFirst(" -w ", " ");
    if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
        buildCmd = resolvedCommand;

      } catch (BuildMacroException e) {// JABA is not going to write this
               // code
View Full Code Here


      if ((inputLocation != null && inputLocation.toString().indexOf(" ") != -1) || //$NON-NLS-1$
        (outputLocation != null && outputLocation.toString().indexOf(" ") != -1)) //$NON-NLS-1$
      {
    resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValue(cmd, "", //$NON-NLS-1$
      " ", //$NON-NLS-1$
      IBuildMacroProvider.CONTEXT_FILE, new FileContextData(inputLocation, outputLocation, null, tool)).replaceFirst(" -w ", " ");
      }

      else {
    resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(cmd, "", //$NON-NLS-1$
      " ", //$NON-NLS-1$
      IBuildMacroProvider.CONTEXT_FILE, new FileContextData(inputLocation, outputLocation, null, tool)).replaceFirst(" -w ", " ");
      }
      if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
    cmd = resolvedCommand;

  } catch (BuildMacroException e) {// JABA is not going to write this code
View Full Code Here

  boolean resourceNameRequiresExplicitRule = (resource.isLinked() && containsSpecialCharacters(sourceLocation.toString()))
    || (!resource.isLinked() && containsSpecialCharacters(resource.getProjectRelativePath().toString()));

  boolean needExplicitRuleForFile = resourceNameRequiresExplicitRule
    || BuildMacroProvider.getReferencedExplitFileMacros(tool).length > 0
    || BuildMacroProvider.getReferencedExplitFileMacros(tool.getToolCommand(), IBuildMacroProvider.CONTEXT_FILE, new FileContextData(
      sourceLocation, outputLocation, null, tool)).length > 0;

  // Get and resolve the command
  String cmd = tool.getToolCommand();

  try {
      String resolvedCommand = null;
      if (!needExplicitRuleForFile) {
    resolvedCommand = ManagedBuildManager
      .getBuildMacroProvider()
      .resolveValueToMakefileFormat(cmd, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
        new FileContextData(sourceLocation, outputLocation, null, tool)).replaceFirst(" -w ", " ");
      } else {
    // if we need an explicit rule then don't use any builder
    // variables, resolve everything
    // to explicit strings
    resolvedCommand = ManagedBuildManager
      .getBuildMacroProvider()
      .resolveValue(cmd, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
        new FileContextData(sourceLocation, outputLocation, null, tool)).replaceFirst(" -w ", " ");
      }

      if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
    cmd = resolvedCommand;

  } catch (BuildMacroException e) {// JABA is not going to write this code
  }

  String defaultOutputName = EMPTY_STRING;
  String primaryDependencyName = EMPTY_STRING;
  String patternPrimaryDependencyName = EMPTY_STRING;
  String home = (generatedSource) ? DOT : ROOT;
  String resourcePath = null;
  boolean patternRule = true;
  boolean isItLinked = false;
  if (resource.isLinked(IResource.CHECK_ANCESTORS)) {
      // it IS linked, so use the actual location
      isItLinked = true;
      resourcePath = sourceLocation.toString();
      // Need a hardcoded rule, not a pattern rule, as a linked file
      // can reside in any path
      defaultOutputName = escapeWhitespaces(relativePath + fileName + optDotExt);
      primaryDependencyName = escapeWhitespaces(resourcePath);
      patternRule = false;
  } else {
      // Use the relative path (not really needed to store per se but in
      // the future someone may want this)
      resourcePath = relativePath;
      // The rule and command to add to the makefile
      if (rcInfo instanceof IFileInfo || needExplicitRuleForFile) {
    // Need a hardcoded rule, not a pattern rule
    defaultOutputName = escapeWhitespaces(resourcePath + fileName + optDotExt);
    patternRule = false;
      } else {
    defaultOutputName = relativePath + WILDCARD + optDotExt;
      }
      primaryDependencyName = escapeWhitespaces(home + SEPARATOR + resourcePath + fileName + DOT + inputExtension);
      patternPrimaryDependencyName = home + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
  } // end fix for PR 70491

  // If the tool specifies a dependency calculator of TYPE_BUILD_COMMANDS,
  // ask whether
  // the dependency commands are "generic" (i.e., we can use a pattern
  // rule)
  boolean needExplicitDependencyCommands = false;
  if (depCommands != null) {
      needExplicitDependencyCommands = !depCommands.areCommandsGeneric();
  }

  // If we still think that we are using a pattern rule, check a few more
  // things
  if (patternRule) {
      patternRule = false;
      // Make sure that at least one of the rule outputs contains a %.
      for (int i = 0; i < ruleOutputs.size(); i++) {
    String ruleOutput = ruleOutputs.get(i).toString();
    if (ruleOutput.indexOf('%') >= 0) {
        patternRule = true;
        break;
    }
      }
      if (patternRule) {
    patternRule = !needExplicitDependencyCommands;
      }
  }

  // Begin building the rule for this source file
  String buildRule = EMPTY_STRING;

  if (patternRule) {
      if (ruleOutputs.size() == 0) {
    buildRule += defaultOutputName;
      } else {
    boolean first = true;
    for (int i = 0; i < ruleOutputs.size(); i++) {
        String ruleOutput = ruleOutputs.get(i).toString();
        if (ruleOutput.indexOf('%') >= 0) {
      if (first) {
          first = false;
      } else {
          buildRule += WHITESPACE;
      }
      buildRule += ruleOutput;
        }
    }
      }
  } else {
      buildRule += primaryOutputName;
  }

  String buildRuleDependencies = primaryDependencyName;
  String patternBuildRuleDependencies = patternPrimaryDependencyName;

  // Other additional inputs
  // Get any additional dependencies specified for the tool in other
  // InputType elements and AdditionalInput elements
  IPath[] addlDepPaths = tool.getAdditionalDependencies();
  for (IPath addlDepPath : addlDepPaths) {
      // Translate the path from project relative to build directory
      // relative
      IPath addlPath = addlDepPath;
      if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
    if (!addlPath.isAbsolute()) {
        IPath tempPath = project.getLocation().append(new Path(ensureUnquoted(addlPath.toString())));
        if (tempPath != null) {
      addlPath = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), tempPath);
        }
    }
      }
      String suitablePath = ensurePathIsGNUMakeTargetRuleCompatibleSyntax(addlPath.toString());
      buildRuleDependencies += WHITESPACE + suitablePath;
      patternBuildRuleDependencies += WHITESPACE + suitablePath;
  }

  buildRule += COLON + WHITESPACE + (patternRule ? patternBuildRuleDependencies : buildRuleDependencies);

  // No duplicates in a makefile. If we already have this rule, don't add
  // it or the commands to build the file
  if (getRuleList().contains(buildRule)) {
      // TODO: Should we assert that this is a pattern rule?
  } else {
      getRuleList().add(buildRule);

      // Echo starting message
      buffer.append(buildRule + NEWLINE);
      buffer.append(TAB + AT + escapedEcho(MESSAGE_START_FILE + WHITESPACE + IN_MACRO));
      buffer.append(TAB + AT + escapedEcho(tool.getAnnouncement()));

      // If the tool specifies a dependency calculator of
      // TYPE_BUILD_COMMANDS, ask whether
      // there are any pre-tool commands.
      if (depCommands != null) {
    String[] preToolCommands = depCommands.getPreToolDependencyCommands();
    if (preToolCommands != null && preToolCommands.length > 0) {
        for (String preCmd : preToolCommands) {
      try {
          String resolvedCommand;
          IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
          if (!needExplicitRuleForFile) {
        resolvedCommand = provider.resolveValueToMakefileFormat(preCmd, EMPTY_STRING, WHITESPACE,
          IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, outputLocation, null, tool))
          .replaceFirst(" -w ", " ");
          } else {
        // if we need an explicit rule then don't use
        // any builder
        // variables, resolve everything to explicit
        // strings
        resolvedCommand = provider.resolveValue(preCmd, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
          new FileContextData(sourceLocation, outputLocation, null, tool)).replaceFirst(" -w ", " ");
          }
          if (resolvedCommand != null)
        buffer.append(resolvedCommand + NEWLINE);
      } catch (BuildMacroException e) {// JABA is not going to
               // write this code
      }
        }
    }
      }

      // Generate the command line

      Vector<String> inputs = new Vector<String>();
      inputs.add(IN_MACRO);

      // Other additional inputs
      // Get any additional dependencies specified for the tool in other
      // InputType elements and AdditionalInput elements
      IPath[] addlInputPaths = getAdditionalResourcesForSource(tool);
      for (IPath addlInputPath : addlInputPaths) {
    // Translate the path from project relative to build directory
    // relative
    IPath addlPath = addlInputPath;
    if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
        if (!addlPath.isAbsolute()) {
      IPath tempPath = getPathForResource(project).append(addlPath);
      if (tempPath != null) {
          addlPath = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), tempPath);
      }
        }
    }
    inputs.add(addlPath.toString());
      }
      String[] inputStrings = inputs.toArray(new String[inputs.size()]);

      String[] flags = null;
      // Get the tool command line options
      try {
    flags = tool.getToolCommandFlags(sourceLocation, outputLocation);
      } catch (BuildException ex) {
    // TODO add some routines to catch this
    flags = EMPTY_STRING_ARRAY;
      }

      // If we have a TYPE_BUILD_COMMANDS dependency generator, determine
      // if there are any options that
      // it wants added to the command line
      if (depCommands != null) {
    flags = addDependencyOptions(depCommands, flags);
      }

      IManagedCommandLineInfo cmdLInfo = null;
      String outflag = null;
      String outputPrefix = null;

      if (rcInfo instanceof IFileInfo || needExplicitRuleForFile || needExplicitDependencyCommands) {
    outflag = tool.getOutputFlag();
    outputPrefix = tool.getOutputPrefix();

    // Call the command line generator
    IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
    cmdLInfo = cmdLGen.generateCommandLineInfo(tool, cmd, flags, outflag, outputPrefix, OUT_MACRO + otherPrimaryOutputs, inputStrings,
      tool.getCommandLinePattern());

      } else {
    outflag = tool.getOutputFlag();// config.getOutputFlag(outputExtension);
    outputPrefix = tool.getOutputPrefix();// config.getOutputPrefix(outputExtension);

    // Call the command line generator
    cmdLInfo = generateToolCommandLineInfo(tool, inputExtension, flags, outflag, outputPrefix, OUT_MACRO + otherPrimaryOutputs,
      inputStrings, sourceLocation, outputLocation);
      }

      // The command to build
      String buildCmd;
      if (cmdLInfo != null) {
    buildCmd = cmdLInfo.getCommandLine();
      } else {
    StringBuffer buildFlags = new StringBuffer();
    for (String flag : flags) {
        if (flag != null) {
      buildFlags.append(flag + WHITESPACE);
        }
    }
    buildCmd = cmd + WHITESPACE + buildFlags.toString().trim() + WHITESPACE + outflag + WHITESPACE + outputPrefix + OUT_MACRO
      + otherPrimaryOutputs + WHITESPACE + IN_MACRO;
      }

      // resolve any remaining macros in the command after it has been
      // generated
      try {
    String resolvedCommand;
    IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
    if (!needExplicitRuleForFile) {
        resolvedCommand = provider.resolveValueToMakefileFormat(buildCmd, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
          new FileContextData(sourceLocation, outputLocation, null, tool)).replaceFirst(" -w ", " ");
    } else {
        // if we need an explicit rule then don't use any builder
        // variables, resolve everything to explicit strings
        resolvedCommand = provider.resolveValue(buildCmd, EMPTY_STRING, WHITESPACE, IBuildMacroProvider.CONTEXT_FILE,
          new FileContextData(sourceLocation, outputLocation, null, tool)).replaceFirst(" -w ", " ");
    }

    if ((resolvedCommand = resolvedCommand.trim()).length() > 0)
        buildCmd = resolvedCommand;

      } catch (BuildMacroException e) {// JABA is not going to write this
               // code
      }

      // buffer.append(TAB + AT + escapedEcho(buildCmd));
      // buffer.append(TAB + AT + buildCmd);
      buffer.append(TAB + buildCmd);

      // Determine if there are any dependencies to calculate
      if (doDepGen) {
    // Get the dependency rule out of the generator
    String[] depCmds = null;
    if (oldDepGen != null) {
        depCmds = new String[1];
        depCmds[0] = oldDepGen.getDependencyCommand(resource, ManagedBuildManager.getBuildInfo(project));
    } else {
        if (depCommands != null) {
      depCmds = depCommands.getPostToolDependencyCommands();
        }
    }

    if (depCmds != null) {
        for (String depCmd : depCmds) {
      // Resolve any macros in the dep command after it has
      // been generated.
      // Note: do not trim the result because it will strip
      // out necessary tab characters.
      buffer.append(WHITESPACE + LOGICAL_AND + WHITESPACE + LINEBREAK);
      try {
          if (!needExplicitRuleForFile) {
        depCmd = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(depCmd, EMPTY_STRING, WHITESPACE,
          IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, outputLocation, null, tool));
          }

          else {
        depCmd = ManagedBuildManager.getBuildMacroProvider().resolveValue(depCmd, EMPTY_STRING, WHITESPACE,
          IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, outputLocation, null, tool));
          }

      } catch (BuildMacroException e) {// JABA is not going to
               // write this code
      }

      buffer.append(depCmd);
        }
    }
      }

      // Echo finished message
      buffer.append(NEWLINE);
      buffer.append(TAB + AT + escapedEcho(MESSAGE_FINISH_FILE + WHITESPACE + IN_MACRO));
      buffer.append(TAB + AT + ECHO_BLANK_LINE + NEWLINE);
  }

  // Determine if there are calculated dependencies
  IPath[] addlDeps = null; // IPath's that are relative to the build
         // directory
  IPath[] addlTargets = null; // IPath's that are relative to the build
            // directory
  String calculatedDependencies = null;
  boolean addedDepLines = false;
  String depLine;
  if (oldDepGen != null && oldDepGen.getCalculatorType() != IManagedDependencyGeneratorType.TYPE_COMMAND) {
      addlDeps = oldCalculateDependenciesForSource(oldDepGen, tool, relativePath, resource);
  } else {
      if (depGen != null && depGen.getCalculatorType() == IManagedDependencyGeneratorType.TYPE_CUSTOM) {
    if (depInfo instanceof IManagedDependencyCalculator) {
        IManagedDependencyCalculator depCalculator = (IManagedDependencyCalculator) depInfo;
        addlDeps = calculateDependenciesForSource(depCalculator);
        addlTargets = depCalculator.getAdditionalTargets();
    }
      }
  }

  if (addlDeps != null && addlDeps.length > 0) {
      calculatedDependencies = new String();
      for (IPath addlDep : addlDeps) {
    calculatedDependencies += WHITESPACE + escapeWhitespaces(addlDep.toString());
      }
  }

  if (calculatedDependencies != null) {
      depLine = primaryOutputName + COLON + calculatedDependencies + NEWLINE;
      if (!getDepLineList().contains(depLine)) {
    getDepLineList().add(depLine);
    addedDepLines = true;
    buffer.append(depLine);
      }
  }

  // Add any additional outputs here using dependency lines
  Vector<IPath> addlOutputs = new Vector<IPath>();
  if (enumeratedPrimaryOutputs.size() > 1) {
      // Starting with 1 is intentional in order to skip the primary
      // output
      for (int i = 1; i < enumeratedPrimaryOutputs.size(); i++)
    addlOutputs.add(enumeratedPrimaryOutputs.get(i));
  }
  addlOutputs.addAll(enumeratedSecondaryOutputs);
  if (addlTargets != null) {
      for (IPath addlTarget : addlTargets)
    addlOutputs.add(addlTarget);
  }
  for (int i = 0; i < addlOutputs.size(); i++) {
      depLine = escapeWhitespaces(addlOutputs.get(i).toString()) + COLON + WHITESPACE + primaryOutputName;
      if (calculatedDependencies != null)
    depLine += calculatedDependencies;
      depLine += NEWLINE;
      if (!getDepLineList().contains(depLine)) {
    getDepLineList().add(depLine);
    addedDepLines = true;
    buffer.append(depLine);
      }
  }
  if (addedDepLines) {
      buffer.append(NEWLINE);
  }

  // If we are using a dependency calculator of type
  // TYPE_PREBUILD_COMMANDS,
  // get the rule to build the dependency file
  if (depPreBuild != null && depFiles != null) {
      addedDepLines = false;
      String[] preBuildCommands = depPreBuild.getDependencyCommands();
      if (preBuildCommands != null) {
    depLine = ""; //$NON-NLS-1$
    // Can we use a pattern rule?
    patternRule = !isItLinked && !needExplicitRuleForFile && depPreBuild.areCommandsGeneric();
    // Begin building the rule
    for (int i = 0; i < depFiles.length; i++) {
        if (i > 0)
      depLine += WHITESPACE;
        if (patternRule) {
      optDotExt = EMPTY_STRING;
      String depExt = depFiles[i].getFileExtension();
      if (depExt != null && depExt.length() > 0)
          optDotExt = DOT + depExt;
      depLine += escapeWhitespaces(relativePath + WILDCARD + optDotExt);
        } else {
      depLine += escapeWhitespaces((depFiles[i]).toString());
        }
    }
    depLine += COLON + WHITESPACE + (patternRule ? patternBuildRuleDependencies : buildRuleDependencies);
    if (!getDepRuleList().contains(depLine)) {
        getDepRuleList().add(depLine);
        addedDepLines = true;
        buffer.append(depLine + NEWLINE);
        buffer.append(TAB + AT + escapedEcho(MESSAGE_START_DEPENDENCY + WHITESPACE + OUT_MACRO));
        for (String preBuildCommand : preBuildCommands) {
      depLine = preBuildCommand;
      // Resolve macros
      try {
          if (!needExplicitRuleForFile) {
        depLine = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(depLine, EMPTY_STRING, WHITESPACE,
          IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, outputLocation, null, tool));
          }

          else {
        depLine = ManagedBuildManager.getBuildMacroProvider().resolveValue(depLine, EMPTY_STRING, WHITESPACE,
          IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, outputLocation, null, tool));
          }

      } catch (BuildMacroException e) {// JABA is not going to
               // write this code
      }
View Full Code Here

        String resolved = null;

        if (containsSpecialCharacters(sourceLocation.toString())) {
            resolved = ManagedBuildManager.getBuildMacroProvider().resolveValue(outputName, "", //$NON-NLS-1$
              " ", //$NON-NLS-1$
              IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, null, option, tool));
        }

        else {
            resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(outputName, "", //$NON-NLS-1$
              " ", //$NON-NLS-1$
              IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, null, option, tool));
        }

        if ((resolved = resolved.trim()).length() > 0)
            outputName = resolved;
          } catch (BuildMacroException e) {// JABA is not
                   // going to write
                   // this code
          }

          IPath outPath = Path.fromOSString(outputName);
          // If only a file name is specified, add the
          // relative path of this output directory
          if (outPath.segmentCount() == 1) {
        outPath = Path.fromOSString(relativePath + outputList.get(j));
          }
          if (primaryOutput) {
        ruleOutputs.add(j, outPath);
        enumeratedPrimaryOutputs.add(j, resolvePercent(outPath, sourceLocation));
          } else {
        ruleOutputs.add(outPath);
        enumeratedSecondaryOutputs.add(resolvePercent(outPath, sourceLocation));
          }
      }
        } catch (BuildException ex) {// JABA is not going to write
             // this code
        }
    } else
    // 3. If a nameProvider is specified, call it
    if (nameProvider != null) {
        IPath[] inPaths = new IPath[1];
        inPaths[0] = resource.getProjectRelativePath();// ;
                   // sourceLocation.removeFirstSegments(project.getLocation().segmentCount());
        IPath[] outPaths = null;
        try {
      IManagedOutputNameProviderJaba newNameProvider = (IManagedOutputNameProviderJaba) nameProvider;
      outPaths = newNameProvider.getOutputNames(project, config, tool, inPaths);
        } catch (Exception e) {
      // The provided class is not a
      // IManagedOutputNameProviderJaba class;
      Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID,
        "The provided class is not of type IManagedOutputNameProviderJaba", e));
        }
        if (outPaths != null) { // MODDED BY JABA ADDED to handle
              // null as return value
      usedOutType = type; // MODDED By JABA added to retun the
              // output type used to generate the
              // command line
      for (int j = 0; j < outPaths.length; j++) {
          IPath outPath = outPaths[j];
          String outputName = outPaths[j].toString();

          // try to resolve the build macros in the output
          // names
          try {

        String resolved = null;

        if (containsSpecialCharacters(sourceLocation.toString())) {
            resolved = ManagedBuildManager.getBuildMacroProvider().resolveValue(outputName, "", //$NON-NLS-1$
              " ", //$NON-NLS-1$
              IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, null, option, tool));
        }

        else {
            resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(outputName, "", //$NON-NLS-1$
              " ", //$NON-NLS-1$
              IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, null, option, tool));
        }

        if ((resolved = resolved.trim()).length() > 0)
            outputName = resolved;
          } catch (BuildMacroException e) {// JABA is not
                   // going to write
                   // this code
          }

          // If only a file name is specified, add the
          // relative path of this output directory
          if (outPath.segmentCount() == 1) {
        outPath = Path.fromOSString(relativePath + outPath.toString());
          }
          if (primaryOutput) {
        ruleOutputs.add(j, outPath);
        enumeratedPrimaryOutputs.add(j, resolvePercent(outPath, sourceLocation));
          } else {
        ruleOutputs.add(outPath);
        enumeratedSecondaryOutputs.add(resolvePercent(outPath, sourceLocation));
          }
      }
        }// MODDED BY JABA ADDED
    } else
    // 4. If outputNames is specified, use it
    if (outputNames != null) {
        for (int j = 0; j < outputNames.length; j++) {
      String outputName = outputNames[j];
      try {
          // try to resolve the build macros in the output
          // names
          String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(outputName, "", //$NON-NLS-1$
            " ", //$NON-NLS-1$
            IBuildMacroProvider.CONTEXT_FILE, new FileContextData(sourceLocation, null, option, tool));
          if ((resolved = resolved.trim()).length() > 0)
        outputName = resolved;
      } catch (BuildMacroException e) {// JABA is not going to
               // write this code
      }
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.managedbuilder.internal.macros.FileContextData

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.