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

Fix to [Bug 174824] Specifying buildArtefactType not intuitive

This commit is contained in:
Mikhail Sennikovsky 2007-03-29 20:10:54 +00:00
parent b06c1f160b
commit cdcd208521
10 changed files with 166 additions and 32 deletions

View file

@ -150,6 +150,19 @@ property type-value pairs are specified in the type_id=value_id format.
</documentation>
</annotation>
</attribute>
<attribute name="buildArtefactType" type="string">
<annotation>
<documentation>
the attribute specified the Build Artefact Type. can contain the value id of the &quot;org.eclipse.cdt.build.core.buildArtefactType&quot; build property. Default values contributed with the build system are
&quot;org.eclipse.cdt.build.core.buildArtefactType.exe&quot; - represents executable,
&quot;org.eclipse.cdt.build.core.buildArtefactType.staticLib&quot; - represents static library,
&quot;org.eclipse.cdt.build.core.buildArtefactType.sharedLib&quot; - represents dynamic library
Custom values can be contributed via the &quot;org.eclipse.cdt.managedbuilder.core.buildProperties&quot; extension point. See the description of that extension point for more detail.
Specifying this attribute is fully equivalent to specifying the &quot;org.eclipse.cdt.build.core.buildArtefactType&quot; via tne buildProperties attribute. The buildArtefactType attribute, the &quot;buildArtefactType&quot; attribute value takes precedence over the artefact type specified via the &quot;buildProperties&quot; attribute
</documentation>
</annotation>
</attribute>
</complexType>
</element>
@ -299,6 +312,19 @@ property type-value pairs are specified in the type_id=value_id format.
</documentation>
</annotation>
</attribute>
<attribute name="buildArtefactType" type="string">
<annotation>
<documentation>
the attribute specified the Build Artefact Type. can contain the value id of the &quot;org.eclipse.cdt.build.core.buildArtefactType&quot; build property. Default values contributed with the build system are
&quot;org.eclipse.cdt.build.core.buildArtefactType.exe&quot; - represents executable,
&quot;org.eclipse.cdt.build.core.buildArtefactType.staticLib&quot; - represents static library,
&quot;org.eclipse.cdt.build.core.buildArtefactType.sharedLib&quot; - represents dynamic library
Custom values can be contributed via the &quot;org.eclipse.cdt.managedbuilder.core.buildProperties&quot; extension point. See the description of that extension point for more detail.
Specifying this attribute is fully equivalent to specifying the &quot;org.eclipse.cdt.build.core.buildArtefactType&quot; via tne buildProperties attribute. The buildArtefactType attribute, the &quot;buildArtefactType&quot; attribute value takes precedence over the artefact type specified via the &quot;buildProperties&quot; attribute
</documentation>
</annotation>
</attribute>
</complexType>
</element>

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
import org.eclipse.core.resources.IFile;
@ -46,6 +47,7 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
public static final String DESCRIPTION = "description"; //$NON-NLS-1$
public static final String BUILD_PROPERTIES = "buildProperties"; //$NON-NLS-1$
public static final String BUILD_ARTEFACT_TYPE = "buildArtefactType"; //$NON-NLS-1$
public static final String IS_SYSTEM = "isSystem"; //$NON-NLS-1$
@ -620,4 +622,8 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
boolean isBuilderCompatible(IBuilder builder);
void changeBuilder(IBuilder newBuilder, String id, String name);
IBuildPropertyValue getBuildArtefactType();
void setBuildArtefactType(String id) throws BuildException;
}

View file

