• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ManagedBuildManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.cdt.managedbuilder.core.ManagedBuildManager的典型用法代码示例。如果您正苦于以下问题:Java ManagedBuildManager类的具体用法?Java ManagedBuildManager怎么用?Java ManagedBuildManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ManagedBuildManager类属于org.eclipse.cdt.managedbuilder.core包,在下文中一共展示了ManagedBuildManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createMarker

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * Creates a problem marker.
 *
 * @param fileName
 *        the file where the problem has occurred
 * @param epm
 * @param lineNo
 *        the line number of the problem
 * @param severity
 *        the severity of the problem, see {@link IMarkerGenerator} for
 *        acceptable severity values
 * @param varName
 *        the name of the variable involved in the error or {@code null} if
 *        unknown
 */
private void createMarker(String fileName, ErrorParserManager epm,
    String lineNo, int severity, String varName) {
  int lineNumber = Integer.parseInt(lineNo);
  // cmake reports the file relative to source entry
  final IProject project = epm.getProject();
  IConfiguration cfg = ManagedBuildManager.getBuildInfo(project, true)
      .getDefaultConfiguration();
  ICConfigurationDescription cfgDes = ManagedBuildManager
      .getDescriptionForConfiguration(cfg);
  ICSourceEntry[] srcEntriesR = cfgDes.getResolvedSourceEntries();

  ICSourceEntry[] srcEntries = cfg.getSourceEntries();
  srcEntries = CDataUtil.resolveEntries(srcEntries, cfgDes);

  IPath srcPath = srcEntries[0].getFullPath(); // project-relative path!
  IPath filePath = srcPath.append(fileName);
  IFile file2 = project.getFile(filePath);
  IFile file = epm.findFileName(filePath.toString());

  this.markerInfo = new ProblemMarkerInfo(file2, lineNumber, null, severity,
      varName);
  markerInfo.setType(CMAKE_PROBLEM_MARKER_ID);
}
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:39,代码来源:CMakeErrorParser.java


示例2: appendAbstractOsPreferences

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * Appends arguments common to all OS preferences. The first argument in the
 * list will be replaced by the cmake command from the specified preferences,
 * if given.
 *
 * @param args
 *        the list to append cmake-arguments to.
 * @param prefs
 *        the generic OS preferences to convert and append.
 * @throws CoreException
 *         if unable to resolve the value of one or more variables
 */
private void appendAbstractOsPreferences(List<String> args, final AbstractOsPreferences prefs)
    throws CoreException {
  // replace cmake command, if given
  if (!prefs.getUseDefaultCommand()){
    ICdtVariableManager varManager = CCorePlugin.getDefault().getCdtVariableManager();
    String cmd = varManager.resolveValue(prefs.getCommand(), "<undefined variable here, but CDT does not allow"
        + " to pass it unexpanded; thus its name is lost>"
        , null,
        ManagedBuildManager.getDescriptionForConfiguration(config));
    args.set(0, cmd);
  }
  args.add("-G");
  final CmakeGenerator generator = prefs.getGenerator();
  args.add(generator.getCmakeName());

  appendDefines(args, prefs.getDefines());
  appendUndefines(args, prefs.getUndefines());
}
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:31,代码来源:BuildscriptGenerator.java


示例3: getMakefileName

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
@Override
public String getMakefileName() {
  // load project properties..
  final ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(config);
  CMakePreferences prefs;
  try {
    prefs = ConfigurationManager.getInstance().getOrLoad(cfgd);
  } catch (CoreException ex) {
    // Auto-generated catch block
    ex.printStackTrace();
    return "Makefile"; // default
  }
  AbstractOsPreferences osPrefs = AbstractOsPreferences.extractOsPreferences(prefs);
  // file generated by cmake
  return osPrefs.getGenerator().getMakefileName();
}
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:17,代码来源:BuildscriptGenerator.java


