Examples of IOutputType


Examples of org.eclipse.cdt.managedbuilder.core.IOutputType

  // Get the outputs for this tool invocation
  IOutputType[] outTypes = tool.getOutputTypes();
  if (outTypes != null && outTypes.length > 0) {
      for (int i = 0; i < outTypes.length; i++) {
    Vector<String> typeEnumeratedOutputs = new Vector<String>();
    IOutputType type = outTypes[i];
    String outputPrefix = type.getOutputPrefix();

    // Resolve any macros in the outputPrefix
    // Note that we cannot use file macros because if we do a clean
    // we need to know the actual name of the file to clean, and
    // cannot use any builder variables such as $@. Hence we use the
    // next best thing, i.e. configuration context.

    if (config != null) {

        try {
      outputPrefix = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(outputPrefix, "", //$NON-NLS-1$
        " ", //$NON-NLS-1$
        IBuildMacroProvider.CONTEXT_CONFIGURATION, config);
        }

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

    String variable = type.getBuildVariable();
    boolean multOfType = type.getMultipleOfType();
    boolean primaryOutput = (type == tool.getPrimaryOutputType());
    IOption option = tool.getOptionBySuperClassId(type.getOptionId());
    IManagedOutputNameProvider nameProvider = type.getNameProvider();
    String[] outputNames = type.getOutputNames();

    // 1. If the tool is the build target and this is the primary
    // output,
    // use artifact name & extension
    if (bIsTargetTool && primaryOutput) {
        String outputName = outputPrefix + targetName;
        if (targetExt.length() > 0) {
      outputName += (DOT + targetExt);
        }
        myCommandOutputs.add(outputName);
        typeEnumeratedOutputs.add(outputName);
        // But this doesn't use any output macro...
    } else
    // 2. If an option is specified, use the value of the option
    if (option != null) {
        try {
      List<String> outputs = new ArrayList<String>();
      int optType = option.getValueType();
      if (optType == IOption.STRING) {
          outputs.add(outputPrefix + option.getStringValue());
      } else if (optType == IOption.STRING_LIST || optType == IOption.LIBRARIES || optType == IOption.OBJECTS
        || optType == IOption.INCLUDE_FILES || optType == IOption.LIBRARY_PATHS || optType == IOption.LIBRARY_FILES
        || optType == IOption.MACRO_FILES) {
          @SuppressWarnings("unchecked")
          List<String> value = (List<String>) option.getValue();
          outputs = value;
          tool.filterValues(optType, outputs);
          // Add outputPrefix to each if necessary
          if (outputPrefix.length() > 0) {
        for (int j = 0; j < outputs.size(); j++) {
            outputs.set(j, outputPrefix + outputs.get(j));
        }
          }
      }
      for (int j = 0; j < outputs.size(); j++) {
          String outputName = outputs.get(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_OPTION, new OptionContextData(option, tool));
        if ((resolved = resolved.trim()).length() > 0)
            outputs.set(j, resolved);
          } catch (BuildMacroException e) {// JABA is not
                   // going to add
                   // code
          }
      }

      // NO - myCommandOutputs.addAll(outputs);
      typeEnumeratedOutputs.addAll(outputs);
      if (variable.length() > 0) {
          List<IPath> outputPaths = new ArrayList<IPath>();
          for (int j = 0; j < outputs.size(); j++) {
        outputPaths.add(Path.fromOSString(outputs.get(j)));
          }
          if (myOutputMacros.containsKey(variable)) {
        List<IPath> currList = myOutputMacros.get(variable);
        currList.addAll(outputPaths);
        myOutputMacros.put(variable, currList);
          } else {
        myOutputMacros.put(variable, outputPaths);
          }
      }
        } catch (BuildException ex) {// JABA is not going to add
             // code
        }
    } else
    // 3. If a nameProvider is specified, call it
    if (nameProvider != null) {
        // The inputs must have been calculated before we can do
        // this
        IPath[] outNames = null;
        if (!inputsCalculated) {
      done = false;
        } else {
      Vector<String> inputs = getEnumeratedInputs();
      IPath[] inputPaths = new IPath[inputs.size()];
      for (int j = 0; j < inputPaths.length; j++) {
          inputPaths[j] = Path.fromOSString(inputs.get(j));
      }
      // JABA: I inserted this code to cater for bin or hex
      // extensions based on the board. Basically you need the
      // Project
      // to get to information to know whether this is a sam
      // or avr project (having it in the platform file would
      // be easier)
      // To make it as much compliant as possible with the
      // "CDT way" I added a getOutputNames which takes al the
      // info needed to
      // know the correct output name
      // if (inputPaths.length == 0) {
      try {
          IManagedOutputNameProviderJaba newNameProvider = (IManagedOutputNameProviderJaba) nameProvider;
          outNames = newNameProvider.getOutputNames(project, config, tool, inputPaths);
      } 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));
      }
      // } else {
      // outNames = nameProvider.getOutputNames(tool,
      // inputPaths);
      // }
      // JABA end of insertion
      if (outNames != null) {
          for (int j = 0; j < outNames.length; j++) {
        String outputName = outNames[j].toString();
        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_CONFIGURATION, config);
            if ((resolved = resolved.trim()).length() > 0) {
          outputName = resolved;
          outNames[j] = Path.fromOSString(resolved);
            }
        } catch (BuildMacroException e) {// JABA is not
                 // going to add
                 // code
        }

        if (primaryOutput) {
            myCommandOutputs.add(outputName);
        }
        typeEnumeratedOutputs.add(outputName);
          }
      }
        }
        if (variable.length() > 0 && outNames != null) {
      if (myOutputMacros.containsKey(variable)) {
          List<IPath> currList = myOutputMacros.get(variable);
          currList.addAll(Arrays.asList(outNames));
          myOutputMacros.put(variable, currList);
      } else {
          myOutputMacros.put(variable, new ArrayList<IPath>(Arrays.asList(outNames)));
      }
        }
    } else
    // 4. If outputNames is specified, use it
    if (outputNames != null) {
        if (outputNames.length > 0) {
      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_OPTION, new OptionContextData(option, tool));
        if ((resolved = resolved.trim()).length() > 0)
            outputNames[j] = resolved;
          } catch (BuildMacroException e) {// JABA is not
                   // going to add
                   // code
          }
      }
      List<String> namesList = Arrays.asList(outputNames);
      if (primaryOutput) {
          myCommandOutputs.addAll(namesList);
      }
      typeEnumeratedOutputs.addAll(namesList);
      if (variable.length() > 0) {
          List<IPath> outputPaths = new ArrayList<IPath>();
          for (int j = 0; j < namesList.size(); j++) {
        outputPaths.add(Path.fromOSString(namesList.get(j)));
          }
          if (myOutputMacros.containsKey(variable)) {
        List<IPath> currList = myOutputMacros.get(variable);
        currList.addAll(outputPaths);
        myOutputMacros.put(variable, currList);
          } else {
        myOutputMacros.put(variable, outputPaths);
          }
      }
        }
    } else {
        // 5. Use the name pattern to generate a transformation
        // macro
        // so that the source names can be transformed into the
        // target names
        // using the built-in string substitution functions of
        // <code>make</code>.
        if (multOfType) {
      // This case is not handled - a nameProvider or
      // outputNames must be specified
      List<String> errList = new ArrayList<String>();
      errList.add(ManagedMakeMessages.getResourceString("MakefileGenerator.error.no.nameprovider")); //$NON-NLS-1$
      myCommandOutputs.addAll(errList);
        } else {
      String namePattern = type.getNamePattern();
      if (namePattern == null || namePattern.length() == 0) {
          namePattern = outputPrefix + IManagedBuilderMakefileGenerator.WILDCARD;
          String outExt = (type.getOutputExtensions(tool))[0];
          if (outExt != null && outExt.length() > 0) {
        namePattern += DOT + outExt;
          }
      } else if (outputPrefix.length() > 0) {
          namePattern = outputPrefix + namePattern;
View Full Code Here

Examples of org.eclipse.cdt.managedbuilder.core.IOutputType

  for (int i = 0; i < buildTools.length; i++) {
      // Add the specified output build variables
      IOutputType[] outTypes = buildTools[i].getOutputTypes();
      if (outTypes != null && outTypes.length > 0) {
    for (int j = 0; j < outTypes.length; j++) {
        IOutputType outType = outTypes[j];
        // Is this one of the secondary outputs?
        // Look for an outputType with this ID, or one with a
        // superclass with this id
        thisType: for (int k = 0; k < secondaryOutputs.length; k++) {
      IOutputType matchType = outType;
      do {
          if (matchType.getId().equals(secondaryOutputs[k].getId())) {
        buildVars.add(outType.getBuildVariable());
        break thisType;
          }
          matchType = matchType.getSuperClass();
      } while (matchType != null);
        }
    }
      }
  }
View Full Code Here

Examples of org.eclipse.cdt.managedbuilder.core.IOutputType

    for (IOutputType outType : outTypes) {
        // Is this one of the secondary outputs?
        // Look for an outputType with this ID, or one with a
        // superclass with this id
        for (IOutputType secondaryOutput : secondaryOutputs) {
      IOutputType matchType = outType;
      do {
          if (matchType.getId().equals(secondaryOutput.getId())) {
        if (outType.getBuildVariable().equals(varName)) {
            return true;
        }
          }
          matchType = matchType.getSuperClass();
      } while (matchType != null);
        }
    }
      }
  }
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.