@ -42,6 +42,7 @@ public interface IManagedProject extends IBuildObject, IBuildObjectPropertiesCon
public static final String MANAGED_PROJECT_ELEMENT_NAME = "project"; //$NON-NLS-1$
public static final String PROJECTTYPE = "projectType"; //$NON-NLS-1$
public static final String BUILD_PROPERTIES = "buildProperties"; //$NON-NLS-1$
public static final String BUILD_ARTEFACT_TYPE = "buildArtefactType"; //$NON-NLS-1$
/**

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
@ -52,6 +53,7 @@ public interface IProjectType extends IBuildObject, IBuildObjectPropertiesContai
public static final String PROJECT_ENVIRONMENT_SUPPLIER = "projectEnvironmentSupplier"; //$NON-NLS-1$
public static final String PROJECT_MACRO_SUPPLIER = "projectMacroSupplier"; //$NON-NLS-1$
public static final String BUILD_PROPERTIES = "buildProperties"; //$NON-NLS-1$
public static final String BUILD_ARTEFACT_TYPE = "buildArtefactType"; //$NON-NLS-1$
/**
@ -191,4 +193,6 @@ public interface IProjectType extends IBuildObject, IBuildObjectPropertiesContai
public boolean checkForMigrationSupport();
public String getNameAttribute();
public IBuildPropertyValue getBuildArtefactType();
}

View file

@ -64,13 +64,28 @@ public class BuildProperties implements IBuildProperties {
void addProperty(IBuildProperty property){
fPropertiesMap.put(property.getPropertyType().getId(), property);
}
public IBuildProperty setProperty(String propertyId, String propertyValue) throws CoreException {
IBuildProperty property = BuildPropertyManager.getInstance().createProperty(propertyId, propertyValue);
addProperty(property);
return property;
return setProperty(propertyId, propertyValue, false);
}
public IBuildProperty setProperty(String propertyId, String propertyValue, boolean force) throws CoreException {
try {
IBuildProperty property = BuildPropertyManager.getInstance().createProperty(propertyId, propertyValue);
addProperty(property);
return property;
} catch (CoreException e){
if(force){
if(fInexistentProperties == null)
fInexistentProperties = new ArrayList(1);
fInexistentProperties.add(BuildProperty.toString(propertyId, propertyValue));
fInexistentProperties.trimToSize();
}
throw e;
}
}
public IBuildProperty removeProperty(String id){

View file

@ -13,9 +13,6 @@ package org.eclipse.cdt.managedbuilder.internal.buildproperties;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@ -74,9 +71,14 @@ public class BuildProperty implements IBuildProperty{
}
public String toString(){
return toString(fType.toString(), fValue.toString());
}
public static String toString(String type, String value){
StringBuffer buf = new StringBuffer();
buf.append(fType.toString()).append(BuildPropertyManager.PROPERTY_VALUE_SEPARATOR).append(fValue.toString());
buf.append(type).append(BuildPropertyManager.PROPERTY_VALUE_SEPARATOR).append(value);
return buf.toString();
}
/* public Object clone() {

View file

@ -247,6 +247,19 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
String props = element.getAttribute(BUILD_PROPERTIES);
if(props != null)
buildProperties = new BuildObjectProperties(props, this, this);
String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
if(artType != null){
if(buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
try {
buildProperties.setProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artType, true);
} catch (CoreException e) {
ManagedBuilderCorePlugin.log(e);
}
}
if(projectType != null && projectType.buildProperties != null){
if(buildProperties == null){
buildProperties = new BuildObjectProperties(projectType.buildProperties, this, this);
@ -765,6 +778,19 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
String props = element.getAttribute(BUILD_PROPERTIES);
if(props != null)
buildProperties = new BuildObjectProperties(props, this, this);
String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
if(artType != null){
if(buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
try {
buildProperties.setProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artType, true);
} catch (CoreException e) {
ManagedBuilderCorePlugin.log(e);
}
}
if (element.getAttribute(IConfiguration.PARENT) != null) {
// See if the parent belongs to the same project
@ -835,6 +861,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if(buildProperties != null)
element.setAttribute(BUILD_PROPERTIES, buildProperties.toString());
IBuildProperty prop = buildProperties.getProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID);
if(prop != null){
IBuildPropertyValue val = prop.getValue();
element.setAttribute(BUILD_ARTEFACT_TYPE, val.getId());
}
if (parent != null)
element.setAttribute(IConfiguration.PARENT, parent.getId());
@ -2843,11 +2875,22 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return isPreferenceConfig;
}
// public boolean isPerFileDiscoveryCache(){
// return isPerFileDiscoveryCache;
// }
//
// public void setPerFileDiscoveryCache(boolean perFile){
// isPerFileDiscoveryCache = perFile;
// }
public IBuildPropertyValue getBuildArtefactType() {
IBuildObjectProperties props = findBuildProperties();
if(props != null){
IBuildProperty prop = props.getProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID);
if(prop != null)
return prop.getValue();
}
return null;
}
public void setBuildArtefactType(String id) throws BuildException {
IBuildObjectProperties props = getBuildProperties();
try {
props.setProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, id);
} catch (CoreException e){
throw new BuildException(e.getLocalizedMessage());
}
}
}

View file

@ -32,8 +32,10 @@ import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.utils.envvar.StorableEnvironment;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -194,6 +196,18 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
if(props != null && props.length() != 0)
buildProperties = new BuildObjectProperties(props, this, this);
String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
if(artType != null){
if(buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
try {
buildProperties.setProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artType, true);
} catch (CoreException e) {
ManagedBuilderCorePlugin.log(e);
}
}
return true;
}

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
import org.eclipse.core.runtime.CoreException;
@ -168,6 +169,18 @@ public class ProjectType extends BuildObject implements IProjectType, IBuildProp
if(props != null)
buildProperties = new BuildObjectProperties(props, this, this);
String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
if(artType != null){
if(buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
try {
buildProperties.setProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artType, true);
} catch (CoreException e) {
ManagedBuilderCorePlugin.log(e);
}
}
// Get the unused children, if any
unusedChildren = element.getAttribute(UNUSED_CHILDREN);
@ -759,4 +772,14 @@ public class ProjectType extends BuildObject implements IProjectType, IBuildProp
}
return false;
}
public IBuildPropertyValue getBuildArtefactType() {
IBuildObjectProperties props = findBuildProperties();
if(props != null){
IBuildProperty prop = props.getProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID);
if(prop != null)
return prop.getValue();
}
return null;
}
}

View file

@ -1975,7 +1975,7 @@
<projectType
isAbstract="false"
isTest="false"
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
id="cdt.managedbuild.target.gnu.exe">
<configuration
name="%ConfigName.Dbg"
@ -2092,7 +2092,7 @@
<projectType
isAbstract="false"
isTest="false"
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
id="cdt.managedbuild.target.gnu.so">
<configuration
name="%ConfigName.Dbg"
@ -2240,7 +2240,7 @@
<projectType
isTest="false"
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib"
isAbstract="false"
id="cdt.managedbuild.target.gnu.lib">
<configuration
@ -2371,7 +2371,7 @@
</configuration>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
id="cdt.managedbuild.target.gnu.cygwin.exe"
isTest="false"
isAbstract="false">
@ -2488,7 +2488,7 @@
</projectType>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
id="cdt.managedbuild.target.gnu.cygwin.so"
isAbstract="false"
isTest="false">
@ -2637,7 +2637,7 @@
</projectType>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib"
id="cdt.managedbuild.target.gnu.cygwin.lib"
isTest="false"
isAbstract="false">
@ -2769,7 +2769,7 @@
</configuration>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
id="cdt.managedbuild.target.gnu.mingw.exe"
isAbstract="false"
isTest="false"
@ -2879,7 +2879,7 @@
</projectType>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
id="cdt.managedbuild.target.gnu.mingw.so"
isAbstract="false"
isTest="false"
@ -3021,7 +3021,7 @@
</projectType>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib"
id="cdt.managedbuild.target.gnu.mingw.lib"
isAbstract="false"
isTest="false"
@ -3147,7 +3147,7 @@
<projectType
id="cdt.managedbuild.target.macosx.exe"
isTest="false"
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
isAbstract="false">
<configuration
name="%ConfigName.Dbg"
@ -3263,7 +3263,7 @@
<projectType
id="cdt.managedbuild.target.macosx.so"
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
isTest="false"
isAbstract="false">
<configuration
@ -3427,7 +3427,7 @@
</projectType>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib"
id="cdt.managedbuild.target.macosx.lib"
isTest="false"
isAbstract="false">
@ -3557,7 +3557,7 @@
</configuration>
<projectType
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
isAbstract="false"
isTest="false"
id="cdt.managedbuild.target.gnu.solaris.exe">
@ -3610,7 +3610,7 @@
<projectType
isAbstract="false"
isTest="false"
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib"
id="cdt.managedbuild.target.gnu.solaris.so">
<configuration
name="%ConfigName.Dbg"
@ -3660,7 +3660,7 @@
<projectType
isTest="false"
buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib"
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib"
isAbstract="false"
id="cdt.managedbuild.target.gnu.solaris.lib">
<configuration