示例4: setIncludePaths

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
public static void setIncludePaths(IProject project, List<String> includePaths) {
	configureIndexerToIncludeAllReferencedHeaders(project);
	
	ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project);
	ICLanguageSettingEntry[] entries = IncludePathString2ICLanguageSettingEntryArray(includePaths);
	
	// Set include paths for all configurations in the CDT project
	for(ICConfigurationDescription confDesc : projectDescription.getConfigurations()) {
		IConfiguration configuration = ManagedBuildManager.getConfigurationForDescription(confDesc);
		CConfigurationData Cconfigdata = configuration.getConfigurationData();
        CFolderData rootFolderData = Cconfigdata.getRootFolderData();
        CLanguageData[] languageDatas = rootFolderData.getLanguageDatas();
        
        for(CLanguageData languageData : languageDatas) {
        	languageData.setEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries);
        }
	}
	
	try {
		CoreModel.getDefault().setProjectDescription(project, projectDescription);
	} catch (CoreException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:ffmmjj,项目名称:uefi_edk2_wizards_plugin,代码行数:26,代码来源:ProjectSettingsManager.java


示例5: ConfigureProjectNature

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
private static void ConfigureProjectNature(IProject project) throws CoreException {
	// Set up build information
	ICProjectDescriptionManager pdMgr = CoreModel.getDefault().getProjectDescriptionManager();
	ICProjectDescription cProjDesc = pdMgr.createProjectDescription(project, false);
	ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
	ManagedProject mProj = new ManagedProject(cProjDesc);
	info.setManagedProject(mProj);

	CfgHolder cfgHolder = new CfgHolder(null, null);
	String s = "0";
	Configuration config = new Configuration(mProj, (ToolChain)null, ManagedBuildManager.calculateChildId(s, null), cfgHolder.getName());
	IBuilder builder = config.getEditableBuilder();
	builder.setManagedBuildOn(false);
	CConfigurationData data = config.getConfigurationData();
	cProjDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);

	pdMgr.setProjectDescription(project, cProjDesc);
}
 
开发者ID:ffmmjj,项目名称:uefi_edk2_wizards_plugin,代码行数:19,代码来源:ExistingEdk2ModuleProjectCreator.java


