1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Update for major version bump

Update since tags to 8.0.
Remove api filter.
Fix other since tags after removing of api filter.
Remove interface defaults.
Add default implementations where necessary.
Update tests - TBC.
This commit is contained in:
John Moule 2022-09-28 23:21:10 +01:00 committed by Jonah Graham
parent 234e98d71d
commit c52de83035
7 changed files with 115 additions and 267 deletions

View file

@ -234,6 +234,11 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
}
}
@Override
public List<String> getBinaryParserIds() {
return List.of(getBinaryParserId());
}
protected void addDiscoveryOptions(List<String> command) {
command.add("-E"); //$NON-NLS-1$
command.add("-P"); //$NON-NLS-1$

View file

@ -10,7 +10,27 @@
*******************************************************************************/
package org.eclipse.cdt.core.build;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.nio.file.Path;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.build.gcc.core.GCCToolChain;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.testplugin.CTestPlugin;
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -23,8 +43,13 @@ import org.osgi.framework.ServiceReference;
*/
public class TestICBuildConfiguration {
private final static List<String> expectedBinParserIds = List.of("binParserId0", "binParserId1");
private IToolChainManager toolchainMgr = null;
@Before
public void setup() {
toolchainMgr = getService(IToolChainManager.class);
assertNotNull("toolchainMgr must not be null", toolchainMgr);
}
@After
@ -39,6 +64,36 @@ public class TestICBuildConfiguration {
*/
@Test
public void getBinaryParserIdsTest00() throws Exception {
IProject proj = getProject();
IBuildConfiguration[] buildConfigs = proj.getBuildConfigs();
assertNotNull(buildConfigs, "Must not be null");
assertNotEquals(0, buildConfigs.length, "Must not be empty");
IBuildConfiguration buildConfig = buildConfigs[0];
// ICBuildConfiguration adapter = buildConfig.getAdapter(ICBuildConfiguration.class);
// assertNotNull(adapter, "Must not be null");
// TODO: rationalise this so the TC uses common in TestIToolChain too.
// Add our test toolchain.
Collection<IToolChain> toolChains = toolchainMgr.getAllToolChains();
{
// TODO: fix this. Can't use null for pathToToolChain
IToolChain testTc = new TestToolchain(null, null, "testArch", null);
toolchainMgr.addToolChain(testTc);
}
// Get our test toolchain.
Map props = new HashMap<String, String>();
props.put(IToolChain.ATTR_OS, "testOs");
props.put(IToolChain.ATTR_ARCH, "testArch");
Collection<IToolChain> testTcs = toolchainMgr.getToolChainsMatching(props);
assertTrue("toolChains list must contain exactly 1 item", testTcs.size() == 1);
IToolChain testTc = testTcs.iterator().next();
assertNotNull("ourTc must not be null", testTc);
StandardBuildConfiguration sbc = new StandardBuildConfiguration(buildConfig, "name", testTc, "run");
assertNotNull(sbc, "Must not be null");
sbc.getBinaryParserIds();
}
/**
@ -68,4 +123,39 @@ public class TestICBuildConfiguration {
return bundleContext.getService(serviceReference);
}
private IProject getProject() throws Exception {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProjectDescription desc = root.getWorkspace().newProjectDescription("test");
// desc.setNatureIds(new String[] { "org.eclipse.linuxtools.tmf.project.nature" });
IProject project = root.getProject("testProj");
project.create(desc, new NullProgressMonitor());
project.open(new NullProgressMonitor());
return project;
}
private class TestToolchain extends GCCToolChain {
public TestToolchain(IToolChainProvider provider, Path pathToToolChain, String arch,
IEnvironmentVariable[] envVars) {
super(provider, pathToToolChain, arch, envVars);
}
@Override
public String getProperty(String key) {
if (key.equals(IToolChain.ATTR_OS)) {
return "testOs";
} else if (key.equals(IToolChain.ATTR_ARCH)) {
return "testArch";
} else {
return super.getProperty(key);
}
}
@Override
public List<String> getBinaryParserIds() {
return expectedBinParserIds;
}
}
}

View file

@ -1,255 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.core" version="2">
<resource path="browser/org/eclipse/cdt/core/browser/IndexTypeInfo.java" type="org.eclipse.cdt.core.browser.IndexTypeInfo">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IFunctionInfo"/>
<message_argument value="IndexTypeInfo"/>
</message_arguments>
</filter>
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ITypeInfo"/>
<message_argument value="IndexTypeInfo"/>
</message_arguments>
</filter>
</resource>
<resource path="browser/org/eclipse/cdt/core/browser/QualifiedTypeName.java" type="org.eclipse.cdt.core.browser.QualifiedTypeName">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IQualifiedTypeName"/>
<message_argument value="QualifiedTypeName"/>
</message_arguments>
</filter>
</resource>
<resource path="browser/org/eclipse/cdt/core/browser/TypeInfo.java" type="org.eclipse.cdt.core.browser.TypeInfo">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ITypeInfo"/>
<message_argument value="TypeInfo"/>
</message_arguments>
</filter>
</resource>
<resource path="browser/org/eclipse/cdt/core/browser/TypeReference.java" type="org.eclipse.cdt.core.browser.TypeReference">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ITypeReference"/>
<message_argument value="TypeReference"/>
</message_arguments>
</filter>
</resource>
<resource path="browser/org/eclipse/cdt/core/browser/TypeSearchScope.java" type="org.eclipse.cdt.core.browser.TypeSearchScope">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ITypeSearchScope"/>
<message_argument value="TypeSearchScope"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/cdt/core/model/AbstractLanguage.java" type="org.eclipse.cdt.core.model.AbstractLanguage">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ILanguage"/>
<message_argument value="AbstractLanguage"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/cdt/core/model/LanguageMappingChangeEvent.java" type="org.eclipse.cdt.core.model.LanguageMappingChangeEvent">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ILanguageMappingChangeEvent"/>
<message_argument value="LanguageMappingChangeEvent"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java" type="org.eclipse.cdt.core.settings.model.ACSettingEntry">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICSettingEntry"/>
<message_argument value="ACSettingEntry"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/cdt/core/settings/model/util/XmlStorageElement.java" type="org.eclipse.cdt.core.settings.model.util.XmlStorageElement">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICStorageElement"/>
<message_argument value="XmlStorageElement"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/dom/ast/ASTCompletionNode.java" type="org.eclipse.cdt.core.dom.ast.ASTCompletionNode">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IASTCompletionNode"/>
<message_argument value="ASTCompletionNode"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/dom/parser/AbstractScannerExtensionConfiguration.java" type="org.eclipse.cdt.core.dom.parser.AbstractScannerExtensionConfiguration">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IScannerExtensionConfiguration"/>
<message_argument value="AbstractScannerExtensionConfiguration"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/dom/parser/c/AbstractCParserExtensionConfiguration.java" type="org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICParserExtensionConfiguration"/>
<message_argument value="AbstractCParserExtensionConfiguration"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/dom/parser/cpp/AbstractCPPParserExtensionConfiguration.java" type="org.eclipse.cdt.core.dom.parser.cpp.AbstractCPPParserExtensionConfiguration">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICPPParserExtensionConfiguration"/>
<message_argument value="AbstractCPPParserExtensionConfiguration"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/index/IPDOMASTProcessor.java" type="org.eclipse.cdt.core.index.IPDOMASTProcessor$Abstract">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IPDOMASTProcessor"/>
<message_argument value="Abstract"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/index/ResourceContainerRelativeLocationConverter.java" type="org.eclipse.cdt.core.index.ResourceContainerRelativeLocationConverter">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IIndexLocationConverter"/>
<message_argument value="ResourceContainerRelativeLocationConverter"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/index/URIRelativeLocationConverter.java" type="org.eclipse.cdt.core.index.URIRelativeLocationConverter">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IIndexLocationConverter"/>
<message_argument value="URIRelativeLocationConverter"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/index/export/AbstractExportProjectProvider.java" type="org.eclipse.cdt.core.index.export.AbstractExportProjectProvider">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IExportProjectProvider"/>
<message_argument value="AbstractExportProjectProvider"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/parser/AbstractPersistableProblem.java" type="org.eclipse.cdt.core.parser.AbstractPersistableProblem">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IPersistableProblem"/>
<message_argument value="AbstractPersistableProblem"/>
</message_arguments>
</filter>
</resource>
<resource path="parser/org/eclipse/cdt/core/parser/IParserSettings2.java" type="org.eclipse.cdt.core.parser.IParserSettings2$Default">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IParserSettings2"/>
<message_argument value="Default"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/cdt/core/AbstractCExtension.java" type="org.eclipse.cdt.core.AbstractCExtension">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICExtension"/>
<message_argument value="AbstractCExtension"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/cdt/core/build/ICBuildConfiguration.java" type="org.eclipse.cdt.core.build.ICBuildConfiguration">
<filter id="404000815">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.build.ICBuildConfiguration"/>
<message_argument value="getBinaryParserIds()"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/cdt/core/build/IToolChain.java" type="org.eclipse.cdt.core.build.IToolChain">
<filter id="404000815">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.build.IToolChain"/>
<message_argument value="getBinaryParserIds()"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/cdt/core/cdtvariables/CdtVariableStatus.java" type="org.eclipse.cdt.core.cdtvariables.CdtVariableStatus">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICdtVariableStatus"/>
<message_argument value="CdtVariableStatus"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/cdt/core/envvar/EnvironmentVariable.java" type="org.eclipse.cdt.core.envvar.EnvironmentVariable">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IEnvironmentVariable"/>
<message_argument value="EnvironmentVariable"/>
</message_arguments>
</filter>
</resource>
<resource path="utils/org/eclipse/cdt/utils/DefaultCygwinToolFactory.java" type="org.eclipse.cdt.utils.DefaultCygwinToolFactory">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICygwinToolsFactroy"/>
<message_argument value="DefaultCygwinToolFactory"/>
</message_arguments>
</filter>
</resource>
<resource path="utils/org/eclipse/cdt/utils/DefaultGnuToolFactory.java" type="org.eclipse.cdt.utils.DefaultGnuToolFactory">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IGnuToolFactory"/>
<message_argument value="DefaultGnuToolFactory"/>
</message_arguments>
</filter>
</resource>
<resource path="utils/org/eclipse/cdt/utils/cdtvariables/SupplierBasedCdtVariableSubstitutor.java" type="org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="IVariableSubstitutor"/>
<message_argument value="SupplierBasedCdtVariableSubstitutor"/>
</message_arguments>
</filter>
</resource>
<resource path="utils/org/eclipse/cdt/utils/coff/CodeViewReader.java" type="org.eclipse.cdt.utils.coff.CodeViewReader">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ISymbolReader"/>
<message_argument value="CodeViewReader"/>
</message_arguments>
</filter>
</resource>
<resource path="utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java" type="org.eclipse.cdt.utils.debug.dwarf.DwarfReader">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ICompileOptionsFinder"/>
<message_argument value="DwarfReader"/>
</message_arguments>
</filter>
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ISymbolReader"/>
<message_argument value="DwarfReader"/>
</message_arguments>
</filter>
</resource>
<resource path="utils/org/eclipse/cdt/utils/debug/stabs/StabsReader.java" type="org.eclipse.cdt.utils.debug.stabs.StabsReader">
<filter comment="Squash over zealous warning from PDE. See Bug 558477" id="576725006">
<message_arguments>
<message_argument value="ISymbolReader"/>
<message_argument value="StabsReader"/>
</message_arguments>
</filter>
</resource>
</component>

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.core.build;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
@ -148,4 +149,10 @@ public class ErrorBuildConfiguration extends PlatformObject implements ICBuildCo
return null;
}
@Override
public List<String> getBinaryParserIds() throws CoreException {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -80,9 +80,9 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
*
* @return binary parser ids
* @throws CoreException
* @deprecated As of 10.??? replaced by {@link ICBuildConfiguration#getBinaryParserIds}
* @deprecated As of 8.0 replaced by {@link ICBuildConfiguration#getBinaryParserIds}
*/
@Deprecated(since = "7.5")
@Deprecated(since = "8.0")
String getBinaryParserId() throws CoreException;
/**
@ -91,11 +91,9 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
*
* @return binary parser ids
* @throws CoreException
* @since 7.5
* @since 8.0
*/
default List<String> getBinaryParserIds() throws CoreException {
return List.of(getBinaryParserId());
}
List<String> getBinaryParserIds() throws CoreException;
/**
* Return a build environment variable with a given name.

View file

@ -165,9 +165,9 @@ public interface IToolChain extends IAdaptable {
* the toolchain.
*
* @return binary parser IDs for this toolchain
* @deprecated As of 7.5 replaced by {@link IToolChain#getBinaryParserIds}
* @deprecated As of 8.0 replaced by {@link IToolChain#getBinaryParserIds}
*/
@Deprecated(since = "7.5")
@Deprecated(since = "8.0")
String getBinaryParserId();
/**
@ -175,11 +175,9 @@ public interface IToolChain extends IAdaptable {
* the toolchain.
*
* @return binary parser IDs for this toolchain
* @since 7.5
* @since 8.0
*/
default List<String> getBinaryParserIds() {
return List.of(getBinaryParserId());
}
List<String> getBinaryParserIds();
/**
* Get the scanner info for a given build config, command, base scanner

View file

@ -209,6 +209,11 @@ public class MSVCToolChain extends PlatformObject implements IToolChain {
return CCorePlugin.PLUGIN_ID + ".PE64"; //$NON-NLS-1$
}
@Override
public List<String> getBinaryParserIds() {
return List.of(getBinaryParserId());
}
@Override
public Path getCommandPath(Path command) {
if (command.isAbsolute()) {