diff --git a/NewAndNoteworthy/CHANGELOG-API.md b/NewAndNoteworthy/CHANGELOG-API.md index fcf711bb7ba..917da6065ba 100644 --- a/NewAndNoteworthy/CHANGELOG-API.md +++ b/NewAndNoteworthy/CHANGELOG-API.md @@ -16,6 +16,8 @@ This section describes API removals that occurred in past releases, and upcoming - [Removal of Qt plug-ins and features](#qt-plugins) - [Removal of constructor org.eclipse.cdt.utils.coff.CodeViewReader(RandomAccessFile, int, boolean)](#CodeViewReader-constructor-removal) - [Removal of 32-bit Binary parsers with 64-bit replacements](#32bitbinaryparsers) +- [Removal of method to get a single binary parser ID (ICBuildConfiguration.getBinaryParserId()) and replaced with method that returns a list of binary parser IDs (ICBuildConfiguration.getBinaryParserIds())](#getBinaryParserId) +- [Removal of method to get a single binary parser ID (IToolChain.getBinaryParserId()) and replaced with method that returns a list of binary parser IDs (IToolChain.getBinaryParserIds())](#getBinaryParserId) ## API Changes in CDT 10.5.0 diff --git a/build/org.eclipse.cdt.build.gcc.core.tests/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.build.gcc.core.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..1967307b8ae --- /dev/null +++ b/build/org.eclipse.cdt.build.gcc.core.tests/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-Vendor: %providerName +Bundle-SymbolicName: org.eclipse.cdt.build.gcc.core.tests; singleton:=true +Bundle-Version: 1.0.0.qualifier +Require-Bundle: org.eclipse.core.resources, + org.eclipse.cdt.core, + org.junit, + org.eclipse.jdt.junit4.runtime, + org.eclipse.core.runtime, + org.eclipse.cdt.build.gcc.core +Automatic-Module-Name: org.eclipse.cdt.build.gcc.core.tests +Bundle-RequiredExecutionEnvironment: JavaSE-17 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin diff --git a/build/org.eclipse.cdt.build.gcc.core.tests/about.html b/build/org.eclipse.cdt.build.gcc.core.tests/about.html new file mode 100644 index 00000000000..b3134865230 --- /dev/null +++ b/build/org.eclipse.cdt.build.gcc.core.tests/about.html @@ -0,0 +1,38 @@ + + + + + + About + + + +

About This Content

+ +

November 30, 2017

+

License

+ +

+ The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content + is provided to you under the terms and conditions of the Eclipse + Public License Version 2.0 ("EPL"). A copy of the EPL is + available at https://www.eclipse.org/legal/epl-2.0. + For purposes of the EPL, "Program" will mean the Content. +

+ +

+ If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If no such + license exists, contact the Redistributor. Unless otherwise indicated + below, the terms and conditions of the EPL still apply to any source + code in the Content and such source code may be obtained at https://www.eclipse.org. +

+ + + + \ No newline at end of file diff --git a/build/org.eclipse.cdt.build.gcc.core.tests/build.properties b/build/org.eclipse.cdt.build.gcc.core.tests/build.properties new file mode 100644 index 00000000000..d944674ba0b --- /dev/null +++ b/build/org.eclipse.cdt.build.gcc.core.tests/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html,\ + plugin.properties diff --git a/build/org.eclipse.cdt.build.gcc.core.tests/plugin.properties b/build/org.eclipse.cdt.build.gcc.core.tests/plugin.properties new file mode 100644 index 00000000000..d2236a9f916 --- /dev/null +++ b/build/org.eclipse.cdt.build.gcc.core.tests/plugin.properties @@ -0,0 +1,11 @@ +################################################################################## +# Copyright (c) 2022 Renesas Electronics Europe. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License 2.0 which accompanies this distribution, and is +# available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +################################################################################## + +pluginName = GCC support for CDT Build Core Test +providerName = Renesas Electronics Europe diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/build/TestIToolChain.java b/build/org.eclipse.cdt.build.gcc.core.tests/src/org/eclipse/cdt/build/gcc/core/tests/TestIToolChain.java similarity index 91% rename from core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/build/TestIToolChain.java rename to build/org.eclipse.cdt.build.gcc.core.tests/src/org/eclipse/cdt/build/gcc/core/tests/TestIToolChain.java index 6c1bf557563..0efdd59e49e 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/build/TestIToolChain.java +++ b/build/org.eclipse.cdt.build.gcc.core.tests/src/org/eclipse/cdt/build/gcc/core/tests/TestIToolChain.java @@ -8,7 +8,7 @@ * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.cdt.core.build; +package org.eclipse.cdt.build.gcc.core.tests; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNotNull; @@ -21,8 +21,10 @@ import java.util.List; import java.util.Map; import org.eclipse.cdt.build.gcc.core.GCCToolChain; +import org.eclipse.cdt.core.build.IToolChain; +import org.eclipse.cdt.core.build.IToolChainManager; +import org.eclipse.cdt.core.build.IToolChainProvider; import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.testplugin.CTestPlugin; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -64,7 +66,8 @@ public class TestIToolChain { } /** - * Tests that IToolChain.getBinaryParserIds() can return a list of Binary Parser IDs. + * Tests that IToolChain.getBinaryParserIds() can return a list of Binary Parser + * IDs. */ @Test public void getBinaryParserIdsTest01() throws Exception { @@ -75,7 +78,7 @@ public class TestIToolChain { } // Get our test toolchain. - Map props = new HashMap(); + Map props = new HashMap<>(); props.put(IToolChain.ATTR_OS, "testOs"); props.put(IToolChain.ATTR_ARCH, "testArch"); Collection testTcs = toolchainMgr.getToolChainsMatching(props); @@ -114,7 +117,7 @@ public class TestIToolChain { } private static T getService(Class serviceClass) { - BundleContext bundleContext = FrameworkUtil.getBundle(CTestPlugin.class).getBundleContext(); + BundleContext bundleContext = FrameworkUtil.getBundle(TestIToolChain.class).getBundleContext(); ServiceReference serviceReference = bundleContext.getServiceReference(serviceClass); return bundleContext.getService(serviceReference); } diff --git a/build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF index 7fb46447bd6..283cb8d6643 100644 --- a/build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF +++ b/build/org.eclipse.cdt.build.gcc.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.build.gcc.core;singleton:=true -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.eclipse.cdt.build.gcc.core.internal.Activator Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.runtime, diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java index ee8c4d00e3c..3616ccd9385 100644 --- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java +++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java @@ -220,8 +220,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain { properties.put(key, value); } - @Override - public String getBinaryParserId() { + private String getBinaryParserId() { // Assume local builds // TODO be smarter and use the id which should be the target switch (Platform.getOS()) { diff --git a/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF index d30d00aa493..69844003b2d 100644 --- a/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF +++ b/core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF @@ -45,8 +45,7 @@ Require-Bundle: org.eclipse.core.resources, org.eclipse.ltk.core.refactoring;bundle-version="3.4.0", org.hamcrest.core, org.hamcrest.library, - com.google.gson;bundle-version="[2.8.6,3.0.0)", - org.eclipse.cdt.build.gcc.core + com.google.gson;bundle-version="[2.8.6,3.0.0)" Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: JavaSE-17 diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/build/TestICBuildConfiguration.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/build/TestICBuildConfiguration.java index f96b4228dde..7fd1ee7919b 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/build/TestICBuildConfiguration.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/build/TestICBuildConfiguration.java @@ -10,20 +10,12 @@ *******************************************************************************/ 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 static org.junit.jupiter.api.Assertions.assertNull; -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; @@ -31,31 +23,13 @@ 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; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; /** * Tests for org.eclipse.cdt.core.build.ICBuildConfiguration */ public class TestICBuildConfiguration { - private final static List 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 - public void shutdown() { - } - /** * Tests that ICBuildConfiguration.getBinaryParserIds() meets API.
* @@ -69,93 +43,22 @@ public class TestICBuildConfiguration { 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 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(); - props.put(IToolChain.ATTR_OS, "testOs"); - props.put(IToolChain.ATTR_ARCH, "testArch"); - Collection 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(); - } - - /** - * Tests that ICBuildConfiguration.getBinaryParserIds() can return a list of Binary Parser IDs. - */ - @Test - public void getBinaryParserIdsTest01() throws Exception { - } - - /** - * org.eclipse.cdt.internal.core.model.CModelManager.getBinaryParser(IProject) - */ - @Test - public void getBinaryParserTest00() throws Exception { - } - - // ICBuildConfiguration cBuildConfig = null; - // String binParserId = cBuildConfig.getBinaryParserId(); - // IBinary[] binaries = cBuildConfig.getBuildOutput(); - // for (IBinary binary : binaries) { - // binary.exists(); - // } - - private static T getService(Class serviceClass) { - BundleContext bundleContext = FrameworkUtil.getBundle(CTestPlugin.class).getBundleContext(); - ServiceReference serviceReference = bundleContext.getServiceReference(serviceClass); - return bundleContext.getService(serviceReference); + /* + * It's difficult to create a functional BuildConfiguration without a toolchain, so just use + * this Error Build Configuration. It is adequate for simply testing the API. + */ + ErrorBuildConfiguration errorBuildConfiguration = new ErrorBuildConfiguration(buildConfig, "errorBuildConfig"); + List binaryParserIds = errorBuildConfiguration.getBinaryParserIds(); + assertNull(binaryParserIds, "Must be null"); } 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 getBinaryParserIds() { - return expectedBinParserIds; - } - } - } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java index 440df02fc08..9be5dfd64ec 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java @@ -213,11 +213,6 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu return config.getProject(); } - @Override - public String getBinaryParserId() throws CoreException { - return toolChain != null ? toolChain.getBinaryParserId() : CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID; - } - @Override public List getBinaryParserIds() throws CoreException { return toolChain != null ? toolChain.getBinaryParserIds() : List.of(CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ErrorBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ErrorBuildConfiguration.java index 342b43928d5..eb9ec25e705 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ErrorBuildConfiguration.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ErrorBuildConfiguration.java @@ -131,12 +131,6 @@ public class ErrorBuildConfiguration extends PlatformObject implements ICBuildCo return null; } - @Override - public String getBinaryParserId() throws CoreException { - // TODO Auto-generated method stub - return null; - } - @Override public IEnvironmentVariable getVariable(String name) throws CoreException { // TODO Auto-generated method stub diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java index 7ea205d9271..431d777aa31 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfiguration.java @@ -74,17 +74,6 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider { return null; } - /** - * Ids for the Binary Parsers to use when checking whether a file is a - * binary that can be launched. - * - * @return binary parser ids - * @throws CoreException - * @deprecated As of 8.0 replaced by {@link ICBuildConfiguration#getBinaryParserIds} - */ - @Deprecated(since = "8.0") - String getBinaryParserId() throws CoreException; - /** * Ids for the Binary Parsers to use when checking whether a file is a * binary that can be launched. diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java index 20511479894..838537901b3 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java @@ -160,16 +160,6 @@ public interface IToolChain extends IAdaptable { */ String[] getErrorParserIds(); - /** - * Returns the IDs for the binary parsers that can parse the build output of - * the toolchain. - * - * @return binary parser IDs for this toolchain - * @deprecated As of 8.0 replaced by {@link IToolChain#getBinaryParserIds} - */ - @Deprecated(since = "8.0") - String getBinaryParserId(); - /** * Returns the IDs for the binary parsers that can parse the build output of * the toolchain. diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java index be0bd7fb2d3..3ead054b52a 100644 --- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java +++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChain.java @@ -170,8 +170,8 @@ public class ContainerGCCToolChain extends PlatformObject implements IToolChain, } @Override - public String getBinaryParserId() { - return CCorePlugin.PLUGIN_ID + ".ELF"; //$NON-NLS-1$ + public List getBinaryParserIds() { + return List.of(CCorePlugin.PLUGIN_ID + ".ELF"); //$NON-NLS-1$ } protected void addDiscoveryOptions(List command) { @@ -645,5 +645,4 @@ public class ContainerGCCToolChain extends PlatformObject implements IToolChain, return p; } - } diff --git a/windows/org.eclipse.cdt.msw.build/META-INF/MANIFEST.MF b/windows/org.eclipse.cdt.msw.build/META-INF/MANIFEST.MF index 6046fc18ce2..eedb516b6f3 100644 --- a/windows/org.eclipse.cdt.msw.build/META-INF/MANIFEST.MF +++ b/windows/org.eclipse.cdt.msw.build/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.msw.build;singleton:=true -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.eclipse.cdt.msw.build.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java index 3789b431ca6..3f7b8eb99cc 100644 --- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java +++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java @@ -204,14 +204,9 @@ public class MSVCToolChain extends PlatformObject implements IToolChain { }; } - @Override - public String getBinaryParserId() { - return CCorePlugin.PLUGIN_ID + ".PE64"; //$NON-NLS-1$ - } - @Override public List getBinaryParserIds() { - return List.of(getBinaryParserId()); + return List.of(CCorePlugin.PLUGIN_ID + ".PE64"); //$NON-NLS-1$ } @Override