示例6: buildAllConfigurations

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
protected void buildAllConfigurations(final IProject project) {
	final ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(project, false);
	if (prjd != null) {
		final ICConfigurationDescription[] cfgDescriptions = prjd.getConfigurations();
		if (cfgDescriptions != null && cfgDescriptions.length > 0) {
			final IConfiguration[] cfgs = new IConfiguration[cfgDescriptions.length];
			for (int i=0; i < cfgDescriptions.length; ++i) {
				cfgs[i] = ManagedBuildManager.getConfigurationForDescription(cfgDescriptions[i]);
			}
			final Job job = new Job("Building all configurations") {

				@Override
				protected IStatus run(IProgressMonitor monitor) {
					try {
						ManagedBuildManager.buildConfigurations(cfgs, monitor);
					} catch (CoreException e) {
						return e.getStatus();
					}
					return Status.OK_STATUS;
				}
			};
			job.schedule();
			waitForJobs();
		}
	}		
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:27,代码来源:AbstractTestBuild.java


示例7: createConfiguration

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
private IConfiguration createConfiguration(IConfiguration cfg, IManagedProject proj, ICProjectDescription des) throws WriteAccessException, CoreException {
	String id = ManagedBuildManager.calculateChildId(cfg.getId(), null);
	// CProjectDescriptionManager.getInstance();
	Configuration config = new Configuration((ManagedProject) proj, (Configuration) cfg, id, false, true);
	CConfigurationData data = config.getConfigurationData();
	ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
	config.setConfigurationDescription(cfgDes);
	config.exportArtifactInfo();

	// Force internal builder
	IBuilder internalBuilder = ManagedBuildManager.getInternalBuilder();
	config.changeBuilder(internalBuilder, internalBuilder.getId(), internalBuilder.getName());

	// IBuilder bld = config.getEditableBuilder();
	// if (bld != null) { bld.setManagedBuildOn(true); }

	config.setName(cfg.getName());
	config.setArtifactName(proj.getDefaultArtifactName());

	return config;
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:22,代码来源:CProjectConfigurator.java


示例8: createBuildConfigurations

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * @param cprojDesc
 * @return 
 */
private ICConfigurationDescription createBuildConfigurations(ICProjectDescription cprojDesc) throws CoreException {

	ManagedProject managedProject = new ManagedProject(cprojDesc);
	String configId = ManagedBuildManager.calculateChildId(CMAKE_TOOLCHAIN_ID, null);
	IToolChain cmakeToolChain = ManagedBuildManager.getExtensionToolChain(CMAKE_TOOLCHAIN_ID);
	org.eclipse.cdt.managedbuilder.internal.core.Configuration newConfig = new org.eclipse.cdt.managedbuilder.internal.core.Configuration(
			managedProject, (ToolChain) cmakeToolChain, configId, "debug");
	IToolChain newToolChain = newConfig.getToolChain();

	switch (Platform.getOS()) 
	{
		case "win32": {
			newConfig.getEditableBuilder().setCommand("mingw32-make.exe");
			break;
		}
		default: {
			newConfig.getEditableBuilder().setCommand("make");
			break;
		}
	}

	
	CConfigurationData data = newConfig.getConfigurationData();
	return cprojDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
}
 
开发者ID:rungemar,项目名称:cmake4cdt,代码行数:30,代码来源:CMakeProjectGenerator.java


示例9: isGeneratorChanged

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * Gets whether the user changed the generator setting in the preferences.
 *
 * @return {@code true} if the user changed the generator setting in the
 *         preferences, otherwise {@code false}
 */
private boolean isGeneratorChanged() {
  // load project properties..
  final ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(config);
  CMakePreferences prefs;
  try {
    prefs = ConfigurationManager.getInstance().getOrLoad(cfgd);
    AbstractOsPreferences osPrefs = AbstractOsPreferences.extractOsPreferences(prefs);
    return osPrefs.getGenerator() != osPrefs.getGeneratedWith();
  } catch (CoreException ex) {
    log.log(new Status(IStatus.ERROR, CdtPlugin.PLUGIN_ID, null, ex));
    return false;
  }
}
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:20,代码来源:BuildscriptGenerator.java


示例10: appendDefines

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * Appends arguments for the specified cmake defines. Performs substitutions
 * on variables found in a value of each define.
 *
 * @param args
 *        the list to append cmake-arguments to.
 * @param defines
 *        the cmake defines to convert and append.
 * @throws CoreException
 *         if unable to resolve the value of one or more variables
 */
private void appendDefines(List<String> args, final List<CmakeDefine> defines) throws CoreException {
  final ICdtVariableManager mngr = CCorePlugin.getDefault().getCdtVariableManager();
  final ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(config);
  for (CmakeDefine def : defines) {
    final StringBuilder sb = new StringBuilder("-D");
    sb.append(def.getName());
    sb.append(':').append(def.getType().getCmakeArg());
    sb.append('=');
    String expanded = mngr.resolveValue(def.getValue(), "", "", cfgd);
    sb.append(expanded);
    args.add(sb.toString());
  }
}
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:25,代码来源:BuildscriptGenerator.java


示例11: convertArtefactType

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
public static String convertArtefactType(final String narArtefactType) {
	if (NarBuildArtifact.EXECUTABLE.equals(narArtefactType)) {
		return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_EXE;
	}
	if (NarBuildArtifact.SHARED.equals(narArtefactType)) {
		return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_SHAREDLIB;
	}
	if (NarBuildArtifact.STATIC.equals(narArtefactType)) {
		return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_STATICLIB;
	}
	return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_SHAREDLIB;
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:13,代码来源:CdtUtils.java


示例12: isValid

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * Checks whether toolchain can be used on this system
 * 
 * @param tc
 * @return
 */
protected boolean isValid(IToolChain tc) {
	/*
	 * // Check for langiuage compatibility first in any case if
	 * (!isLanguageCompatible(tc, w)) return false;
	 */

	// Filter off unsupported and system toolchains
	if (tc == null || !tc.isSupported() || tc.isAbstract() || tc.isSystemObject())
		return false;

	// Check for platform compatibility
	return ManagedBuildManager.isPlatformOk(tc);
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:20,代码来源:CProjectConfigurator.java


示例13: getCfgs

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
protected List<IConfiguration> getCfgs(IToolChain tc, String artefactType) {
	List<IConfiguration> out = new ArrayList<IConfiguration>();
	IConfiguration[] cfgs = ManagedBuildManager.getExtensionConfigurations(tc, ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artefactType);
	if (cfgs != null) {
		for (IConfiguration cfg : cfgs) {
			if (isValid(cfg)) {
				out.add(cfg);
			}
		}
	}
	return out;
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:13,代码来源:CProjectConfigurator.java


示例14: getToolChain

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * Reorders selected configurations in "physical" order. Although toolchains
 * are displayed in alphabetical order in Wizard, it's required to create
 * corresponding configurations in the same order as they are listed in xml
 * file, inside of single project type.
 * 
 * @param its
 *            - items in initial order.
 * @return
 * @return - items in "physical" order.
 */
/*
 * public static List<IConfiguration> reorder(List<IConfiguration> cfgs) {
 * List<IConfiguration> ls = new ArrayList<IConfiguration>(cfgs.size());
 * IConfiguration[] its = cfgs.toArray(new IConfiguration[cfgs.size()]);
 * boolean found = true; while (found) { found = false; for (int i=0;
 * i<its.length; i++) { if (its[i] == null) continue; found = true;
 * IProjectType pt = its[i].getProjectType(); if (pt == null) {
 * ls.add(its[i]); its[i] = null; continue; } IConfiguration[] cfs =
 * pt.getConfigurations(); for (int j=0; j<cfs.length; j++) { for (int k=0;
 * k<its.length; k++) { if (its[k] == null) continue; if
 * (cfs[j].equals(its[k].getTcCfg())) { ls.add(its[k]); its[k] = null; } } }
 * } } return ls.toArray(new CfgHolder[ls.size()]); }
 */

private IToolChain getToolChain(final String toolChain, final String artefactType) throws CoreException {
	// Find the tool chains supported on our system for the selected
	// artefact type
	IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artefactType, true);
	// Find the tool chain
	IToolChain tc = null;
	for (IToolChain tc2 : tcs) {
		if (isValid(tc2) && toolChain.equals(tc2.getUniqueRealName())) {
			tc = tc2;
			break;
		}
	}
	if (tc == null) {
		throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Could not find valid tool chain \"" + toolChain + "\""));
	}
	return tc;
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:43,代码来源:CProjectConfigurator.java


示例15: getCMakeTool

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
private ITool getCMakeTool() {
	IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgd);
	ITool[] cmakeTools = cfg.getToolsBySuperClassId(CMakeMakefileGenerator.CMAKE_TOOL_ID);
	ITool cmakeTool = null;
	if(cmakeTools.length > 0) {
		cmakeTool = cmakeTools[0];
	}
	return cmakeTool;
}
 
开发者ID:rungemar,项目名称:cmake4cdt,代码行数:10,代码来源:CPropertyTab.java


示例16: invokeCMake

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * Run 'cmake -G xyz' command.
 *
 * @param console
 *        the build console to send messages to
 * @param buildDir
 *        abs. path
 * @param srcDir
 * @return a MultiStatus object, where .getCode() return the severity
 * @throws CoreException
 */
private MultiStatus invokeCMake(IPath srcDir, IPath buildDir, IConsole console) throws CoreException {
  Assert.isLegal(srcDir.isAbsolute(), "srcDir");
  Assert.isLegal(buildDir.isAbsolute(), "buildDir");

  String errMsg;
  final List<String> argList = buildCommandline(srcDir);
  // extract cmake command
  final String cmd = argList.get(0);
  argList.remove(0);
  // Set the environment
  IEnvironmentVariable[] variables = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(config, true);
  String[] envp = null;
  ArrayList<String> envList = new ArrayList<>();
  if (variables != null) {
    for (int i = 0; i < variables.length; i++) {
      envList.add(variables[i].getName() + "=" + variables[i].getValue()); //$NON-NLS-1$
    }
    envp = envList.toArray(new String[envList.size()]);
  }
  // run cmake..
  final ICommandLauncher launcher = builder.getCommandLauncher();
  launcher.showCommand(true);
  final Process proc =
      launcher.execute(new Path(cmd), argList.toArray(new String[argList.size()]), envp, buildDir, monitor);
  if (proc != null) {
    try {
      // Close the input of the process since we will never write to it
      proc.getOutputStream().close();
    } catch (IOException e) {
    }
    int state = launcher.waitAndRead(console.getOutputStream(), console.getErrorStream(),
        new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
    if (state == ICommandLauncher.COMMAND_CANCELED) {
      throw new OperationCanceledException(launcher.getErrorMessage());
    }

    // check cmake exit status
    final int exitValue = proc.exitValue();
    if (exitValue == 0) {
      // success
      return new MultiStatus(CdtPlugin.PLUGIN_ID, IStatus.OK, null, null);
    } else {
      // cmake had errors...
      errMsg = String.format("%1$s exited with status %2$d. See CDT global build console for details.", cmd, exitValue);
      return new MultiStatus(CdtPlugin.PLUGIN_ID, IStatus.ERROR, errMsg, null);
    }
  } else {
    // process start failed
    errMsg = launcher.getErrorMessage();
    return new MultiStatus(CdtPlugin.PLUGIN_ID, IStatus.ERROR, errMsg, null);
  }
}
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:64,代码来源:BuildscriptGenerator.java


示例17: invokeBuild

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
@Override
public boolean invokeBuild(int kind, IProject project,
    IConfiguration configuration, IBuilder builder, IConsole console,
    IMarkerGenerator markerGenerator,
    IncrementalProjectBuilder projectBuilder, IProgressMonitor monitor)
    throws CoreException {
  /*
   * wrap the passed-in builder into one that gets its build command from the
   * Cmake-generator. First do a sanity check.
   */
  if (builder.getBaseId().equals("de.marw.cdt.cmake.core.genscriptbuilder")) {
    final ICConfigurationDescription cfgd = ManagedBuildManager
        .getDescriptionForConfiguration(configuration);

    if (kind == IncrementalProjectBuilder.CLEAN_BUILD) {
      // avoid calling 'rm -rf' if it is a clean build and the build dir was
      // deleted
      final IPath builderCWD = cfgd.getBuildSetting().getBuilderCWD();
      final IPath location = ResourcesPlugin.getWorkspace().getRoot().getFile(builderCWD).getLocation();
      if (location == null || !location.toFile().exists()) {
        return true; // is clean
      }
    }

    final CMakePreferences prefs = ConfigurationManager.getInstance()
        .getOrLoad(cfgd);
    final AbstractOsPreferences osPrefs = AbstractOsPreferences
        .extractOsPreferences(prefs);

    // try to get CMAKE_BUILD_TOOL entry from CMakeCache.txt...
    final CmakeGenerator generator = osPrefs.getGenerator();
    String buildscriptProcessorCmd = getCommandFromCMakeCache(cfgd,
        generator != osPrefs.getGeneratedWith());
    if (buildscriptProcessorCmd == null) {
      // fall back to values from OS preferences
      buildscriptProcessorCmd = osPrefs.getBuildscriptProcessorCommand();
      if (buildscriptProcessorCmd == null) {
        // fall back to built-in defaults from CMake generator
        buildscriptProcessorCmd = generator.getBuildscriptProcessorCommand();
      }
    }
    builder = new CmakeBuildToolInjectorBuilder(builder,
        buildscriptProcessorCmd, generator);
  }
  return super.invokeBuild(kind, project, configuration, builder, console,
      markerGenerator, projectBuilder, monitor);
}
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:48,代码来源:CmakeBuildRunner.java


示例18: getCdtMavenConfig

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
private ICConfigurationDescription getCdtMavenConfig(IProject project, ICProjectDescription des, IToolChain tc, String artefactType, String name,
		boolean setActive, IProgressMonitor monitor) throws CoreException {
	IManagedProject mProj = ManagedBuildManager.getBuildInfo(project).getManagedProject();
	ICConfigurationDescription mavenCfg = des.getConfigurationByName(name);
	if (mavenCfg == null) {
		List<IConfiguration> cfgs = getCfgs(tc, artefactType);

		if (cfgs.isEmpty()) {
			throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot find any configurations"));
		}
		monitor.worked(10);
		monitor.worked(10);
		// cfgs = CfgHolder.unique(cfgs);
		// cfgs = CfgHolder.reorder(cfgs);

		IConfiguration cfgRelease = null;
		IConfiguration cfgFirst = null;

		int work = 50 / cfgs.size();

		for (IConfiguration cfg : cfgs) {
			IBuildProperty b = cfg.getBuildProperties().getProperty(ManagedBuildManager.BUILD_TYPE_PROPERTY_ID);
			if (cfgRelease == null && b != null && b.getValue() != null && ManagedBuildManager.BUILD_TYPE_PROPERTY_RELEASE.equals(b.getValue().getId())) {
				cfgRelease = cfg;
			}
			if (cfgFirst == null) {
				cfgFirst = cfg;
			}
			monitor.worked(work);
		}
		if (cfgFirst != null) {
			if (cfgRelease != null) {
				cfgFirst = cfgRelease;
			}
			MavenNarPlugin.getDefault().log("Creating configuration " + name);
			IConfiguration newCfg = createConfiguration(cfgFirst, mProj, des);
			newCfg.setName(name);
			newCfg.setDescription("m2e generated configuration");
			mavenCfg = ManagedBuildManager.getDescriptionForConfiguration(newCfg);
		}
	}
	if (mavenCfg != null) {
		if (setActive) {
			des.setActiveConfiguration(mavenCfg);
		}
		return mavenCfg;
	} else {
		throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot find any configurations"));
	}
	// mngr.setProjectDescription(project, des);
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:52,代码来源:CProjectConfigurator.java


示例19: setupProject

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
/**
 * @param monitor
 */
public void setupProject(IProgressMonitor monitor) throws CoreException {
	// Add CMake nature
	IProjectDescription projDesc = project.getDescription();
	boolean cmakeNatureAlreadyThere = false;
	String[] oldIds = projDesc.getNatureIds();

	for(int i=0; i < oldIds.length; i++) {
		if(oldIds[i].equals(CMakeProjectNature.CMAKE_NATURE_ID)) {
			cmakeNatureAlreadyThere = true;
		}
	}
	if(!cmakeNatureAlreadyThere) {
		String[] newIds = new String[oldIds.length + 1];
		System.arraycopy(oldIds, 0, newIds, 0, oldIds.length);
		newIds[newIds.length - 1] = CMakeProjectNature.CMAKE_NATURE_ID;
		projDesc.setNatureIds(newIds);
		project.setDescription(projDesc, monitor);
	}

	// create the CDT natures and build setup
	CCorePlugin.getDefault().createCDTProject(projDesc, project, monitor);
	CCorePlugin.getDefault().convertProjectFromCtoCC(project, monitor);
	
	ICProjectDescription cprojDesc = CCorePlugin.getDefault().createProjectDescription(project, false);
	ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
	ManagedProject mProj = new ManagedProject(cprojDesc);
	info.setManagedProject(mProj);

	createBuildConfigurations(cprojDesc);

	// Add CMake builder
	projDesc = project.getDescription();
	ICommand[] oldBuilders = projDesc.getBuildSpec();

	boolean genMakeBilderAlreadyThere = false;
	boolean cmakeBuilderAlreadyThere = false;
	int additionalBuilders = 2;
	for(int i=0; i < oldBuilders.length; i++) {
		if(oldBuilders[i].getBuilderName().equals(CMAKE_BUILDER_ID)) {
			cmakeBuilderAlreadyThere = true;
			additionalBuilders--;
		}
		if(oldBuilders[i].getBuilderName().equals(GEN_MAKE_BUILDER_ID)) {
			genMakeBilderAlreadyThere = true;
			additionalBuilders--;
		}
	}
	if(additionalBuilders < 0) {
		additionalBuilders = 0;
	}

	ICommand[] newBuilders = new ICommand[oldBuilders.length + additionalBuilders];
	
	if(!cmakeBuilderAlreadyThere) {
		ICommand cmakeBuilder = projDesc.newCommand();
		cmakeBuilder.setBuilderName(CMAKE_BUILDER_ID);
		cmakeBuilder.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true);
		cmakeBuilder.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, true);
		cmakeBuilder.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true);
		newBuilders[0] = cmakeBuilder;
	}
	
	if(!genMakeBilderAlreadyThere) {
		ICommand makeBuilder = projDesc.newCommand();
		makeBuilder.setBuilderName(GEN_MAKE_BUILDER_ID);
		makeBuilder.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true);
		makeBuilder.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, true);
		makeBuilder.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true);
		newBuilders[1] = makeBuilder;
	}		
	System.arraycopy(oldBuilders, 0, newBuilders, additionalBuilders, oldBuilders.length);
	
	projDesc.setBuildSpec(newBuilders);
	project.setDescription(projDesc, monitor);		

	CCorePlugin.getDefault().setProjectDescription(project, cprojDesc, true, monitor);
}
 
