From 01ad33e1cda847ce65c7babec6d64a50e069faf2 Mon Sep 17 00:00:00 2001 From: Sean Evoy Date: Mon, 29 Nov 2004 15:04:05 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20applied=20for=20Leo=20Treggiari:=201.?= =?UTF-8?q?=20[Bug=2079451]=20NPEs=20on=20project=20import=202.=20[Bug=207?= =?UTF-8?q?7399]=20Managed=20Make=20Builder=20mangles=20subdir.mk=20if=20c?= =?UTF-8?q?onfiguration=20of=20linked=20resource=20was=20changed=20=C2=96?= =?UTF-8?q?=20fix=20for=20initial=20problem=20=C2=96=20additional=20proble?= =?UTF-8?q?ms=20to=20be=20investigated=203.=20Force=20rebuild=20when=20fil?= =?UTF-8?q?e=20build=20option=20changes=204.=20Ensure=20that=20converted?= =?UTF-8?q?=20projects=20get=20saved.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/core/ManagedBuildInfo.java | 13 +++++- .../internal/core/ResourceConfiguration.java | 15 ++++--- .../makegen/gnu/GnuMakefileGenerator.java | 40 ++++++++----------- .../UpdateManagedProject12.java | 1 + .../UpdateManagedProject20.java | 1 + 5 files changed, 39 insertions(+), 31 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java index 014dc0314de..8971bcd9e80 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java @@ -233,8 +233,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { public IConfiguration getDefaultConfiguration() { // Get the default config associated with the project if (defaultConfig == null) { - if (defaultConfigId != null && managedProject != null) { - defaultConfig = managedProject.getConfiguration(defaultConfigId); + if (managedProject != null) { + if (defaultConfigId != null) { + defaultConfig = managedProject.getConfiguration(defaultConfigId); + } + if (defaultConfig == null) { + IConfiguration[] configs = managedProject.getConfigurations(); + if (configs.length > 0) { + defaultConfig = configs[0]; + defaultConfigId = defaultConfig.getId(); + } + } } } return defaultConfig; diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java index aa477aa3b08..8223020ffb8 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java @@ -46,8 +46,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi private boolean isExtensionResourceConfig = false; private boolean isDirty = false; private boolean resolved = true; - private boolean rebuildNeeded = false; - + /* * C O N S T R U C T O R S */ @@ -508,7 +507,9 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi } else { option.setValue(value); } - rebuildNeeded = true; + // TODO: This causes the entire project to be rebuilt. Is there a way to only have this + // file rebuilt? "Clean" its output? Change its modification date? + parent.setRebuildState(true); } return retOpt; } @@ -546,7 +547,9 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi } else { option.setValue(value); } - rebuildNeeded = true; + // TODO: This causes the entire project to be rebuilt. Is there a way to only have this + // file rebuilt? "Clean" its output? Change its modification date? + parent.setRebuildState(true); } return retOpt; } @@ -607,7 +610,9 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi } else { option.setValue(value); } - rebuildNeeded = true; + // TODO: This causes the entire project to be rebuilt. Is there a way to only have this + // file rebuilt? "Clean" its output? Change its modification date? + parent.setRebuildState(true); } return retOpt; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java index 199edd1772c..4d8af592772 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java @@ -352,6 +352,12 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { if (outputExtension != "") //$NON-NLS-1$ OptDotExt = DOT + outputExtension; + + IConfiguration config = info.getDefaultConfiguration(); + + // We need to check whether we have any resource specific build information. + IResourceConfiguration resConfig = null; + if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString()); // figure out path to use to resource if(!resourceLocation.toString().startsWith(projectLocation)) { @@ -366,26 +372,12 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { resourcePath = relativePath; // The rule and command to add to the makefile - buildRule = relativePath + WILDCARD + OptDotExt + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension; - } // end fix for PR 70491 - - IConfiguration config = info.getDefaultConfiguration(); - - // For testing only -/* if( config.getResourceConfigurations().length > 0) { - IResourceConfiguration[] resConfigs = config.getResourceConfigurations(); - for (int i = 0; i < resConfigs.length; i++) { - System.out.println("Name :" + resConfigs[i].getName()); + if( resConfig != null) { + buildRule = resourcePath + resourceName + OptDotExt + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + resourceName + DOT + inputExtension; + } else { + buildRule = relativePath + WILDCARD + OptDotExt + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension; } - } -*/ - -// We need to check whether we have any resource specific build information. - IResourceConfiguration resConfig = null; - if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString()); - if( resConfig != null) { - buildRule = resourcePath + resourceName + OptDotExt + COLON + WHITESPACE + "$(ROOT)/" + resourcePath + resourceName + DOT + inputExtension; //$NON-NLS-1$ - } + } // end fix for PR 70491 // No duplicates in a makefile if (getRuleList().contains(buildRule)) { @@ -409,14 +401,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { outflag = tools[0].getOutputFlag(); outputPrefix = tools[0].getOutputPrefix(); cmd = tools[0].getToolCommand(); -// The command to build + // The command to build String fileName; String rootDir = "../"; //$NON-NLS-1$ - if (isItLinked) + if (isItLinked) { fileName = resourcePath; - else + } else { fileName = rootDir + relativePath + resConfig.getName(); + } inputs = new String[1]; inputs[0] = fileName; String[] flags = null; @@ -428,10 +421,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { } IManagedCommandLineGenerator cmdLGen = tools[0].getCommandLineGenerator(); cmdLInfo = cmdLGen.generateCommandLineInfo( tools[0], cmd, flags, outflag, outputPrefix, - resourcePath + resourceName + OptDotExt, inputs, tools[0].getCommandLinePattern() ); + OUT_MACRO, inputs, tools[0].getCommandLinePattern() ); String buildCmd = cmdLInfo.getCommandLine(); -// String buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + resourceName + OptDotExt + WHITESPACE + fileName; buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE); buffer.append(TAB + AT + buildCmd); } else { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java index 348fcf346a7..b18eb17da00 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java @@ -612,6 +612,7 @@ class UpdateManagedProject12 { // Upgrade the version ((ManagedBuildInfo)info).setVersion(ManagedBuildManager.getBuildInfoVersion().toString()); + info.setValid(true); }catch (CoreException e){ throw e; }catch (Exception e) { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java index e77227b51de..a709537b4e2 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java @@ -89,6 +89,7 @@ class UpdateManagedProject20 { } // Upgrade the version ((ManagedBuildInfo)info).setVersion(ManagedBuildManager.getBuildInfoVersion().toString()); + info.setValid(true); }catch (CoreException e){ throw e; }catch (Exception e) {