diff options
author | Doug Schaefer | 2017-11-10 15:28:36 +0000 |
---|---|---|
committer | Doug Schaefer | 2017-11-10 19:49:16 +0000 |
commit | b7b1d41f0844fa565ac58036c531b88ae1c4060c (patch) | |
tree | 2d6daf41f566e4b311318ca8e17f574240e9c2b7 /core/org.eclipse.cdt.core | |
parent | 45019ea7805777774f71d395e077fe36068d401f (diff) | |
download | org.eclipse.cdt-b7b1d41f0844fa565ac58036c531b88ae1c4060c.tar.gz org.eclipse.cdt-b7b1d41f0844fa565ac58036c531b88ae1c4060c.tar.xz org.eclipse.cdt-b7b1d41f0844fa565ac58036c531b88ae1c4060c.zip |
Fixes for scanner info for Makefile projects.
Using ESP-IDF (the ESP32 FreeRTOS SDK) on MSYS2 as a test bed.
Making sure the indexer picks up as much as it can. Removed -j
since that messes up build output parsing. Add UI so you can put
it back if you want.
Change-Id: I767c739dce1412c75fb56d0bb1efceb913883a5f
Diffstat (limited to 'core/org.eclipse.cdt.core')
3 files changed, 66 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters index b75949e3ada..e4899e4dd3a 100644 --- a/core/org.eclipse.cdt.core/.settings/.api_filters +++ b/core/org.eclipse.cdt.core/.settings/.api_filters @@ -75,11 +75,23 @@ </filter>
</resource>
<resource path="src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java" type="org.eclipse.cdt.core.build.StandardBuildConfiguration">
+ <filter id="336658481">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.StandardBuildConfiguration"/>
+ <message_argument value="BUILD_COMMAND"/>
+ </message_arguments>
+ </filter>
<filter comment="No one extends this yet." id="336658481">
<message_arguments>
<message_argument value="org.eclipse.cdt.core.build.StandardBuildConfiguration"/>
<message_argument value="BUILD_CONTAINER"/>
</message_arguments>
</filter>
+ <filter id="336658481">
+ <message_arguments>
+ <message_argument value="org.eclipse.cdt.core.build.StandardBuildConfiguration"/>
+ <message_argument value="CLEAN_COMMAND"/>
+ </message_arguments>
+ </filter>
</resource>
</component>
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 ce7edae66b0..e4ebbe6d4f4 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 @@ -674,6 +674,7 @@ public abstract class CBuildConfiguration extends PlatformObject // Make sure it's a compile command String[] compileCommands = toolChain.getCompileCommands(); + boolean found = false; loop: for (String arg : command) { // TODO we should really ask the toolchain, not all args start with '-' @@ -685,9 +686,26 @@ public abstract class CBuildConfiguration extends PlatformObject for (String cc : compileCommands) { if (arg.endsWith(cc) && (arg.equals(cc) || arg.endsWith("/" + cc) || arg.endsWith("\\" + cc))) { //$NON-NLS-1$ //$NON-NLS-2$ + found = true; break loop; } } + + if (Platform.getOS().equals(Platform.OS_WIN32) && !arg.endsWith(".exe")) { //$NON-NLS-1$ + // Try with exe + arg = arg + ".exe"; //$NON-NLS-1$ + for (String cc : compileCommands) { + if (arg.endsWith(cc) + && (arg.equals(cc) || arg.endsWith("/" + cc) || arg.endsWith("\\" + cc))) { //$NON-NLS-1$ //$NON-NLS-2$ + found = true; + break loop; + } + } + } + } + + if (!found) { + return false; } try { diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java index 01d6e4651c5..3919f34371b 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java @@ -47,6 +47,14 @@ public class StandardBuildConfiguration extends CBuildConfiguration { * @since 6.4 */ public static final String BUILD_CONTAINER = "stdbuild.build.container"; //$NON-NLS-1$ + /** + * @since 6.4 + */ + public static final String BUILD_COMMAND = "stdbuild.build.command"; //$NON-NLS-1$ + /** + * @since 6.4 + */ + public static final String CLEAN_COMMAND = "stdbuild.clean.command"; //$NON-NLS-1$ private String[] buildCommand; private String[] cleanCommand; @@ -54,6 +62,15 @@ public class StandardBuildConfiguration extends CBuildConfiguration { public StandardBuildConfiguration(IBuildConfiguration config, String name) throws CoreException { super(config, name); + applyProperties(); + } + + public StandardBuildConfiguration(IBuildConfiguration config, String name, IToolChain toolChain, + String launchMode) { + super(config, name, toolChain); + } + + private void applyProperties() { String container = getProperty(BUILD_CONTAINER); if (container != null && !container.trim().isEmpty()) { IPath containerLoc = new org.eclipse.core.runtime.Path(container); @@ -63,11 +80,16 @@ public class StandardBuildConfiguration extends CBuildConfiguration { buildContainer = ResourcesPlugin.getWorkspace().getRoot().getFolder(containerLoc); } } - } - public StandardBuildConfiguration(IBuildConfiguration config, String name, IToolChain toolChain, - String launchMode) { - super(config, name, toolChain); + String buildCmd = getProperty(BUILD_COMMAND); + if (buildCmd != null && !buildCmd.trim().isEmpty()) { + buildCommand = buildCmd.split(" "); //$NON-NLS-1$ + } + + String cleanCmd = getProperty(CLEAN_COMMAND); + if (cleanCmd != null && !cleanCmd.trim().isEmpty()) { + cleanCommand = cleanCmd.split(" "); //$NON-NLS-1$ + } } public void setBuildContainer(IContainer buildContainer) { @@ -77,6 +99,7 @@ public class StandardBuildConfiguration extends CBuildConfiguration { public void setBuildCommand(String[] buildCommand) { this.buildCommand = buildCommand; + setProperty(BUILD_COMMAND, String.join(" ", buildCommand)); //$NON-NLS-1$ } public void setCleanCommand(String[] cleanCommand) { @@ -133,6 +156,15 @@ public class StandardBuildConfiguration extends CBuildConfiguration { } @Override + public boolean setProperties(Map<String, String> properties) { + if (!super.setProperties(properties)) { + return false; + } + applyProperties(); + return true; + } + + @Override public IProject[] build(int kind, Map<String, String> args, IConsole console, IProgressMonitor monitor) throws CoreException { IProject project = getProject(); @@ -153,7 +185,6 @@ public class StandardBuildConfiguration extends CBuildConfiguration { } else { command = new ArrayList<>(); command.add(findCommand("make").toString()); //$NON-NLS-1$ - command.add("-j"); //$NON-NLS-1$ if (!getBuildContainer().equals(getProject())) { Path makefile = Paths.get(getProject().getFile("Makefile").getLocationURI()); //$NON-NLS-1$ Path relative = getBuildDirectory().relativize(makefile); |