开发者ID:rungemar,项目名称:cmake4cdt,代码行数:81,代码来源:CMakeProjectGenerator.java


示例20: setToolSettings

import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; //导入依赖的package包/类
private void setToolSettings()  {
		
		
//		if( settingsChanged() ) {
			rmOutputDir();
//		}
		ITool cmakeTool = getCMakeTool();
		
		try {
	        // -- get resource info. (where things are saved to).
	        IResourceInfo resourceInfos[] = ManagedBuildManager.getConfigurationForDescription(cfgd).getResourceInfos();
	        IResourceInfo resourceInfo = resourceInfos[0];

	        IOption toolchainfileOptionTmpl = cmakeTool.getOptionById(CMAKE_OPTION_TOOLCHAINFILE);

	        IOption toolchainfileOption = cmakeTool.getOptionToSet(toolchainfileOptionTmpl, false);
			toolchainfileOption.setValue(m_toolchainFile);
	        ManagedBuildManager.setOption(resourceInfo, cmakeTool, toolchainfileOption, m_toolchainFile);

			IOption builyTypeOptionTmpl = cmakeTool.getOptionById(CMAKE_OPTION_BUILDTYPE);
			IOption builyTypeOption = cmakeTool.getOptionToSet(builyTypeOptionTmpl, false);
			builyTypeOption.setValue(m_buildType);
	        ManagedBuildManager.setOption(resourceInfo, cmakeTool, toolchainfileOption, m_toolchainFile);

			IOption debugOptionTmpl = cmakeTool.getOptionById(CMAKE_OPTION_DEBUG);
			IOption debugOption = cmakeTool.getOptionToSet(debugOptionTmpl, false);
			debugOption.setValue(m_debug);
	        ManagedBuildManager.setOption(resourceInfo, cmakeTool, toolchainfileOption, m_toolchainFile);
			
			IOption traceOptionTmpl = cmakeTool.getOptionById(CMAKE_OPTION_TRACE);
			IOption traceOption = cmakeTool.getOptionToSet(traceOptionTmpl, false);
			traceOption.setValue(m_trace);
	        ManagedBuildManager.setOption(resourceInfo, cmakeTool, toolchainfileOption, m_toolchainFile);
 
	        // ------ Save this business to disk.
	        ManagedBuildManager.saveBuildInfo(cfgd.getProjectDescription().getProject(), true);
			
		} catch (BuildException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
	}
 
开发者ID:rungemar,项目名称:cmake4cdt,代码行数:44,代码来源:CPropertyTab.java



注:本文中的org.eclipse.cdt.managedbuilder.core.ManagedBuildManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RestfulServer类代码示例发布时间:2022-05-23
下一篇:
Java Environment类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap