mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
1. Initial commit for [Bug 161603] Project References need mechanism to inherit build config...
2. CProjectDescription update methods 3. Bug-fixes
This commit is contained in:
parent
29eec1d60a
commit
17a776c11a
6 changed files with 436 additions and 137 deletions
|
@ -127,6 +127,76 @@ public class CommonBuilder extends ACBuilder {
|
||||||
System.err.println(ERROR_HEADER + resourceName + TRACE_FOOTER + message + NEWLINE);
|
System.err.println(ERROR_HEADER + resourceName + TRACE_FOOTER + message + NEWLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class NullConsole implements IConsole { // return a null console
|
||||||
|
private ConsoleOutputStream nullStream = new ConsoleOutputStream() {
|
||||||
|
public void write(byte[] b) throws IOException {
|
||||||
|
}
|
||||||
|
public void write(byte[] b, int off, int len) throws IOException {
|
||||||
|
}
|
||||||
|
public void write(int c) throws IOException {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public void start(IProject project) {
|
||||||
|
}
|
||||||
|
// this can be a null console....
|
||||||
|
public ConsoleOutputStream getOutputStream() {
|
||||||
|
return nullStream;
|
||||||
|
}
|
||||||
|
public ConsoleOutputStream getInfoStream() {
|
||||||
|
return nullStream;
|
||||||
|
}
|
||||||
|
public ConsoleOutputStream getErrorStream() {
|
||||||
|
return nullStream;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static class CfgBuildInfo {
|
||||||
|
private IProject fProject;
|
||||||
|
private IManagedBuildInfo fBuildInfo;
|
||||||
|
private IConfiguration fCfg;
|
||||||
|
private IBuilder fBuilder;
|
||||||
|
private IConsole fConsole;
|
||||||
|
private boolean fIsForeground;
|
||||||
|
|
||||||
|
CfgBuildInfo(IBuilder builder, boolean isForegound){
|
||||||
|
this.fBuilder = builder;
|
||||||
|
this.fCfg = builder.getParent().getParent();
|
||||||
|
this.fIsForeground = isForegound;
|
||||||
|
this.fProject = this.fCfg.getOwner().getProject();
|
||||||
|
this.fBuildInfo = ManagedBuildManager.getBuildInfo(this.fProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IProject getProject(){
|
||||||
|
return fProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConsole getConsole(){
|
||||||
|
if(fConsole == null){
|
||||||
|
fConsole = fIsForeground ? CCorePlugin.getDefault().getConsole() : new NullConsole();
|
||||||
|
fConsole.start(fProject);
|
||||||
|
}
|
||||||
|
return fConsole;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isForeground(){
|
||||||
|
return fIsForeground;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBuilder getBuilder(){
|
||||||
|
return fBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConfiguration getConfiguration(){
|
||||||
|
return fCfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IManagedBuildInfo getBuildInfo(){
|
||||||
|
return fBuildInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class ResourceDeltaVisitor implements IResourceDeltaVisitor {
|
public class ResourceDeltaVisitor implements IResourceDeltaVisitor {
|
||||||
private String buildGoalName;
|
private String buildGoalName;
|
||||||
|
@ -363,12 +433,13 @@ public class CommonBuilder extends ACBuilder {
|
||||||
* @see IncrementalProjectBuilder#build
|
* @see IncrementalProjectBuilder#build
|
||||||
*/
|
*/
|
||||||
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
|
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
|
||||||
IBuilder builders[] = BuilderFactory.createBuilders(getProject(), args);
|
IProject project = getProject();
|
||||||
|
IBuilder builders[] = BuilderFactory.createBuilders(project, args);
|
||||||
int num = builders.length;
|
int num = builders.length;
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||||
IConfiguration activeCfg = info.getDefaultConfiguration();
|
IConfiguration activeCfg = info.getDefaultConfiguration();
|
||||||
|
IProject[] refProjects = project.getReferencedProjects();
|
||||||
if(num != 0){
|
if(num != 0){
|
||||||
|
|
||||||
MultiStatus status = checkBuilders(builders, activeCfg);
|
MultiStatus status = checkBuilders(builders, activeCfg);
|
||||||
if(status.getSeverity() != IStatus.OK)
|
if(status.getSeverity() != IStatus.OK)
|
||||||
throw new CoreException(status);
|
throw new CoreException(status);
|
||||||
|
@ -377,18 +448,51 @@ public class CommonBuilder extends ACBuilder {
|
||||||
|
|
||||||
monitor.beginTask("", num + cfgs.length); //$NON-NLS-1$
|
monitor.beginTask("", num + cfgs.length); //$NON-NLS-1$
|
||||||
|
|
||||||
if(cfgs.length != 0)
|
if(cfgs.length != 0){
|
||||||
ManagedBuildManager.buildConfigurations(cfgs, new SubProgressMonitor(monitor, 1));
|
Set set = getProjectsSet(cfgs);
|
||||||
|
if(set.size() != 0){
|
||||||
|
set.addAll(Arrays.asList(refProjects));
|
||||||
|
refProjects = (IProject[])set.toArray(new IProject[set.size()]);
|
||||||
|
}
|
||||||
|
buildReferencedConfigs(cfgs, new SubProgressMonitor(monitor, 1));
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 0; i < num; i++){
|
for(int i = 0; i < num; i++){
|
||||||
build(kind, builders[i], info, new SubProgressMonitor(monitor, 1));
|
build(kind, new CfgBuildInfo(builders[i], true), new SubProgressMonitor(monitor, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateOtherConfigs(builders, kind);
|
updateOtherConfigs(info, builders, kind);
|
||||||
|
|
||||||
monitor.done();
|
monitor.done();
|
||||||
return getProject().getReferencedProjects();
|
return project.getReferencedProjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildReferencedConfigs(IConfiguration[] cfgs, IProgressMonitor monitor){
|
||||||
|
cfgs = filterConfigsToBuild(cfgs);
|
||||||
|
if(cfgs.length != 0){
|
||||||
|
monitor.beginTask("Building referenced configurations..", cfgs.length);
|
||||||
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
|
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
|
||||||
|
try {
|
||||||
|
IConfiguration cfg = cfgs[i];
|
||||||
|
IBuilder builder = cfg.getEditableBuilder();
|
||||||
|
CfgBuildInfo bInfo = new CfgBuildInfo(builder, false);
|
||||||
|
build(INCREMENTAL_BUILD, bInfo, subMonitor);
|
||||||
|
} catch (CoreException e){
|
||||||
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
} finally {
|
||||||
|
subMonitor.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IConfiguration[] filterConfigsToBuild(IConfiguration[] cfgs){
|
||||||
|
//TODO:
|
||||||
|
return cfgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IConfiguration[] getReferencedConfigs(IBuilder[] builders){
|
private IConfiguration[] getReferencedConfigs(IBuilder[] builders){
|
||||||
|
@ -403,6 +507,18 @@ public class CommonBuilder extends ACBuilder {
|
||||||
return (IConfiguration[]) set.toArray(new Configuration[set.size()]);
|
return (IConfiguration[]) set.toArray(new Configuration[set.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Set getProjectsSet(IConfiguration[] cfgs){
|
||||||
|
if(cfgs.length == 0)
|
||||||
|
return new HashSet(0);
|
||||||
|
|
||||||
|
Set set = new HashSet();
|
||||||
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
|
set.add(cfgs[i].getOwner().getProject());
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
protected MultiStatus checkBuilders(IBuilder builders[], IConfiguration activeCfg){
|
protected MultiStatus checkBuilders(IBuilder builders[], IConfiguration activeCfg){
|
||||||
MultiStatus status = null;
|
MultiStatus status = null;
|
||||||
for(int i = 0; i < builders.length; i++){
|
for(int i = 0; i < builders.length; i++){
|
||||||
|
@ -458,11 +574,9 @@ public class CommonBuilder extends ACBuilder {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateOtherConfigs(IBuilder builders[], int buildKind){
|
private void updateOtherConfigs(IManagedBuildInfo info, IBuilder builders[], int buildKind){
|
||||||
//IProject project
|
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
|
|
||||||
IConfiguration allCfgs[] = info.getManagedProject().getConfigurations();
|
IConfiguration allCfgs[] = info.getManagedProject().getConfigurations();
|
||||||
new OtherConfigVerifier(builders, allCfgs).updateOtherConfigs(buildKind == FULL_BUILD ? null : getDelta(getProject()));
|
new OtherConfigVerifier(builders, allCfgs).updateOtherConfigs(buildKind == FULL_BUILD ? null : getDelta(info.getManagedProject().getOwner().getProject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class BuildStatus {
|
protected class BuildStatus {
|
||||||
|
@ -509,7 +623,8 @@ public class CommonBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void build(int kind, IBuilder builder, IManagedBuildInfo info, IProgressMonitor monitor) throws CoreException{
|
protected void build(int kind, CfgBuildInfo bInfo, IProgressMonitor monitor) throws CoreException{
|
||||||
|
IBuilder builder = bInfo.getBuilder();
|
||||||
BuildStatus status = new BuildStatus(builder);
|
BuildStatus status = new BuildStatus(builder);
|
||||||
if (!shouldBuild(kind, builder)) {
|
if (!shouldBuild(kind, builder)) {
|
||||||
return;
|
return;
|
||||||
|
@ -529,20 +644,20 @@ public class CommonBuilder extends ACBuilder {
|
||||||
if (status.isBuild()) {
|
if (status.isBuild()) {
|
||||||
// IManagedBuilderMakefileGenerator makeGen = null;
|
// IManagedBuilderMakefileGenerator makeGen = null;
|
||||||
if(status.isManagedBuildOn()){
|
if(status.isManagedBuildOn()){
|
||||||
status = performPrebuildGeneration(kind, builder, info, status, monitor);
|
status = performPrebuildGeneration(kind, bInfo, status, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
IConfiguration cfg = builder.getParent().getParent();
|
IConfiguration cfg = builder.getParent().getParent();
|
||||||
|
|
||||||
if(status.isBuild()){
|
if(status.isBuild()){
|
||||||
try {
|
try {
|
||||||
boolean isClean = invokeBuilder(kind, builder, monitor);
|
boolean isClean = invokeBuilder(kind, bInfo, monitor);
|
||||||
if (isClean) {
|
if (isClean) {
|
||||||
forgetLastBuiltState();
|
forgetLastBuiltState();
|
||||||
cfg.setRebuildState(true);
|
cfg.setRebuildState(true);
|
||||||
} else {
|
} else {
|
||||||
if(status.isManagedBuildOn()){
|
if(status.isManagedBuildOn()){
|
||||||
performPostbuildGeneration(kind, builder, info, status, monitor);
|
performPostbuildGeneration(kind, bInfo, status, monitor);
|
||||||
}
|
}
|
||||||
cfg.setRebuildState(false);
|
cfg.setRebuildState(false);
|
||||||
}
|
}
|
||||||
|
@ -551,7 +666,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} else if(status.getConsoleMessagesList().size() != 0) {
|
} else if(status.getConsoleMessagesList().size() != 0) {
|
||||||
emitMessage(concatMessages(status.getConsoleMessagesList()));
|
emitMessage(bInfo, concatMessages(status.getConsoleMessagesList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkCancel(monitor);
|
checkCancel(monitor);
|
||||||
|
@ -582,17 +697,19 @@ public class CommonBuilder extends ACBuilder {
|
||||||
* @param status
|
* @param status
|
||||||
* @param configName
|
* @param configName
|
||||||
*/
|
*/
|
||||||
private String createNoSourceMessage(int buildType, IStatus status, String configName) throws CoreException {
|
private String createNoSourceMessage(int buildType, IStatus status, CfgBuildInfo bInfo) throws CoreException {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
String[] consoleHeader = new String[3];
|
String[] consoleHeader = new String[3];
|
||||||
|
String configName = bInfo.getConfiguration().getName();
|
||||||
|
String projName = bInfo.getProject().getName();
|
||||||
if (buildType == FULL_BUILD || buildType == INCREMENTAL_BUILD) {
|
if (buildType == FULL_BUILD || buildType == INCREMENTAL_BUILD) {
|
||||||
consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_INC);
|
consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_INC);
|
||||||
} else {
|
} else {
|
||||||
consoleHeader[0] = new String();
|
consoleHeader[0] = new String();
|
||||||
outputError(getProject().getName(), "The given build type is not supported in this context"); //$NON-NLS-1$
|
outputError(projName, "The given build type is not supported in this context"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
consoleHeader[1] = configName;
|
consoleHeader[1] = configName;
|
||||||
consoleHeader[2] = getProject().getName();
|
consoleHeader[2] = projName;
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
|
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -602,9 +719,9 @@ public class CommonBuilder extends ACBuilder {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void emitMessage(String msg) throws CoreException {
|
private void emitMessage(CfgBuildInfo info, String msg) throws CoreException {
|
||||||
try {
|
try {
|
||||||
IConsole console = getConsole();
|
IConsole console = info.getConsole();
|
||||||
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
||||||
// Report a successful clean
|
// Report a successful clean
|
||||||
consoleOutStream.write(msg.getBytes());
|
consoleOutStream.write(msg.getBytes());
|
||||||
|
@ -619,11 +736,11 @@ public class CommonBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IConsole getConsole(){
|
// private IConsole getConsole(IProject project, boolean bg){
|
||||||
IConsole console = CCorePlugin.getDefault().getConsole();
|
// IConsole console = CCorePlugin.getDefault().getConsole();
|
||||||
console.start(getProject());
|
// console.start(project);
|
||||||
return console;
|
// return console;
|
||||||
}
|
// }
|
||||||
/**
|
/**
|
||||||
* called to invoke the MBS Internal Builder for building the given configuration
|
* called to invoke the MBS Internal Builder for building the given configuration
|
||||||
*
|
*
|
||||||
|
@ -635,16 +752,17 @@ public class CommonBuilder extends ACBuilder {
|
||||||
* If false the build will stop on the first error
|
* If false the build will stop on the first error
|
||||||
* @param monitor monitor
|
* @param monitor monitor
|
||||||
*/
|
*/
|
||||||
protected boolean invokeInternalBuilder(int kind, IBuilder builder,
|
protected boolean invokeInternalBuilder(int kind, CfgBuildInfo bInfo,
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
|
|
||||||
IConfiguration cfg = builder.getParent().getParent();
|
IBuilder builder = bInfo.getBuilder();
|
||||||
|
IConfiguration cfg = bInfo.getConfiguration();
|
||||||
boolean isParallel = builder.getParallelizationNum() != 0;
|
boolean isParallel = builder.getParallelizationNum() != 0;
|
||||||
// boolean buildIncrementaly = true;
|
// boolean buildIncrementaly = true;
|
||||||
boolean resumeOnErr = !builder.isStopOnError();
|
boolean resumeOnErr = !builder.isStopOnError();
|
||||||
|
|
||||||
// Get the project and make sure there's a monitor to cancel the build
|
// Get the project and make sure there's a monitor to cancel the build
|
||||||
IProject currentProject = cfg.getOwner().getProject();
|
IProject currentProject = bInfo.getProject();
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
|
@ -675,8 +793,9 @@ public class CommonBuilder extends ACBuilder {
|
||||||
|
|
||||||
// Get a build console for the project
|
// Get a build console for the project
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
console = CCorePlugin.getDefault().getConsole();
|
// console = CCorePlugin.getDefault().getConsole();
|
||||||
console.start(currentProject);
|
// console.start(currentProject);
|
||||||
|
console = bInfo.getConsole();
|
||||||
consoleOutStream = console.getOutputStream();
|
consoleOutStream = console.getOutputStream();
|
||||||
String[] consoleHeader = new String[3];
|
String[] consoleHeader = new String[3];
|
||||||
if(buildIncrementaly)
|
if(buildIncrementaly)
|
||||||
|
@ -708,7 +827,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
|
|
||||||
// Hook up an error parser manager
|
// Hook up an error parser manager
|
||||||
String[] errorParsers = builder.getErrorParsers();
|
String[] errorParsers = builder.getErrorParsers();
|
||||||
ErrorParserManager epm = new ErrorParserManager(getProject(), des.getDefaultBuildDirLocation(), this, errorParsers);
|
ErrorParserManager epm = new ErrorParserManager(currentProject, des.getDefaultBuildDirLocation(), this, errorParsers);
|
||||||
epm.setOutputStream(consoleOutStream);
|
epm.setOutputStream(consoleOutStream);
|
||||||
// This variable is necessary to ensure that the EPM stream stay open
|
// This variable is necessary to ensure that the EPM stream stay open
|
||||||
// until we explicitly close it. See bug#123302.
|
// until we explicitly close it. See bug#123302.
|
||||||
|
@ -771,7 +890,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
epm.reportProblems();
|
epm.reportProblems();
|
||||||
} else {
|
} else {
|
||||||
buf = new StringBuffer();
|
buf = new StringBuffer();
|
||||||
buf.append(ManagedMakeMessages.getFormattedString(NOTHING_BUILT, getProject().getName()));
|
buf.append(ManagedMakeMessages.getFormattedString(NOTHING_BUILT, currentProject.getName()));
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
consoleOutStream.write(buf.toString().getBytes());
|
consoleOutStream.write(buf.toString().getBytes());
|
||||||
consoleOutStream.flush();
|
consoleOutStream.flush();
|
||||||
|
@ -854,7 +973,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
* If false the build will stop on the first error
|
* If false the build will stop on the first error
|
||||||
* @param monitor Progress monitor. For every resource built this monitor will consume one unit of work.
|
* @param monitor Progress monitor. For every resource built this monitor will consume one unit of work.
|
||||||
*/
|
*/
|
||||||
public void invokeInternalBuilder(IResource[] resourcesToBuild, IConfiguration cfg,
|
private void invokeInternalBuilder(IResource[] resourcesToBuild, CfgBuildInfo bInfo,
|
||||||
boolean buildIncrementaly,
|
boolean buildIncrementaly,
|
||||||
boolean resumeOnErr,
|
boolean resumeOnErr,
|
||||||
boolean initNewConsole,
|
boolean initNewConsole,
|
||||||
|
@ -862,7 +981,9 @@ public class CommonBuilder extends ACBuilder {
|
||||||
IProgressMonitor monitor) {
|
IProgressMonitor monitor) {
|
||||||
// Get the project and make sure there's a monitor to cancel the build
|
// Get the project and make sure there's a monitor to cancel the build
|
||||||
|
|
||||||
IProject currentProject = cfg.getOwner().getProject();
|
IProject currentProject = bInfo.getProject();
|
||||||
|
IConfiguration cfg = bInfo.getConfiguration();
|
||||||
|
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
|
@ -881,8 +1002,9 @@ public class CommonBuilder extends ACBuilder {
|
||||||
msgs[0] = ManagedMakeMessages.getResourceString(INTERNAL_BUILDER);
|
msgs[0] = ManagedMakeMessages.getResourceString(INTERNAL_BUILDER);
|
||||||
msgs[1] = currentProject.getName();
|
msgs[1] = currentProject.getName();
|
||||||
|
|
||||||
IConsole console = CCorePlugin.getDefault().getConsole();
|
// IConsole console = CCorePlugin.getDefault().getConsole();
|
||||||
console.start(currentProject);
|
// console.start(currentProject);
|
||||||
|
IConsole console = bInfo.getConsole();
|
||||||
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
||||||
|
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -1044,7 +1166,8 @@ public class CommonBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BuildStatus performPostbuildGeneration(int kind, IBuilder builder, IManagedBuildInfo mInfo, BuildStatus buildStatus, IProgressMonitor monitor) throws CoreException{
|
protected BuildStatus performPostbuildGeneration(int kind, CfgBuildInfo bInfo, BuildStatus buildStatus, IProgressMonitor monitor) throws CoreException{
|
||||||
|
IBuilder builder = bInfo.getBuilder();
|
||||||
if(builder.isInternalBuilder())
|
if(builder.isInternalBuilder())
|
||||||
return buildStatus;
|
return buildStatus;
|
||||||
|
|
||||||
|
@ -1057,18 +1180,18 @@ public class CommonBuilder extends ACBuilder {
|
||||||
return buildStatus;
|
return buildStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BuildStatus performPrebuildGeneration(int kind, IBuilder builder, IManagedBuildInfo mInfo, BuildStatus buildStatus, IProgressMonitor monitor) throws CoreException{
|
protected BuildStatus performPrebuildGeneration(int kind, CfgBuildInfo bInfo, BuildStatus buildStatus, IProgressMonitor monitor) throws CoreException{
|
||||||
|
IBuilder builder = bInfo.getBuilder();
|
||||||
if(builder.isInternalBuilder())
|
if(builder.isInternalBuilder())
|
||||||
return buildStatus;
|
return buildStatus;
|
||||||
|
|
||||||
IConfiguration cfg = builder.getParent().getParent();
|
buildStatus = performCleanning(kind, bInfo, buildStatus, monitor);
|
||||||
buildStatus = performCleanning(kind, cfg, builder, mInfo, buildStatus, monitor);
|
|
||||||
IManagedBuilderMakefileGenerator generator = builder.getBuildFileGenerator();
|
IManagedBuilderMakefileGenerator generator = builder.getBuildFileGenerator();
|
||||||
if(generator != null){
|
if(generator != null){
|
||||||
initializeGenerator(generator, kind, cfg, builder, mInfo, monitor);
|
initializeGenerator(generator, kind, bInfo, monitor);
|
||||||
buildStatus.setMakeGen(generator);
|
buildStatus.setMakeGen(generator);
|
||||||
|
|
||||||
MultiStatus result = performMakefileGeneration(generator, buildStatus, monitor);
|
MultiStatus result = performMakefileGeneration(bInfo, generator, buildStatus, monitor);
|
||||||
if (result.getCode() == IStatus.WARNING || result.getCode() == IStatus.INFO) {
|
if (result.getCode() == IStatus.WARNING || result.getCode() == IStatus.INFO) {
|
||||||
IStatus[] kids = result.getChildren();
|
IStatus[] kids = result.getChildren();
|
||||||
for (int index = 0; index < kids.length; ++index) {
|
for (int index = 0; index < kids.length; ++index) {
|
||||||
|
@ -1084,7 +1207,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
// }
|
// }
|
||||||
if (status.getCode() == IManagedBuilderMakefileGenerator.NO_SOURCE_FOLDERS) {
|
if (status.getCode() == IManagedBuilderMakefileGenerator.NO_SOURCE_FOLDERS) {
|
||||||
// performBuild = false;
|
// performBuild = false;
|
||||||
buildStatus.getConsoleMessagesList().add(createNoSourceMessage(kind, status, cfg.getName()));
|
buildStatus.getConsoleMessagesList().add(createNoSourceMessage(kind, status, bInfo));
|
||||||
buildStatus.cancelBuild();
|
buildStatus.cancelBuild();
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
|
@ -1113,21 +1236,25 @@ public class CommonBuilder extends ACBuilder {
|
||||||
return buildStatus;
|
return buildStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BuildStatus performCleanning(int kind, IConfiguration cfg, IBuilder builder, IManagedBuildInfo mInfo, BuildStatus status, IProgressMonitor monitor) throws CoreException{
|
protected BuildStatus performCleanning(int kind, CfgBuildInfo bInfo, BuildStatus status, IProgressMonitor monitor) throws CoreException{
|
||||||
|
IConfiguration cfg = bInfo.getConfiguration();
|
||||||
|
IProject curProject = bInfo.getProject();
|
||||||
|
// IBuilder builder = bInfo.getBuilder();
|
||||||
|
|
||||||
boolean makefileRegenerationNeeded = false;
|
boolean makefileRegenerationNeeded = false;
|
||||||
//perform necessary cleaning and build type calculation
|
//perform necessary cleaning and build type calculation
|
||||||
if(cfg.needsFullRebuild()){
|
if(cfg.needsFullRebuild()){
|
||||||
//configuration rebuild state is set to true,
|
//configuration rebuild state is set to true,
|
||||||
//full rebuild is needed in any case
|
//full rebuild is needed in any case
|
||||||
//clean first, then make a full build
|
//clean first, then make a full build
|
||||||
outputTrace(getProject().getName(), "config rebuild state is set to true, making a full rebuild"); //$NON-NLS-1$
|
outputTrace(curProject.getName(), "config rebuild state is set to true, making a full rebuild"); //$NON-NLS-1$
|
||||||
clean(builder, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
|
clean(bInfo, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
|
||||||
makefileRegenerationNeeded = true;
|
makefileRegenerationNeeded = true;
|
||||||
} else {
|
} else {
|
||||||
makefileRegenerationNeeded = cfg.needsRebuild();
|
makefileRegenerationNeeded = cfg.needsRebuild();
|
||||||
IBuildDescription des = null;
|
IBuildDescription des = null;
|
||||||
|
|
||||||
IResourceDelta delta = kind == FULL_BUILD ? null : getDelta(getProject());
|
IResourceDelta delta = kind == FULL_BUILD ? null : getDelta(curProject);
|
||||||
if(delta == null)
|
if(delta == null)
|
||||||
makefileRegenerationNeeded = true;
|
makefileRegenerationNeeded = true;
|
||||||
if(cfg.needsRebuild() || delta != null){
|
if(cfg.needsRebuild() || delta != null){
|
||||||
|
@ -1138,14 +1265,14 @@ public class CommonBuilder extends ACBuilder {
|
||||||
if(delta != null)
|
if(delta != null)
|
||||||
flags |= BuildDescriptionManager.REMOVED;
|
flags |= BuildDescriptionManager.REMOVED;
|
||||||
|
|
||||||
outputTrace(getProject().getName(), "using a build description.."); //$NON-NLS-1$
|
outputTrace(curProject.getName(), "using a build description.."); //$NON-NLS-1$
|
||||||
|
|
||||||
des = BuildDescriptionManager.createBuildDescription(cfg, getDelta(getProject()), flags);
|
des = BuildDescriptionManager.createBuildDescription(cfg, getDelta(curProject), flags);
|
||||||
|
|
||||||
BuildDescriptionManager.cleanGeneratedRebuildResources(des);
|
BuildDescriptionManager.cleanGeneratedRebuildResources(des);
|
||||||
} catch (Throwable e){
|
} catch (Throwable e){
|
||||||
//TODO: log error
|
//TODO: log error
|
||||||
outputError(getProject().getName(), "error occured while build description calculation: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
outputError(curProject.getName(), "error occured while build description calculation: " + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
//in case an error occured, make it behave in the old stile:
|
//in case an error occured, make it behave in the old stile:
|
||||||
if(cfg.needsRebuild()){
|
if(cfg.needsRebuild()){
|
||||||
//make a full clean if an info needs a rebuild
|
//make a full clean if an info needs a rebuild
|
||||||
|
@ -1154,7 +1281,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
else if(delta != null && !makefileRegenerationNeeded){
|
else if(delta != null && !makefileRegenerationNeeded){
|
||||||
// Create a delta visitor to detect the build type
|
// Create a delta visitor to detect the build type
|
||||||
ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(cfg, mInfo.getManagedProject().getConfigurations());
|
ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(cfg, bInfo.getBuildInfo().getManagedProject().getConfigurations());
|
||||||
delta.accept(visitor);
|
delta.accept(visitor);
|
||||||
if (visitor.shouldBuildFull()) {
|
if (visitor.shouldBuildFull()) {
|
||||||
clean(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
|
clean(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
|
||||||
|
@ -1171,22 +1298,23 @@ public class CommonBuilder extends ACBuilder {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MultiStatus performMakefileGeneration(IManagedBuilderMakefileGenerator generator, BuildStatus buildStatus, IProgressMonitor monitor) throws CoreException {
|
protected MultiStatus performMakefileGeneration(CfgBuildInfo bInfo, IManagedBuilderMakefileGenerator generator, BuildStatus buildStatus, IProgressMonitor monitor) throws CoreException {
|
||||||
// Need to report status to the user
|
// Need to report status to the user
|
||||||
|
IProject curProject = bInfo.getProject();
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask the makefile generator to generate any makefiles needed to build delta
|
// Ask the makefile generator to generate any makefiles needed to build delta
|
||||||
checkCancel(monitor);
|
checkCancel(monitor);
|
||||||
String statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.update.makefiles", getProject().getName()); //$NON-NLS-1$
|
String statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.update.makefiles", curProject.getName()); //$NON-NLS-1$
|
||||||
monitor.subTask(statusMsg);
|
monitor.subTask(statusMsg);
|
||||||
|
|
||||||
MultiStatus result;
|
MultiStatus result;
|
||||||
if(buildStatus.isRebuild()){
|
if(buildStatus.isRebuild()){
|
||||||
result = generator.regenerateMakefiles();
|
result = generator.regenerateMakefiles();
|
||||||
} else {
|
} else {
|
||||||
result = generator.generateMakefiles(getDelta(getProject()));
|
result = generator.generateMakefiles(getDelta(curProject));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1201,45 +1329,47 @@ public class CommonBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void initializeGenerator(IManagedBuilderMakefileGenerator generator, int kind, IConfiguration cfg, IBuilder builder, IManagedBuildInfo info, IProgressMonitor monitor){
|
protected void initializeGenerator(IManagedBuilderMakefileGenerator generator, int kind, CfgBuildInfo bInfo, IProgressMonitor monitor){
|
||||||
if(generator instanceof IManagedBuilderMakefileGenerator2){
|
if(generator instanceof IManagedBuilderMakefileGenerator2){
|
||||||
IManagedBuilderMakefileGenerator2 gen2 = (IManagedBuilderMakefileGenerator2)generator;
|
IManagedBuilderMakefileGenerator2 gen2 = (IManagedBuilderMakefileGenerator2)generator;
|
||||||
gen2.initialize(kind, cfg, builder, monitor);
|
gen2.initialize(kind, bInfo.getConfiguration(), bInfo.getBuilder(), monitor);
|
||||||
} else {
|
} else {
|
||||||
generator.initialize(getProject(), info, monitor);
|
generator.initialize(bInfo.getProject(), bInfo.getBuildInfo(), monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clean(IProgressMonitor monitor) throws CoreException {
|
protected void clean(IProgressMonitor monitor) throws CoreException {
|
||||||
IBuilder[] builders = BuilderFactory.createBuilders(getProject(), null);
|
IProject curProject = getProject();
|
||||||
|
IBuilder[] builders = BuilderFactory.createBuilders(curProject, null);
|
||||||
for(int i = 0; i < builders.length; i++){
|
for(int i = 0; i < builders.length; i++){
|
||||||
IBuilder builder = builders[i];
|
IBuilder builder = builders[i];
|
||||||
clean(builder, monitor);
|
CfgBuildInfo bInfo = new CfgBuildInfo(builder, true);
|
||||||
|
clean(bInfo, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clean(IBuilder builder, IProgressMonitor monitor) throws CoreException{
|
protected void clean(CfgBuildInfo bInfo, IProgressMonitor monitor) throws CoreException{
|
||||||
if (shouldBuild(CLEAN_BUILD, builder)) {
|
if (shouldBuild(CLEAN_BUILD, bInfo.getBuilder())) {
|
||||||
boolean performExternalClean = true;
|
boolean performExternalClean = true;
|
||||||
if(shouldCleanProgrammatically(builder)){
|
if(shouldCleanProgrammatically(bInfo)){
|
||||||
try {
|
try {
|
||||||
cleanProgrammatically(builder, monitor);
|
cleanProgrammatically(bInfo, monitor);
|
||||||
performExternalClean = false;
|
performExternalClean = false;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(performExternalClean){
|
if(performExternalClean){
|
||||||
performExternalClean(builder, false, monitor);
|
performExternalClean(bInfo, false, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void performExternalClean(final IBuilder builder, boolean separateJob, IProgressMonitor monitor) throws CoreException {
|
protected void performExternalClean(final CfgBuildInfo bInfo, boolean separateJob, IProgressMonitor monitor) throws CoreException {
|
||||||
IResourceRuleFactory ruleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
|
IResourceRuleFactory ruleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
|
||||||
final ISchedulingRule rule = ruleFactory.modifyRule(getProject());
|
final ISchedulingRule rule = ruleFactory.modifyRule(bInfo.getProject());
|
||||||
|
|
||||||
if(separateJob){
|
if(separateJob){
|
||||||
Job backgroundJob = new Job("CDT Common Builder"){ //$NON-NLS-1$
|
Job backgroundJob = new Job("CDT Common Builder"){ //$NON-NLS-1$
|
||||||
|
@ -1251,7 +1381,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
invokeMake(CLEAN_BUILD, builder, monitor);
|
invokeMake(CLEAN_BUILD, bInfo, monitor);
|
||||||
}
|
}
|
||||||
}, rule, IWorkspace.AVOID_UPDATE, monitor);
|
}, rule, IWorkspace.AVOID_UPDATE, monitor);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
@ -1267,13 +1397,13 @@ public class CommonBuilder extends ACBuilder {
|
||||||
backgroundJob.setRule(rule);
|
backgroundJob.setRule(rule);
|
||||||
backgroundJob.schedule();
|
backgroundJob.schedule();
|
||||||
} else {
|
} else {
|
||||||
invokeMake(CLEAN_BUILD, builder, monitor);
|
invokeMake(CLEAN_BUILD, bInfo, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldCleanProgrammatically(IBuilder builder){
|
protected boolean shouldCleanProgrammatically(CfgBuildInfo bInfo){
|
||||||
if(!builder.isManagedBuildOn())
|
if(!bInfo.getBuilder().isManagedBuildOn())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
// IConfiguration cfg = builder.getParent().getParent();
|
// IConfiguration cfg = builder.getParent().getParent();
|
||||||
|
@ -1284,10 +1414,12 @@ public class CommonBuilder extends ACBuilder {
|
||||||
// return cfg.getOwner().getProject().getFullPath().isPrefixOf(path);
|
// return cfg.getOwner().getProject().getFullPath().isPrefixOf(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cleanProgrammatically(IBuilder builder, IProgressMonitor monitor) throws CoreException {
|
protected void cleanProgrammatically(CfgBuildInfo bInfo, IProgressMonitor monitor) throws CoreException {
|
||||||
// referencedProjects = getProject().getReferencedProjects();
|
// referencedProjects = getProject().getReferencedProjects();
|
||||||
outputTrace(getProject().getName(), "Clean build requested"); //$NON-NLS-1$
|
IProject curProject = bInfo.getProject();
|
||||||
IConfiguration cfg = builder.getParent().getParent();
|
outputTrace(curProject.getName(), "Clean build requested"); //$NON-NLS-1$
|
||||||
|
IBuilder builder = bInfo.getBuilder();
|
||||||
|
IConfiguration cfg = bInfo.getConfiguration();
|
||||||
IPath buildPath = ManagedBuildManager.getBuildFullPath(cfg, builder);
|
IPath buildPath = ManagedBuildManager.getBuildFullPath(cfg, builder);
|
||||||
if(buildPath == null){
|
if(buildPath == null){
|
||||||
throw new CoreException(new Status(IStatus.ERROR,
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
|
@ -1295,7 +1427,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
ManagedMakeMessages.getResourceString("CommonBuilder.0"))); //$NON-NLS-1$
|
ManagedMakeMessages.getResourceString("CommonBuilder.0"))); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
IPath projectFullPath = getProject().getFullPath();
|
IPath projectFullPath = curProject.getFullPath();
|
||||||
if(!projectFullPath.isPrefixOf(buildPath)){
|
if(!projectFullPath.isPrefixOf(buildPath)){
|
||||||
throw new CoreException(new Status(IStatus.ERROR,
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
ManagedBuilderCorePlugin.getUniqueIdentifier(),
|
ManagedBuilderCorePlugin.getUniqueIdentifier(),
|
||||||
|
@ -1326,13 +1458,15 @@ public class CommonBuilder extends ACBuilder {
|
||||||
workspace.delete(new IResource[]{buildDir}, true, monitor);
|
workspace.delete(new IResource[]{buildDir}, true, monitor);
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
// write to the console
|
// write to the console
|
||||||
IConsole console = CCorePlugin.getDefault().getConsole();
|
//
|
||||||
console.start(getProject());
|
// IConsole console = CCorePlugin.getDefault().getConsole();
|
||||||
|
// console.start(getProject());
|
||||||
|
IConsole console = bInfo.getConsole();
|
||||||
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
ConsoleOutputStream consoleOutStream = console.getOutputStream();
|
||||||
String[] consoleHeader = new String[3];
|
String[] consoleHeader = new String[3];
|
||||||
consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_CLEAN);
|
consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_CLEAN);
|
||||||
consoleHeader[1] = cfg.getName();
|
consoleHeader[1] = cfg.getName();
|
||||||
consoleHeader[2] = getProject().getName();
|
consoleHeader[2] = curProject.getName();
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
|
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -1340,7 +1474,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
consoleOutStream.flush();
|
consoleOutStream.flush();
|
||||||
buf = new StringBuffer();
|
buf = new StringBuffer();
|
||||||
// Report a successful clean
|
// Report a successful clean
|
||||||
String successMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED, getProject().getName());
|
String successMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED, curProject.getName());
|
||||||
buf.append(successMsg);
|
buf.append(successMsg);
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
consoleOutStream.write(buf.toString().getBytes());
|
consoleOutStream.write(buf.toString().getBytes());
|
||||||
|
@ -1350,16 +1484,17 @@ public class CommonBuilder extends ACBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean invokeBuilder(int kind, IBuilder builder, IProgressMonitor monitor) throws CoreException {
|
protected boolean invokeBuilder(int kind, CfgBuildInfo bInfo, IProgressMonitor monitor) throws CoreException {
|
||||||
if(builder.isInternalBuilder())
|
if(bInfo.getBuilder().isInternalBuilder())
|
||||||
return invokeInternalBuilder(kind, builder, monitor);
|
return invokeInternalBuilder(kind, bInfo, monitor);
|
||||||
return invokeMake(kind, builder, monitor);
|
return invokeMake(kind, bInfo, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean invokeMake(int kind, IBuilder builder, IProgressMonitor monitor) throws CoreException {
|
protected boolean invokeMake(int kind, CfgBuildInfo bInfo, IProgressMonitor monitor) throws CoreException {
|
||||||
boolean isClean = false;
|
boolean isClean = false;
|
||||||
IProject currProject = getProject();
|
IProject currProject = bInfo.getProject();
|
||||||
|
IBuilder builder = bInfo.getBuilder();
|
||||||
|
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
@ -1369,8 +1504,9 @@ public class CommonBuilder extends ACBuilder {
|
||||||
try {
|
try {
|
||||||
IPath buildCommand = builder.getBuildCommand();
|
IPath buildCommand = builder.getBuildCommand();
|
||||||
if (buildCommand != null) {
|
if (buildCommand != null) {
|
||||||
IConsole console = CCorePlugin.getDefault().getConsole();
|
// IConsole console = CCorePlugin.getDefault().getConsole();
|
||||||
console.start(currProject);
|
// console.start(currProject);
|
||||||
|
IConsole console = bInfo.getConsole();
|
||||||
|
|
||||||
OutputStream cos = console.getOutputStream();
|
OutputStream cos = console.getOutputStream();
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -1387,9 +1523,9 @@ public class CommonBuilder extends ACBuilder {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
IConfiguration cfg = builder.getParent().getParent();
|
IConfiguration cfg = bInfo.getConfiguration();
|
||||||
consoleHeader[1] = cfg.getName();
|
consoleHeader[1] = cfg.getName();
|
||||||
consoleHeader[2] = getProject().getName();
|
consoleHeader[2] = currProject.getName();
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
|
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -1439,12 +1575,12 @@ public class CommonBuilder extends ACBuilder {
|
||||||
// recon.invokeMakeRecon();
|
// recon.invokeMakeRecon();
|
||||||
// cos = recon;
|
// cos = recon;
|
||||||
QualifiedName qName = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "progressMonitor"); //$NON-NLS-1$
|
QualifiedName qName = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "progressMonitor"); //$NON-NLS-1$
|
||||||
Integer last = (Integer)getProject().getSessionProperty(qName);
|
Integer last = (Integer)currProject.getSessionProperty(qName);
|
||||||
if (last == null) {
|
if (last == null) {
|
||||||
last = new Integer(100);
|
last = new Integer(100);
|
||||||
}
|
}
|
||||||
StreamMonitor streamMon = new StreamMonitor(new SubProgressMonitor(monitor, 100), cos, last.intValue());
|
StreamMonitor streamMon = new StreamMonitor(new SubProgressMonitor(monitor, 100), cos, last.intValue());
|
||||||
ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectory, this, builder.getErrorParsers());
|
ErrorParserManager epm = new ErrorParserManager(currProject, workingDirectory, this, builder.getErrorParsers());
|
||||||
epm.setOutputStream(streamMon);
|
epm.setOutputStream(streamMon);
|
||||||
OutputStream stdout = epm.getOutputStream();
|
OutputStream stdout = epm.getOutputStream();
|
||||||
OutputStream stderr = epm.getOutputStream();
|
OutputStream stderr = epm.getOutputStream();
|
||||||
|
@ -1487,7 +1623,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
} else {
|
} else {
|
||||||
errMsg = launcher.getErrorMessage();
|
errMsg = launcher.getErrorMessage();
|
||||||
}
|
}
|
||||||
getProject().setSessionProperty(qName, !monitor.isCanceled() && !isClean ? new Integer(streamMon.getWorkDone()) : null);
|
currProject.setSessionProperty(qName, !monitor.isCanceled() && !isClean ? new Integer(streamMon.getWorkDone()) : null);
|
||||||
|
|
||||||
if (errMsg != null) {
|
if (errMsg != null) {
|
||||||
buf = new StringBuffer(buildCommand.toString() + " "); //$NON-NLS-1$
|
buf = new StringBuffer(buildCommand.toString() + " "); //$NON-NLS-1$
|
||||||
|
|
|
@ -1349,4 +1349,35 @@ public class CoreModel {
|
||||||
public ICProjectDescription getProjectDescription(IProject project, boolean write){
|
public ICProjectDescription getProjectDescription(IProject project, boolean write){
|
||||||
return descriptionManager.getProjectDescription(project, write);
|
return descriptionManager.getProjectDescription(project, write);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* forces the cached data of the specified projects to be re-calculated.
|
||||||
|
* if the <code>projects</code> argument is <code>null</code> al projects
|
||||||
|
* within the workspace are updated
|
||||||
|
*
|
||||||
|
* @param projects
|
||||||
|
* @param monitor
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
public void updateProjectDescriptions(IProject projects[], IProgressMonitor monitor) throws CoreException{
|
||||||
|
descriptionManager.updateProjectDescriptions(projects, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* aswers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||||
|
* @param project
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isNewStyleProject(IProject project){
|
||||||
|
return descriptionManager.isNewStyleProject(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* aswers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||||
|
* @param des
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isNewStyleProject(ICProjectDescription des){
|
||||||
|
return descriptionManager.isNewStyleProject(des);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class CProjectDescriptionManager {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private class CompositeWorkspaceRunnable implements IWorkspaceRunnable {
|
static class CompositeWorkspaceRunnable implements IWorkspaceRunnable {
|
||||||
private List fRunnables = new ArrayList();
|
private List fRunnables = new ArrayList();
|
||||||
private String fName;
|
private String fName;
|
||||||
private boolean fStopOnErr;
|
private boolean fStopOnErr;
|
||||||
|
@ -571,12 +571,13 @@ public class CProjectDescriptionManager {
|
||||||
if(converter != null){
|
if(converter != null){
|
||||||
CProjectDescription convertedDes = (CProjectDescription)converter.convertProject(project, eDes, ownerId, des);
|
CProjectDescription convertedDes = (CProjectDescription)converter.convertProject(project, eDes, ownerId, des);
|
||||||
if(convertedDes != null){
|
if(convertedDes != null){
|
||||||
ICConfigurationDescription activeCfg = convertedDes.getActiveConfiguration();
|
/// ICConfigurationDescription activeCfg = convertedDes.getActiveConfiguration();
|
||||||
if(activeCfg != null){
|
checkHandleActiveCfgChange(convertedDes, null, eDes, new NullProgressMonitor());
|
||||||
checkBuildSystemChange(project, eDes, activeCfg.getBuildSystemId(), null, new NullProgressMonitor());
|
// if(activeCfg != null){
|
||||||
// if(convertedDes != null)
|
// checkBuildSystemChange(project, eDes, activeCfg.getBuildSystemId(), null, new NullProgressMonitor());
|
||||||
des = convertedDes;
|
// // if(convertedDes != null)
|
||||||
}
|
// des = convertedDes;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// des;
|
// des;
|
||||||
|
@ -703,10 +704,14 @@ public class CProjectDescriptionManager {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateProjectDescriptions(IProgressMonitor monitor) throws CoreException{
|
public void updateProjectDescriptions(IProject[] projects, IProgressMonitor monitor) throws CoreException{
|
||||||
|
if(monitor == null)
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
final IProject projects[] = wsp.getRoot().getProjects();
|
if(projects == null)
|
||||||
|
projects = wsp.getRoot().getProjects();
|
||||||
final ICProjectDescription dess[] = new ICProjectDescription[projects.length];
|
final ICProjectDescription dess[] = new ICProjectDescription[projects.length];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for(int i = 0; i < projects.length; i++){
|
for(int i = 0; i < projects.length; i++){
|
||||||
|
@ -912,38 +917,45 @@ public class CProjectDescriptionManager {
|
||||||
return getProjectDescription(project, true);
|
return getProjectDescription(project, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void storeActiveCfgId(ICProjectDescription des, String id){
|
private void storeActiveCfgId(IProject project, String id){
|
||||||
try {
|
try {
|
||||||
des.getProject().setPersistentProperty(ACTIVE_CFG_PROPERTY, id);
|
project.setPersistentProperty(ACTIVE_CFG_PROPERTY, id);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// Hitting this error just means the default config is not set
|
// Hitting this error just means the default config is not set
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkActiveCfgChange(CProjectDescription newDes, CProjectDescription oldDes, IProgressMonitor monitor){
|
/*
|
||||||
|
* returns true if the project description was modiofied false - otherwise
|
||||||
|
*/
|
||||||
|
boolean checkHandleActiveCfgChange(CProjectDescription newDes, CProjectDescription oldDes, IProjectDescription eDes, IProgressMonitor monitor){
|
||||||
if(newDes == null)
|
if(newDes == null)
|
||||||
return;
|
return false;
|
||||||
ICConfigurationDescription newCfg = newDes.getActiveConfiguration();
|
ICConfigurationDescription newCfg = newDes.getActiveConfiguration();
|
||||||
if(newCfg == null)
|
if(newCfg == null)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
ICConfigurationDescription oldCfg = oldDes != null ? oldDes.getActiveConfiguration() : null;
|
ICConfigurationDescription oldCfg = oldDes != null ? oldDes.getActiveConfiguration() : null;
|
||||||
|
|
||||||
String newId = newCfg.getId();
|
checkActiveCfgChange(newDes, newCfg, oldCfg);
|
||||||
String oldId = oldCfg != null ? oldCfg.getId() : null;
|
|
||||||
|
|
||||||
if(newDes.needsActiveCfgIdPersistence() || !newId.equals(oldId)){
|
boolean modified = false;
|
||||||
storeActiveCfgId(newDes, newId);
|
|
||||||
|
try {
|
||||||
|
if(checkBuildSystemChange(eDes, newCfg, oldCfg, monitor))
|
||||||
|
modified = true;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
String newBsId = newCfg.getBuildSystemId();
|
|
||||||
String oldBsId = oldCfg != null ? oldCfg.getBuildSystemId() : null;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkBuildSystemChange(newDes.getProject(), newBsId, oldBsId, monitor);
|
if(checkProjectRefChange(eDes, newCfg, oldCfg, monitor))
|
||||||
|
modified = true;
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
String loadActiveCfgId(ICProjectDescription des){
|
String loadActiveCfgId(ICProjectDescription des){
|
||||||
|
@ -954,13 +966,70 @@ public class CProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Set projSetFromProjNameSet(Set projNameSet){
|
||||||
private void checkBuildSystemChange(IProject project, String newBsId, String oldBsId, IProgressMonitor monitor) throws CoreException{
|
if(projNameSet.size() == 0)
|
||||||
checkBuildSystemChange(project, null, newBsId, oldBsId, monitor);
|
return new HashSet(0);
|
||||||
|
|
||||||
|
Set set = new HashSet();
|
||||||
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
|
for(Iterator iter = projNameSet.iterator(); iter.hasNext();){
|
||||||
|
IProject proj = root.getProject((String)iter.next());
|
||||||
|
set.add(proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBuildSystemChange(IProject project, IProjectDescription des, String newBsId, String oldBsId, IProgressMonitor monitor) throws CoreException{
|
private boolean checkProjectRefChange(IProjectDescription des, ICConfigurationDescription newCfg, ICConfigurationDescription oldCfg, IProgressMonitor monitor) throws CoreException{
|
||||||
|
if(newCfg == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Map oldMap = oldCfg != null ? oldCfg.getReferenceInfo() : null;
|
||||||
|
Map newMap = newCfg != null ? newCfg.getReferenceInfo() : null;
|
||||||
|
Set oldProjSet = oldMap != null ? projSetFromProjNameSet(oldMap.keySet()) : new HashSet(0);
|
||||||
|
Set newProjSet = newMap != null ? projSetFromProjNameSet(newMap.keySet()) : new HashSet(0);
|
||||||
|
|
||||||
|
Set tmp = new HashSet(newProjSet);
|
||||||
|
newProjSet.removeAll(oldProjSet);
|
||||||
|
oldProjSet.removeAll(tmp);
|
||||||
|
if(oldProjSet.size() != 0 || newProjSet.size() != 0){
|
||||||
|
IProject[] refs = des.getReferencedProjects();
|
||||||
|
Set set = new HashSet(Arrays.asList(refs));
|
||||||
|
set.removeAll(oldProjSet);
|
||||||
|
set.addAll(newProjSet);
|
||||||
|
des.setReferencedProjects((IProject[])set.toArray(new IProject[set.size()]));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// private void checkBuildSystemChange(IProject project, String newBsId, String oldBsId, IProgressMonitor monitor) throws CoreException{
|
||||||
|
// checkBuildSystemChange(project, null, newBsId, oldBsId, monitor);
|
||||||
|
// }
|
||||||
|
|
||||||
|
private boolean checkActiveCfgChange(CProjectDescription des,
|
||||||
|
ICConfigurationDescription newCfg,
|
||||||
|
ICConfigurationDescription oldCfg){
|
||||||
|
String newId = newCfg.getId();
|
||||||
|
String oldId = oldCfg != null ? oldCfg.getId() : null;
|
||||||
|
|
||||||
|
if(des.needsActiveCfgIdPersistence() || !newId.equals(oldId)){
|
||||||
|
storeActiveCfgId(des.getProject(), newId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkBuildSystemChange(IProjectDescription des,
|
||||||
|
ICConfigurationDescription newCfg,
|
||||||
|
ICConfigurationDescription oldCfg,
|
||||||
|
IProgressMonitor monitor) throws CoreException{
|
||||||
|
String newBsId = newCfg != null ? newCfg.getBuildSystemId() : null;
|
||||||
|
String oldBsId = oldCfg != null ? oldCfg.getBuildSystemId() : null;
|
||||||
|
|
||||||
CConfigurationDataProviderDescriptor newDr = newBsId != null ? getCfgProviderDescriptor(newBsId) : null;
|
CConfigurationDataProviderDescriptor newDr = newBsId != null ? getCfgProviderDescriptor(newBsId) : null;
|
||||||
CConfigurationDataProviderDescriptor oldDr = oldBsId != null ? getCfgProviderDescriptor(oldBsId) : null;
|
CConfigurationDataProviderDescriptor oldDr = oldBsId != null ? getCfgProviderDescriptor(oldBsId) : null;
|
||||||
|
|
||||||
|
@ -973,11 +1042,11 @@ public class CProjectDescriptionManager {
|
||||||
// List[] builderDiff = ListComparator.compare(newBuilderIds, oldBuilderIds);
|
// List[] builderDiff = ListComparator.compare(newBuilderIds, oldBuilderIds);
|
||||||
|
|
||||||
if(natureDiff != null /*|| builderDiff != null*/){
|
if(natureDiff != null /*|| builderDiff != null*/){
|
||||||
boolean applyDes = false;
|
// boolean applyDes = false;
|
||||||
if(des == null){
|
// if(des == null){
|
||||||
des = project.getDescription();
|
// des = project.getDescription();
|
||||||
applyDes = true;
|
// applyDes = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
String natureIds[] = des.getNatureIds();
|
String natureIds[] = des.getNatureIds();
|
||||||
if(natureDiff[1] != null){
|
if(natureDiff[1] != null){
|
||||||
|
@ -1000,9 +1069,11 @@ public class CProjectDescriptionManager {
|
||||||
if(natureDiff != null)
|
if(natureDiff != null)
|
||||||
des.setNatureIds(natureIds);
|
des.setNatureIds(natureIds);
|
||||||
|
|
||||||
if(applyDes)
|
// if(applyDes)
|
||||||
project.setDescription(des, monitor);
|
// project.setDescription(des, monitor);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectDescription(IProject project, ICProjectDescription des) throws CoreException {
|
public void setProjectDescription(IProject project, ICProjectDescription des) throws CoreException {
|
||||||
|
@ -1057,7 +1128,7 @@ public class CProjectDescriptionManager {
|
||||||
// serialize(newDes);
|
// serialize(newDes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IWorkspaceRunnable createDesSerializationRunnable(CProjectDescription des) throws CoreException{
|
IWorkspaceRunnable createDesSerializationRunnable(CProjectDescription des) throws CoreException{
|
||||||
final ICStorageElement element = des.getRootStorageElement();
|
final ICStorageElement element = des.getRootStorageElement();
|
||||||
|
|
||||||
IWorkspaceRunnable r = new DesSerializationRunnable(des, element);
|
IWorkspaceRunnable r = new DesSerializationRunnable(des, element);
|
||||||
|
@ -1729,7 +1800,7 @@ public class CProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, null);
|
}, new NullProgressMonitor());
|
||||||
|
|
||||||
//if refresh was performed "inline" without job scheduled
|
//if refresh was performed "inline" without job scheduled
|
||||||
if(job == null){
|
if(job == null){
|
||||||
|
@ -2994,6 +3065,17 @@ public class CProjectDescriptionManager {
|
||||||
return isNewStyleCfg(cfgDes);
|
return isNewStyleCfg(cfgDes);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNewStyleProject(IProject project){
|
||||||
|
return isNewStyleProject(getProjectDescription(project, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNewStyleProject(ICProjectDescription des){
|
||||||
|
if(des == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return isNewStyleIndexCfg(des);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNewStyleCfg(ICConfigurationDescription cfgDes){
|
public boolean isNewStyleCfg(ICConfigurationDescription cfgDes){
|
||||||
if(cfgDes == null)
|
if(cfgDes == null)
|
||||||
|
|
|
@ -467,7 +467,7 @@ public class ExternalSettingsManager {
|
||||||
ICExternalSetting[][] newOldSettings = getNewOldSettings(projectDelta, cfgId);
|
ICExternalSetting[][] newOldSettings = getNewOldSettings(projectDelta, cfgId);
|
||||||
deltas = (ExtSettingsDelta[])deltaMap.get(cfgId);
|
deltas = (ExtSettingsDelta[])deltaMap.get(cfgId);
|
||||||
|
|
||||||
updateReferencedSettings(cfgIter, refInfo, (CExternalSetting[])newOldSettings[0], deltas);
|
updateReferencedSettings(cfgIter, refInfo, (ICExternalSetting[])newOldSettings[0], deltas);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cfgIter.isWriteStatusChanged()){
|
if(cfgIter.isWriteStatusChanged()){
|
||||||
|
@ -479,8 +479,6 @@ public class ExternalSettingsManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static class ExtSettingsDelta {
|
static class ExtSettingsDelta {
|
||||||
ICExternalSetting fSetting;
|
ICExternalSetting fSetting;
|
||||||
boolean fAdded;
|
boolean fAdded;
|
||||||
|
|
|
@ -10,12 +10,17 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.settings.model;
|
package org.eclipse.cdt.internal.core.settings.model;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.model.CModelOperation;
|
import org.eclipse.cdt.internal.core.model.CModelOperation;
|
||||||
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.CompositeWorkspaceRunnable;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class SetCProjectDescriptionOperation extends CModelOperation {
|
public class SetCProjectDescriptionOperation extends CModelOperation {
|
||||||
|
@ -35,7 +40,7 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
||||||
protected void executeOperation() throws CModelException {
|
protected void executeOperation() throws CModelException {
|
||||||
CProjectDescriptionManager mngr = CProjectDescriptionManager.getInstance();
|
CProjectDescriptionManager mngr = CProjectDescriptionManager.getInstance();
|
||||||
ICProject cProject = (ICProject)getElementToProcess();
|
ICProject cProject = (ICProject)getElementToProcess();
|
||||||
IProject project = cProject.getProject();
|
final IProject project = cProject.getProject();
|
||||||
CProjectDescription fOldDescriptionCache = (CProjectDescription)mngr.getProjectDescription(project, false);
|
CProjectDescription fOldDescriptionCache = (CProjectDescription)mngr.getProjectDescription(project, false);
|
||||||
|
|
||||||
CProjectDescriptionEvent event = mngr.createAboutToApplyEvent(fSetDescription, fOldDescriptionCache);
|
CProjectDescriptionEvent event = mngr.createAboutToApplyEvent(fSetDescription, fOldDescriptionCache);
|
||||||
|
@ -66,7 +71,23 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
mngr.setLoaddedDescription(project, fNewDescriptionCache, true);
|
mngr.setLoaddedDescription(project, fNewDescriptionCache, true);
|
||||||
mngr.checkActiveCfgChange(fNewDescriptionCache, fOldDescriptionCache, new NullProgressMonitor());
|
CompositeWorkspaceRunnable runnable = new CompositeWorkspaceRunnable("CDT Project settings serialization");
|
||||||
|
|
||||||
|
try {
|
||||||
|
final IProjectDescription eDes = project.getDescription();
|
||||||
|
if(mngr.checkHandleActiveCfgChange(fNewDescriptionCache, fOldDescriptionCache, eDes, new NullProgressMonitor())){
|
||||||
|
runnable.add(new IWorkspaceRunnable(){
|
||||||
|
|
||||||
|
public void run(IProgressMonitor monitor)
|
||||||
|
throws CoreException {
|
||||||
|
project.setDescription(eDes, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (CoreException e2) {
|
||||||
|
CCorePlugin.log(e2);
|
||||||
|
}
|
||||||
|
|
||||||
event = mngr.createDataAppliedEvent(fNewDescriptionCache, fOldDescriptionCache, fSetDescription, delta);
|
event = mngr.createDataAppliedEvent(fNewDescriptionCache, fOldDescriptionCache, fSetDescription, delta);
|
||||||
mngr.notifyListeners(event);
|
mngr.notifyListeners(event);
|
||||||
|
@ -84,7 +105,8 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
||||||
mngr.notifyListeners(event);
|
mngr.notifyListeners(event);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mngr.serialize(fNewDescriptionCache);
|
runnable.add(mngr.createDesSerializationRunnable(fNewDescriptionCache));
|
||||||
|
mngr.runWspModification(runnable, new NullProgressMonitor());
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
throw new CModelException(e);
|
throw new CModelException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1211,5 +1211,35 @@ public class CCorePlugin extends Plugin {
|
||||||
public ICProjectDescription getProjectDescription(IProject project, boolean write){
|
public ICProjectDescription getProjectDescription(IProject project, boolean write){
|
||||||
return fNewCProjectDescriptionManager.getProjectDescription(project, write);
|
return fNewCProjectDescriptionManager.getProjectDescription(project, write);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* forces the cached data of the specified projects to be re-calculated.
|
||||||
|
* if the <code>projects</code> argument is <code>null</code> al projects
|
||||||
|
* within the workspace are updated
|
||||||
|
*
|
||||||
|
* @param projects
|
||||||
|
* @param monitor
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
public void updateProjectDescriptions(IProject projects[], IProgressMonitor monitor) throws CoreException{
|
||||||
|
fNewCProjectDescriptionManager.updateProjectDescriptions(projects, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* aswers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||||
|
* @param project
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isNewStyleProject(IProject project){
|
||||||
|
return fNewCProjectDescriptionManager.isNewStyleProject(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* aswers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||||
|
* @param des
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isNewStyleProject(ICProjectDescription des){
|
||||||
|
return fNewCProjectDescriptionManager.isNewStyleProject(des);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue