diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core.tests/src/org/eclipse/cdt/jsoncdb/core/internal/SystemIncludePath_armcc_Test.java b/jsoncdb/org.eclipse.cdt.jsoncdb.arm.tests/src/org/eclipse/cdt/jsoncdb/arm/SystemIncludePathTest.java similarity index 63% rename from jsoncdb/org.eclipse.cdt.jsoncdb.core.tests/src/org/eclipse/cdt/jsoncdb/core/internal/SystemIncludePath_armcc_Test.java rename to jsoncdb/org.eclipse.cdt.jsoncdb.arm.tests/src/org/eclipse/cdt/jsoncdb/arm/SystemIncludePathTest.java index 3c9bba5822b..e1ceb3819ee 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.core.tests/src/org/eclipse/cdt/jsoncdb/core/internal/SystemIncludePath_armcc_Test.java +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.arm.tests/src/org/eclipse/cdt/jsoncdb/arm/SystemIncludePathTest.java @@ -6,12 +6,12 @@ * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.cdt.jsoncdb.core.internal; +package org.eclipse.cdt.jsoncdb.arm; import static org.junit.Assert.assertEquals; -import org.eclipse.cdt.jsoncdb.core.participant.Arglets.SystemIncludePath_armcc; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.jsoncdb.core.participant.DefaultToolCommandlineParser; +import org.eclipse.cdt.jsoncdb.core.participant.IToolCommandlineParser.IResult; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.junit.Before; @@ -20,54 +20,50 @@ import org.junit.Test; /** * @author Martin Weber */ -public class SystemIncludePath_armcc_Test { +public class SystemIncludePathTest { - private SystemIncludePath_armcc testee; + private ArmccToolDetectionParticipant.SystemIncludePath_armcc testee; /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { - testee = new SystemIncludePath_armcc(); + testee = new ArmccToolDetectionParticipant.SystemIncludePath_armcc(); } @Test public final void testProcessArgument() { + DefaultToolCommandlineParser tcp = new DefaultToolCommandlineParser(null, null, testee); + final String more = " -g " + " -o CMakeFiles/execut1.dir/util1.c.o -c /testprojects/C-subsrc/src/src-sub/main1.c"; - ParseContext result; - ICLanguageSettingEntry parsed; final IPath cwd = new Path(""); String name = "/an/Include/Path"; + IResult result; // -J/an/Include/Path - result = new ParseContext(); - assertEquals(2 + name.length(), testee.processArgument(result, cwd, "-J" + name + more)); + result = tcp.processArgs(cwd, "-J" + name + more); assertEquals("#entries", 1, result.getSystemIncludePaths().size()); assertEquals("name", name, result.getSystemIncludePaths().get(0)); // -J'/an/Include/Path' - result = new ParseContext(); - assertEquals(2 + name.length() + 2, testee.processArgument(result, cwd, "-J" + "'" + name + "'" + more)); + result = tcp.processArgs(cwd, "-J" + "'" + name + "'" + more); assertEquals("#entries", 1, result.getSystemIncludePaths().size()); assertEquals("name", name, result.getSystemIncludePaths().get(0)); // -J"/an/Include/Path" - result = new ParseContext(); - assertEquals(2 + name.length() + 2, testee.processArgument(result, cwd, "-J" + "\"" + name + "\"" + more)); + result = tcp.processArgs(cwd, "-J" + "\"" + name + "\"" + more); assertEquals("#entries", 1, result.getSystemIncludePaths().size()); assertEquals("name", name, result.getSystemIncludePaths().get(0)); name = (new Path("A:an\\In CLU de/Pat h")).toOSString(); // -J"A:an\In CLU de/Pat h" - result = new ParseContext(); - assertEquals(2 + name.length() + 2, testee.processArgument(result, cwd, "-J" + "\"" + name + "\"" + more)); + result = tcp.processArgs(cwd, "-J" + "\"" + name + "\"" + more); assertEquals("#entries", 1, result.getSystemIncludePaths().size()); assertEquals("name", name, result.getSystemIncludePaths().get(0)); // -J'A:an\In CLU de/Pat h' - result = new ParseContext(); - assertEquals(2 + name.length() + 2, testee.processArgument(result, cwd, "-J" + "'" + name + "'" + more)); + result = tcp.processArgs(cwd, "-J" + "\"" + name + "\"" + more); assertEquals("#entries", 1, result.getSystemIncludePaths().size()); assertEquals("name", name, result.getSystemIncludePaths().get(0)); } diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.arm/META-INF/MANIFEST.MF b/jsoncdb/org.eclipse.cdt.jsoncdb.arm/META-INF/MANIFEST.MF index db36667dbed..30df3cb282f 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.arm/META-INF/MANIFEST.MF +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.arm/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-Copyright: %Bundle-Copyright Bundle-SymbolicName: org.eclipse.cdt.jsoncdb.arm;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.0.100.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.arm/src/org/eclipse/cdt/jsoncdb/arm/ArmccToolDetectionParticipant.java b/jsoncdb/org.eclipse.cdt.jsoncdb.arm/src/org/eclipse/cdt/jsoncdb/arm/ArmccToolDetectionParticipant.java index 1b8c1a920e4..7e0f5810ef5 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.arm/src/org/eclipse/cdt/jsoncdb/arm/ArmccToolDetectionParticipant.java +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.arm/src/org/eclipse/cdt/jsoncdb/arm/ArmccToolDetectionParticipant.java @@ -10,9 +10,12 @@ package org.eclipse.cdt.jsoncdb.arm; import org.eclipse.cdt.jsoncdb.core.participant.Arglets; +import org.eclipse.cdt.jsoncdb.core.participant.Arglets.IncludePathGeneric; +import org.eclipse.cdt.jsoncdb.core.participant.Arglets.NameOptionMatcher; import org.eclipse.cdt.jsoncdb.core.participant.DefaultToolCommandlineParser; import org.eclipse.cdt.jsoncdb.core.participant.DefaultToolDetectionParticipant; import org.eclipse.cdt.jsoncdb.core.participant.IArglet; +import org.eclipse.core.runtime.IPath; /** * armcc C & C++. @@ -29,10 +32,31 @@ public class ArmccToolDetectionParticipant extends DefaultToolDetectionParticipa private static class ToolCommandlineParser extends DefaultToolCommandlineParser { private static final IArglet[] arglets = { new Arglets.IncludePath_C_POSIX(), new Arglets.MacroDefine_C_POSIX(), - new Arglets.MacroUndefine_C_POSIX(), new Arglets.SystemIncludePath_armcc() }; + new Arglets.MacroUndefine_C_POSIX(), new SystemIncludePath_armcc() }; private ToolCommandlineParser() { super(null, new ArmccBuiltinDetectionBehavior(), arglets); } } + + /** + * A tool argument parser capable to parse a armcc-compiler system include path + * argument: {@code -Jdir}. + */ + /* package */ static class SystemIncludePath_armcc extends IncludePathGeneric implements IArglet { + @SuppressWarnings("nls") + static final NameOptionMatcher[] optionMatchers = { + /* quoted directory */ + new NameOptionMatcher("-J" + "([\"'])(.+?)\\1", 2), + /* unquoted directory */ + new NameOptionMatcher("-J" + "([^\\s]+)", 1), }; + + /*- + * @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String) + */ + @Override + public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) { + return processArgument(true, resultCollector, cwd, argsLine, optionMatchers); + } + } } diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/.settings/.api_filters b/jsoncdb/org.eclipse.cdt.jsoncdb.core/.settings/.api_filters index b77e35b3cb5..96215b79f80 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/.settings/.api_filters +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/.settings/.api_filters @@ -48,4 +48,12 @@ + + + + + + + + diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java index a7fce2e6137..c7d8573f169 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java @@ -364,29 +364,6 @@ public final class Arglets { } } - //////////////////////////////////////////////////////////////////// - /** - * A tool argument parser capable to parse a armcc-compiler system include path - * argument: {@code -Jdir}. - */ - // TODO move this to the arm plugin - public static class SystemIncludePath_armcc extends IncludePathGeneric implements IArglet { - @SuppressWarnings("nls") - static final NameOptionMatcher[] optionMatchers = { - /* quoted directory */ - new NameOptionMatcher("-J" + "([\"'])(.+?)\\1", 2), - /* unquoted directory */ - new NameOptionMatcher("-J" + "([^\\s]+)", 1), }; - - /*- - * @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String) - */ - @Override - public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) { - return processArgument(true, resultCollector, cwd, argsLine, optionMatchers); - } - } - //////////////////////////////////////////////////////////////////// // POSIX compatible option parsers ////////////////////////////////////////////////////////////////////