1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

1. additonal fix for [Bug 186665] CDT 4 update old version project failed.

2. externalization fixes
This commit is contained in:
Mikhail Sennikovsky 2007-05-24 13:40:52 +00:00
parent 3a0b748829
commit 592eaff970
9 changed files with 42 additions and 23 deletions

View file

@ -19,6 +19,7 @@ import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.settings.model.util.ResourceChangeHandlerBase; import org.eclipse.cdt.core.settings.model.util.ResourceChangeHandlerBase;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo; import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider; import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectDescription;
@ -186,7 +187,7 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{
IWorkspace wsp = ResourcesPlugin.getWorkspace(); IWorkspace wsp = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = wsp.getRoot(); IWorkspaceRoot root = wsp.getRoot();
Job job = new Job("project build settings update job"){ Job job = new Job(ManagedMakeMessages.getString("ResourceChangeHandler2.0")){ //$NON-NLS-1$
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
for(Iterator iter = projSet.iterator(); iter.hasNext();){ for(Iterator iter = projSet.iterator(); iter.hasNext();){

View file

@ -24,6 +24,7 @@ import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep; import org.eclipse.cdt.managedbuilder.buildmodel.IBuildStep;
import org.eclipse.cdt.managedbuilder.buildmodel.IStepVisitor; import org.eclipse.cdt.managedbuilder.buildmodel.IStepVisitor;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -61,7 +62,7 @@ public class BuildDescriptionGnuMakefileGenerator {
try { try {
write(fWriter, step); write(fWriter, step);
} catch (IOException e) { } catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), "IO exception occured: ", e)); throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), ManagedMakeMessages.getString("BuildDescriptionGnuMakefileGenerator.0"), e)); //$NON-NLS-1$
} }
return VISIT_CONTINUE; return VISIT_CONTINUE;
} }
@ -104,7 +105,7 @@ public class BuildDescriptionGnuMakefileGenerator {
writer.flush(); writer.flush();
} catch (IOException e) { } catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), "IO exception occured: ", e)); throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), ManagedMakeMessages.getString("BuildDescriptionGnuMakefileGenerator.1"), e)); //$NON-NLS-1$
} }
} }
@ -132,7 +133,7 @@ public class BuildDescriptionGnuMakefileGenerator {
deps = createVarRef(VAR_TARGETS); deps = createVarRef(VAR_TARGETS);
} else if (step == fDes.getInputStep()){ } else if (step == fDes.getInputStep()){
target = IN_STEP_RULE; target = IN_STEP_RULE;
deps = ""; deps = ""; //$NON-NLS-1$
} else { } else {
IBuildResource[] inputs = step.getInputResources(); IBuildResource[] inputs = step.getInputResources();
IBuildResource[] outputs = step.getOutputResources(); IBuildResource[] outputs = step.getOutputResources();

View file

@ -1178,17 +1178,20 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getArtifactExtension() * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getArtifactExtension()
*/ */
public String getArtifactExtension() { public String getArtifactExtension() {
String ext = getArtifactExtensionAttribute(true);
return ext != null ? ext : EMPTY_STRING;
}
public String getArtifactExtensionAttribute(boolean querySuperClass) {
if (artifactExtension == null) { if (artifactExtension == null) {
// Ask my parent first // Ask my parent first
if (parent != null) { if (parent != null) {
return parent.getArtifactExtension(); return parent.getArtifactExtension();
} else {
return EMPTY_STRING;
} }
} else { return null;
}
return artifactExtension; return artifactExtension;
} }
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getArtifactName() * @see org.eclipse.cdt.core.build.managed.IConfiguration#getArtifactName()

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -31,6 +31,10 @@ public class ManagedMakeMessages {
} }
} }
public static String getString(String key) {
return getResourceString(key);
}
public static String getResourceString(String key) { public static String getResourceString(String key) {
try { try {
return resourceBundle.getString(key); return resourceBundle.getString(key);

View file

@ -109,6 +109,8 @@ UserDefinedMacroSupplier.storeOutputStream.wrong.arguments=Failed to persist mac
# BuildMacroStatus messages # BuildMacroStatus messages
BuildMacroStatus.status.macro.undefined=Macro {0} is undefined BuildMacroStatus.status.macro.undefined=Macro {0} is undefined
BuildFilesAction.buildingSelectedFiles=Building Selected Files BuildFilesAction.buildingSelectedFiles=Building Selected Files
BuildDescriptionGnuMakefileGenerator.0=IO exception occured:
BuildDescriptionGnuMakefileGenerator.1=IO exception occured:
BuildFilesAction.buildSelectedFile=Build the selected file. BuildFilesAction.buildSelectedFile=Build the selected file.
BuildMacroStatus.status.reference.eachother=Macros {0} and {1} reference each other BuildMacroStatus.status.reference.eachother=Macros {0} and {1} reference each other
BuildMacroStatus.status.reference.incorrect=Macro {0} reference is incorrect BuildMacroStatus.status.reference.incorrect=Macro {0} reference is incorrect
@ -127,6 +129,8 @@ GeneratedMakefileBuilder.buildResourcesFinished=Build of selected resources is c
GeneratedMakefileBuilder.buildSelectedIncremental=Building selected file(s) incrementally GeneratedMakefileBuilder.buildSelectedIncremental=Building selected file(s) incrementally
GeneratedMakefileBuilder.buildSelectedRebuild=Rebuilding selected file(s) GeneratedMakefileBuilder.buildSelectedRebuild=Rebuilding selected file(s)
GeneratedMakefileBuilder.buildingFile=Building file GeneratedMakefileBuilder.buildingFile=Building file
GenerateMakefileWithBuildDescription.0=info is null
GenerateMakefileWithBuildDescription.1=cfg is null
GeneratedMakefileBuilder.0=Cleaning output file(s) for GeneratedMakefileBuilder.0=Cleaning output file(s) for
BuildFilesAction.building=Building BuildFilesAction.building=Building
BuildFilesAction.buildFiles=Build File(s) BuildFilesAction.buildFiles=Build File(s)
@ -153,3 +157,4 @@ CommonBuilder.12=can not clean programmatically: build workspace path is not fol
CommonBuilder.13=can not clean programmatically: build folder is not accessible CommonBuilder.13=can not clean programmatically: build folder is not accessible
CommonBuilder.22=Building referenced configurations.. CommonBuilder.22=Building referenced configurations..
MakeBuilder.buildError= MakeBuilder.buildError=
ResourceChangeHandler2.0=project build settings update job

View file

@ -977,7 +977,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
IPath path = getPath(); IPath path = getPath();
String ext = path.getFileExtension(); String ext = path.getFileExtension();
if(ext == null) if(ext == null)
ext = ""; ext = ""; //$NON-NLS-1$
ITool tool = ((FolderInfo)parentRc).getToolFromInputExtension(ext); ITool tool = ((FolderInfo)parentRc).getToolFromInputExtension(ext);
if(tool == null) if(tool == null)
return true; return true;

View file

@ -43,7 +43,7 @@ public class UpdateManagedProject30 {
// No physical conversion is need since the 3.1 model is a superset of the 3.0 model // No physical conversion is need since the 3.1 model is a superset of the 3.0 model
// We need to upgrade the version // We need to upgrade the version
((ManagedBuildInfo)info).setVersion("3.1.0"); ((ManagedBuildInfo)info).setVersion("3.1.0"); //$NON-NLS-1$
// info.setValid(true); // info.setValid(true);
//no need to persist data here //no need to persist data here

View file

@ -17,13 +17,14 @@ import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo; import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
public class UpdateManagedProject31 { public class UpdateManagedProject31 {
private static final String INEXISTEND_PROP_ID = ""; private static final String INEXISTEND_PROP_ID = ""; //$NON-NLS-1$
static void doProjectUpdate(IProgressMonitor monitor, final IProject project) throws CoreException { static void doProjectUpdate(IProgressMonitor monitor, final IProject project) throws CoreException {
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
@ -54,7 +55,7 @@ public class UpdateManagedProject31 {
String artefactType = artefactTypeSupported ? null : INEXISTEND_PROP_ID; String artefactType = artefactTypeSupported ? null : INEXISTEND_PROP_ID;
String buildType = buildTypeSupported ? null : INEXISTEND_PROP_ID; String buildType = buildTypeSupported ? null : INEXISTEND_PROP_ID;
String artExt = ((Configuration)cfg).getArtifactExtensionAttribute(false);
String id = cfg.getId(); String id = cfg.getId();
if(artefactType == null){ if(artefactType == null){
artefactType = getBuildArtefactTypeFromId(id); artefactType = getBuildArtefactTypeFromId(id);
@ -89,22 +90,25 @@ public class UpdateManagedProject31 {
ManagedBuilderCorePlugin.log(e); ManagedBuilderCorePlugin.log(e);
} }
} }
if(artExt != null)
cfg.setArtifactExtension(artExt);
} }
private static String getBuildArtefactTypeFromId(String id){ private static String getBuildArtefactTypeFromId(String id){
if(id.indexOf(".exe") != -1) if(id.indexOf(".exe") != -1) //$NON-NLS-1$
return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_EXE; return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_EXE;
if(id.indexOf(".so") != -1) if(id.indexOf(".so") != -1) //$NON-NLS-1$
return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_SHAREDLIB; return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_SHAREDLIB;
if(id.indexOf(".lib") != -1) if(id.indexOf(".lib") != -1) //$NON-NLS-1$
return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_STATICLIB; return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_STATICLIB;
return null; return null;
} }
private static String getBuildTypeFromId(String id){ private static String getBuildTypeFromId(String id){
if(id.indexOf(".debug") != -1) if(id.indexOf(".debug") != -1) //$NON-NLS-1$
return ManagedBuildManager.BUILD_TYPE_PROPERTY_DEBUG; return ManagedBuildManager.BUILD_TYPE_PROPERTY_DEBUG;
if(id.indexOf(".release") != -1) if(id.indexOf(".release") != -1) //$NON-NLS-1$
return ManagedBuildManager.BUILD_TYPE_PROPERTY_RELEASE; return ManagedBuildManager.BUILD_TYPE_PROPERTY_RELEASE;
return null; return null;
} }

View file

@ -23,6 +23,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildDescriptionGnuMakefileGenerator; import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildDescriptionGnuMakefileGenerator;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
@ -38,16 +39,16 @@ public class GenerateMakefileWithBuildDescription extends ProcessRunner{
IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projectHandle); IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projectHandle);
if(info == null) if(info == null)
throw new ProcessFailureException("info is null"); throw new ProcessFailureException(ManagedMakeMessages.getString("GenerateMakefileWithBuildDescription.0")); //$NON-NLS-1$
IConfiguration cfg = info.getDefaultConfiguration(); IConfiguration cfg = info.getDefaultConfiguration();
if(cfg == null) if(cfg == null)
throw new ProcessFailureException("cfg is null"); throw new ProcessFailureException(ManagedMakeMessages.getString("GenerateMakefileWithBuildDescription.1")); //$NON-NLS-1$
IBuildDescription des; IBuildDescription des;
try { try {
des = BuildDescriptionManager.createBuildDescription(cfg, null, 0); des = BuildDescriptionManager.createBuildDescription(cfg, null, 0);
IFile file = projectHandle.getFile("makefile"); IFile file = projectHandle.getFile("makefile"); //$NON-NLS-1$
ByteArrayOutputStream oStream = new ByteArrayOutputStream(100); ByteArrayOutputStream oStream = new ByteArrayOutputStream(100);
BuildDescriptionGnuMakefileGenerator gen = new BuildDescriptionGnuMakefileGenerator(des); BuildDescriptionGnuMakefileGenerator gen = new BuildDescriptionGnuMakefileGenerator(des);
gen.store(oStream); gen.store(oStream);