Package org.eclipse.cdt.core.envvar

Examples of org.eclipse.cdt.core.envvar.IEnvironmentVariable


      }

      // set warning levels default on
      IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
      IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
      IEnvironmentVariable var = new EnvironmentVariable(ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL, ArduinoConst.ENV_KEY_WARNING_LEVEL_ON);
      contribEnv.addVariable(var, cfgd.getConfiguration());

      prjDesc.setActiveConfiguration(defaultConfigDescription);
      prjDesc.setCdtProjectCreated();
      CoreModel.getDefault().getProjectDescriptionManager().setProjectDescription(project, prjDesc, true, null);
View Full Code Here


     */
    private static void setTheEnvironmentVariablesSetTheDefaults(IContributedEnvironment contribEnv, ICConfigurationDescription confDesc,
      IPath platformFile) {
  // Set some default values because the platform.txt does not contain
  // them
  IEnvironmentVariable var = new EnvironmentVariable(ENV_KEY_ARDUINO_PATH, getArduinoPath().toString());
  contribEnv.addVariable(var, confDesc);

  // from 1.5.3 onwards 3 more environment variables need to be added
  var = new EnvironmentVariable(ENV_KEY_ARCHITECTURE, platformFile.removeLastSegments(1).lastSegment());
  contribEnv.addVariable(var, confDesc);
View Full Code Here

    private static void setTheEnvironmentVariablesAddthePlatformTxt(IContributedEnvironment contribEnv, ICConfigurationDescription confDesc,
      IPath platformFile) throws IOException {
  DataInputStream dataInputStream = new DataInputStream(new FileInputStream(platformFile.toOSString()));
  BufferedReader br = new BufferedReader(new InputStreamReader(dataInputStream));
  String strLine;
  IEnvironmentVariable var = null;
  // Read File Line By Line
  while ((strLine = br.readLine()) != null) {
      String RealData[] = strLine.split("#");// Ignore everything after
               // first #
      if (RealData.length > 0) {
View Full Code Here

    private static void setTheEnvironmentVariablesPostProcessing(IContributedEnvironment contribEnv, ICConfigurationDescription confDesc) {

  String recipes[] = { ENV_KEY_recipe_c_o_pattern, ENV_KEY_recipe_cpp_o_pattern, ENV_KEY_recipe_S_o_pattern,
    ENV_KEY_recipe_objcopy_hex_pattern, ENV_KEY_recipe_objcopy_eep_pattern, ENV_KEY_recipe_size_pattern, ENV_KEY_recipe_AR_pattern,
    ENV_KEY_recipe_c_combine_pattern };
  IEnvironmentVariable var = null;
  for (int curRecipe = 0; curRecipe < recipes.length; curRecipe++) {
      String recipe = getBuildEnvironmentVariable(confDesc, recipes[curRecipe], "", false);

      String recipeParts[] = recipe.split("(\"\\$\\{A.OBJECT_FILE}\")|(\\$\\{A.OBJECT_FILES})|(\"\\$\\{A.SOURCE_FILE}\")", 3);
      switch (recipeParts.length) {
View Full Code Here

  // Replace "-g" with "-g2"
  // Replace "-Os" with ""
  // TODO: This should move to another location eventually -- a bit hacky here (considering other env vars come from other -- a little bit
  // magical -- places).
  // I couldn't easily determine where that magic happened :(
  IEnvironmentVariable original = null;
  IEnvironmentVariable replacement = null;

  original = envManager.getVariable(ENV_KEY_ARDUINO_START + "COMPILER.C.FLAGS", confDesc, true);
  if (original != null) {
      replacement = new EnvironmentVariable(original.getName(), original.getValue().replace("-g", "-g2").replace("-Os", ""),
        original.getOperation(), original.getDelimiter());
View Full Code Here

        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();
        if (myWarningLevel.getSelection() == true) {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL,
        ArduinoConst.ENV_KEY_WARNING_LEVEL_ON);
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        } else {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL,
        ArduinoConst.ENV_KEY_WARNING_LEVEL_OFF);
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        }
    }
      }
  });

  // checkbox show alternative size
  mySizeCommand = new Button(usercomp, SWT.CHECK);
  mySizeCommand.setText("Use alternative size command?");
  mySizeCommand.setEnabled(true);
  mySizeCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 2, 1));
  mySizeCommand.addListener(UPDATE, new Listener() {
      @Override
      public void handleEvent(Event e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();
        if (mySizeCommand.getSelection() == true) {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_SIZE_SWITCH,
        "${" + ArduinoConst.ENV_KEY_JANTJE_SIZE_COMMAND
          + "}");
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        } else {
      IEnvironmentVariable var = new EnvironmentVariable(
        ArduinoConst.ENV_KEY_JANTJE_SIZE_SWITCH,
        "${" + ArduinoConst.ENV_KEY_recipe_size_pattern
          + "}");
      contribEnv.addVariable(var, getResDesc()
        .getConfiguration());
        }
    }
      }
  });

  createLine(usercomp, 2);
  // edit field add to C & C++ command line
  Label label = new Label(usercomp, SWT.LEFT);
  label.setText("append to C and C++ ");
  label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
    false, 1, 1));
  myCCppCommand = new Text(usercomp, SWT.SINGLE);
  myCCppCommand.setText("");
  myCCppCommand
    .setMessage("This command is added to the C and C++ compile command.");
  myCCppCommand.setEnabled(true);
  myCCppCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 1, 1));
  myCCppCommand.addModifyListener(new ModifyListener() {

      @Override
      public void modifyText(ModifyEvent e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();

        IEnvironmentVariable var = new EnvironmentVariable(
          ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS,
          myCCppCommand.getText());
        contribEnv
          .addVariable(var, getResDesc().getConfiguration());
    }

      }
  });

  // edit field add to C++ command line
  label = new Label(usercomp, SWT.LEFT);
  label.setText("append to C++ ");
  label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
    false, 1, 1));
  myCppCommand = new Text(usercomp, SWT.SINGLE);
  myCppCommand.setText("");
  myCppCommand
    .setMessage("This command is added to the C++ compile command.");
  myCppCommand.setEnabled(true);
  myCppCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 1, 1));
  myCppCommand.addModifyListener(new ModifyListener() {

      @Override
      public void modifyText(ModifyEvent e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();

        IEnvironmentVariable var = new EnvironmentVariable(
          ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS,
          myCppCommand.getText());
        contribEnv
          .addVariable(var, getResDesc().getConfiguration());
    }

      }
  });

  // edit field add to C command line
  label = new Label(usercomp, SWT.LEFT);
  label.setText("append to C ");
  label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false,
    false, 1, 1));
  myCCommand = new Text(usercomp, SWT.SINGLE);
  myCCommand.setText("");
  myCCommand
    .setMessage("This command is added to the C compile command.");
  myCCommand.setEnabled(true);
  myCCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
    false, false, 1, 1));
  myCCommand.addModifyListener(new ModifyListener() {

      @Override
      public void modifyText(ModifyEvent e) {
    if (getResDesc().getConfiguration() != null) {
        IEnvironmentVariableManager envManager = CCorePlugin
          .getDefault().getBuildEnvironmentManager();
        IContributedEnvironment contribEnv = envManager
          .getContributedEnvironment();

        IEnvironmentVariable var = new EnvironmentVariable(
          ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS,
          myCCommand.getText());
        contribEnv
          .addVariable(var, getResDesc().getConfiguration());
    }
View Full Code Here

    private void setValues(ICConfigurationDescription confDesc) {
  IEnvironmentVariableManager envManager = CCorePlugin.getDefault()
    .getBuildEnvironmentManager();
  IContributedEnvironment contribEnv = envManager
    .getContributedEnvironment();
  IEnvironmentVariable var = contribEnv.getVariable(
    ArduinoConst.ENV_KEY_JANTJE_WARNING_LEVEL, confDesc);
  if (var == null)
      myWarningLevel.setSelection(false);
  else
      myWarningLevel.setSelection((var.getValue()
        .equalsIgnoreCase(ArduinoConst.ENV_KEY_WARNING_LEVEL_ON)));
  var = contribEnv
    .getVariable(ArduinoConst.ENV_KEY_JANTJE_SIZE_SWITCH, confDesc);
  if (var == null)
      mySizeCommand.setSelection(false);
  else
      mySizeCommand.setSelection((var.getValue()
        .contains(ArduinoConst.ENV_KEY_JANTJE_SIZE_COMMAND)));
  var = contribEnv.getVariable(
    ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS,
    confDesc);
  if (var == null)
      myCCppCommand.setText("");
  else
      myCCppCommand.setText(var.getValue());
  var = contribEnv.getVariable(
    ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS,
    confDesc);
  if (var == null)
      myCCommand.setText("");
  else
      myCCommand.setText(var.getValue());
  var = contribEnv.getVariable(
    ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS,
    confDesc);
  if (var == null)
      myCppCommand.setText("");
  else
      myCppCommand.setText(var.getValue());
    }
View Full Code Here

      // Set the path variables
      IProject project = confdesc.getProjectDescription().getProject();
      IPath platformPath = new Path(new File(mControlBoardsTxtFile.getText().trim()).getParent()).append(ArduinoConst.PLATFORM_FILE_NAME);

      IEnvironmentVariable var = new EnvironmentVariable(ArduinoConst.ENV_KEY_JANTJE_BOARDS_FILE, boardFile);
      contribEnv.addVariable(var, confdesc);
      var = new EnvironmentVariable(ArduinoConst.ENV_KEY_JANTJE_BOARD_NAME, boardName);
      contribEnv.addVariable(var, confdesc);
      var = new EnvironmentVariable(ArduinoConst.ENV_KEY_JANTJE_COM_PORT, uploadPort);
      contribEnv.addVariable(var, confdesc);
View Full Code Here

      }
  }
  // End of Bug fix for CDT 8.1 fixed in 8.2
  if (languageId.equals("org.eclipse.cdt.core.gcc")) {
      compilerCommand = envManager.getVariable(ArduinoConst.ENV_KEY_recipe_c_o_pattern, confDesc, true).getValue().replace(" -o ", " ");
      IEnvironmentVariable op1 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true);
      IEnvironmentVariable op2 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_C_COMPILE_OPTIONS, confDesc, true);
      if (op1 != null) {
    compilerCommand = compilerCommand + " " + op1.getValue();
      }
      if (op2 != null) {
    compilerCommand = compilerCommand + " " + op2.getValue();
      }
      compilerCommand = compilerCommand + " -D__IN_ECLIPSE__=1";
  } else if (languageId.equals("org.eclipse.cdt.core.g++")) {
      compilerCommand = envManager.getVariable(ArduinoConst.ENV_KEY_recipe_cpp_o_pattern, confDesc, true).getValue().replace(" -o ", " ");
      IEnvironmentVariable op1 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_COMPILE_OPTIONS, confDesc, true);
      IEnvironmentVariable op2 = envManager.getVariable(ArduinoConst.ENV_KEY_JANTJE_ADDITIONAL_CPP_COMPILE_OPTIONS, confDesc, true);
      if (op1 != null) {
    compilerCommand = compilerCommand + " " + op1.getValue();
      }
      if (op2 != null) {
    compilerCommand = compilerCommand + " " + op2.getValue();
      }
      compilerCommand = compilerCommand + " -D__IN_ECLIPSE__=1";
  } else {
      ManagedBuilderCorePlugin.error("Unable to find compiler command for language " + languageId + " in toolchain=" + getToolchainId()); //$NON-NLS-1$
  }
View Full Code Here

TOP

Related Classes of org.eclipse.cdt.core.envvar.IEnvironmentVariable

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.