mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix for [Bug 186412] -shared option not checked by default for Shared Library artifact
This commit is contained in:
parent
ad32cf2705
commit
67c64bf326
4 changed files with 129 additions and 9 deletions
|
@ -2590,6 +2590,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(buildInfo == null){
|
||||||
|
buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(proj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if (buildInfo == null && resource instanceof IProject)
|
// if (buildInfo == null && resource instanceof IProject)
|
||||||
// buildInfo = findBuildInfoSynchronized((IProject)resource, forceLoad);
|
// buildInfo = findBuildInfoSynchronized((IProject)resource, forceLoad);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006 Intel Corporation and others.
|
* Copyright (c) 2006, 2007 Intel 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
|
||||||
|
@ -12,8 +12,13 @@ package org.eclipse.cdt.managedbuilder.projectconverter;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
|
||||||
|
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.IManagedProject;
|
||||||
|
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.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -49,8 +54,8 @@ 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(ManagedBuildManager.getBuildInfoVersion().toString());
|
((ManagedBuildInfo)info).setVersion("3.1.0");
|
||||||
info.setValid(true);
|
// info.setValid(true);
|
||||||
|
|
||||||
// Save the updated file.
|
// Save the updated file.
|
||||||
IWorkspace workspace = project.getWorkspace();
|
IWorkspace workspace = project.getWorkspace();
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006, 2007 Intel Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Intel Corporation - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.projectconverter;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
public class UpdateManagedProject31 {
|
||||||
|
|
||||||
|
static void doProjectUpdate(IProgressMonitor monitor, final IProject project) throws CoreException {
|
||||||
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||||
|
((ManagedBuildInfo)info).setVersion(ManagedBuildManager.getBuildInfoVersion().toString());
|
||||||
|
|
||||||
|
info.setValid(true);
|
||||||
|
adjustProperties(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void adjustProperties(IManagedBuildInfo info){
|
||||||
|
IManagedProject mProj = info.getManagedProject();
|
||||||
|
IConfiguration[] cfgs = mProj.getConfigurations();
|
||||||
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
|
adjustProperties(cfgs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void adjustProperties(IConfiguration cfg){
|
||||||
|
IBuildObjectProperties props = cfg.getBuildProperties();
|
||||||
|
if(props == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IToolChain tc = cfg.getToolChain();
|
||||||
|
IToolChain extTc = ManagedBuildManager.getExtensionToolChain(tc);
|
||||||
|
if(tc == null)
|
||||||
|
return;
|
||||||
|
String id = extTc.getId();
|
||||||
|
if(id == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(props.supportsType(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID)){
|
||||||
|
String val = getBuildArtefactTypeFromId(id);
|
||||||
|
if(val != null && props.supportsValue(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, val)){
|
||||||
|
try {
|
||||||
|
props.setProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, val);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(props.supportsType(ManagedBuildManager.BUILD_TYPE_PROPERTY_ID)){
|
||||||
|
String val = getBuildTypeFromId(id);
|
||||||
|
if(val != null && props.supportsValue(ManagedBuildManager.BUILD_TYPE_PROPERTY_ID, val)){
|
||||||
|
try {
|
||||||
|
props.setProperty(ManagedBuildManager.BUILD_TYPE_PROPERTY_ID, val);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getBuildArtefactTypeFromId(String id){
|
||||||
|
if(id.indexOf(".exe") != -1)
|
||||||
|
return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_EXE;
|
||||||
|
if(id.indexOf(".so") != -1)
|
||||||
|
return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_SHAREDLIB;
|
||||||
|
if(id.indexOf(".lib") != -1)
|
||||||
|
return ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_STATICLIB;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getBuildTypeFromId(String id){
|
||||||
|
if(id.indexOf(".debug") != -1)
|
||||||
|
return ManagedBuildManager.BUILD_TYPE_PROPERTY_DEBUG;
|
||||||
|
if(id.indexOf(".release") != -1)
|
||||||
|
return ManagedBuildManager.BUILD_TYPE_PROPERTY_RELEASE;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -42,7 +43,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.dialogs.IOverwriteQuery;
|
import org.eclipse.ui.dialogs.IOverwriteQuery;
|
||||||
|
|
||||||
public class UpdateManagedProjectManager {
|
public class UpdateManagedProjectManager {
|
||||||
static private HashMap fUpdateManagers = new HashMap();
|
static private ThreadLocal fThreadInfo = new ThreadLocal();
|
||||||
static private IOverwriteQuery fBackupFileOverwriteQuery = null;
|
static private IOverwriteQuery fBackupFileOverwriteQuery = null;
|
||||||
static private IOverwriteQuery fOpenQuestionQuery = null;
|
static private IOverwriteQuery fOpenQuestionQuery = null;
|
||||||
static private IOverwriteQuery fUpdateProjectQuery = null;
|
static private IOverwriteQuery fUpdateProjectQuery = null;
|
||||||
|
@ -82,12 +83,13 @@ public class UpdateManagedProjectManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
static private UpdateManagedProjectManager getExistingUpdateManager(IProject project){
|
static private UpdateManagedProjectManager getExistingUpdateManager(IProject project){
|
||||||
return (UpdateManagedProjectManager)fUpdateManagers.get(project.getName());
|
Map map = getManagerMap(false);
|
||||||
|
return map != null ? (UpdateManagedProjectManager)map.get(project.getName()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static private UpdateManagedProjectManager createUpdateManager(IProject project){
|
static private UpdateManagedProjectManager createUpdateManager(IProject project){
|
||||||
UpdateManagedProjectManager mngr = new UpdateManagedProjectManager(project);
|
UpdateManagedProjectManager mngr = new UpdateManagedProjectManager(project);
|
||||||
fUpdateManagers.put(project.getName(),mngr);
|
getManagerMap(true).put(project.getName(),mngr);
|
||||||
return mngr;
|
return mngr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +97,16 @@ public class UpdateManagedProjectManager {
|
||||||
UpdateManagedProjectManager mngr = getExistingUpdateManager(project);
|
UpdateManagedProjectManager mngr = getExistingUpdateManager(project);
|
||||||
if(mngr == null)
|
if(mngr == null)
|
||||||
return;
|
return;
|
||||||
fUpdateManagers.remove(project.getName());
|
getManagerMap(false).remove(project.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
static private Map getManagerMap(boolean create){
|
||||||
|
Map map = (Map)fThreadInfo.get();
|
||||||
|
if(map == null && create){
|
||||||
|
map = new HashMap();
|
||||||
|
fThreadInfo.set(map);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected PluginVersionIdentifier getManagedBuildInfoVersion(String version){
|
static protected PluginVersionIdentifier getManagedBuildInfoVersion(String version){
|
||||||
|
@ -318,8 +329,12 @@ public class UpdateManagedProjectManager {
|
||||||
UpdateManagedProject30.doProjectUpdate(monitor, fProject);
|
UpdateManagedProject30.doProjectUpdate(monitor, fProject);
|
||||||
version = getManagedBuildInfoVersion(info.getVersion());
|
version = getManagedBuildInfoVersion(info.getVersion());
|
||||||
}
|
}
|
||||||
|
if (new PluginVersionIdentifier(4,0,0).isGreaterThan(version)){
|
||||||
|
UpdateManagedProject31.doProjectUpdate(monitor, fProject);
|
||||||
|
version = getManagedBuildInfoVersion(info.getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
if(/*!isCompatibleProject(info)*/ !version.equals(new PluginVersionIdentifier(3,1,0))){
|
if(!isCompatibleProject(info)){
|
||||||
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
|
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
|
||||||
ConverterMessages.getFormattedString("UpdateManagedProjectManager.5", //$NON-NLS-1$
|
ConverterMessages.getFormattedString("UpdateManagedProjectManager.5", //$NON-NLS-1$
|
||||||
new String [] {
|
new String [] {
|
||||||
|
|
Loading…
Add table
Reference in a new issue