0

我有多个自定义生成的配置在我的项目,如下图所示: Screenshot of build configurations如何在工作区启动时从“调试”更改默认/活动构建配置?

在工作区设置在默认情况下它“调试”配置打开。我必须将此更改为'Rev8 Release'(我的自定义配置之一)。

的一种方式,我可以通过手动编辑.cprojects文件(自动生成的项目设置文件)实现这一点,前“调试”粘贴“Rev8发布”配置。但我需要一个适当的方法(通过更改项目设置)来做到这一点,而无需手动编辑'.cprojects'

回答

0

我建议检出ManagedBuildManager。它可以用来检索/修改项目的构建信息。

IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(iproject); //iproject is the currently selected project in Project Explorer 
IConfiguration [] buildConfigs = info.getManagedProject().getConfigurations(); //Get the available build configurations of the project 
info.setDefaultConfiguration(buildConfigs[i]); //Set default build configuration 
try { 
ManagedBuildManager.saveBuildInfo(iproject, true); //Apply changes 
} catch (Exception e) { 
}