mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Add dynamic variable for build directory of active core build config
This will allow us to use that value in external tool launches such as those used by the Serial Flash launch configuration. Also removal of the missing src source folder entry in meson.ui.editor. Change-Id: I1033bdc0c18c9822490a9b8602cef83a42f7262d
This commit is contained in:
parent
b768556355
commit
3929a1fc80
7 changed files with 143 additions and 72 deletions
|
@ -2,6 +2,5 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -95,6 +95,7 @@ binaryFileName=Binary File
|
||||||
cdt_pathentry_var.description=CDT PathEntry variable
|
cdt_pathentry_var.description=CDT PathEntry variable
|
||||||
config_name_var.description=The name of the active configuration for the project specified as an argument
|
config_name_var.description=The name of the active configuration for the project specified as an argument
|
||||||
config_description_var.description=The description of the active configuration for the project specified as an argument
|
config_description_var.description=The description of the active configuration for the project specified as an argument
|
||||||
|
core_build_dir.description=The build directory for the active Core Build configuration for the given project
|
||||||
|
|
||||||
PDOMProviderName=PDOM Provider
|
PDOMProviderName=PDOM Provider
|
||||||
|
|
||||||
|
|
|
@ -608,6 +608,12 @@
|
||||||
resolver="org.eclipse.cdt.internal.core.PathEntryVariableResolver"
|
resolver="org.eclipse.cdt.internal.core.PathEntryVariableResolver"
|
||||||
description="%cdt_pathentry_var.description">
|
description="%cdt_pathentry_var.description">
|
||||||
</variable>
|
</variable>
|
||||||
|
<variable
|
||||||
|
description="%core_build_dir.description"
|
||||||
|
name="active_core_build_dir"
|
||||||
|
resolver="org.eclipse.cdt.internal.core.build.CBuildDirectoryResolver"
|
||||||
|
supportsArgument="true">
|
||||||
|
</variable>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.core.variables.dynamicVariables">
|
point="org.eclipse.core.variables.dynamicVariables">
|
||||||
|
|
|
@ -236,6 +236,7 @@ public abstract class CBuildConfiguration extends PlatformObject
|
||||||
return buildFolder;
|
return buildFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public URI getBuildDirectoryURI() throws CoreException {
|
public URI getBuildDirectoryURI() throws CoreException {
|
||||||
return getBuildContainer().getLocationURI();
|
return getBuildContainer().getLocationURI();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.build;
|
package org.eclipse.cdt.core.build;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 6.5
|
* @since 6.5
|
||||||
*/
|
*/
|
||||||
|
@ -20,4 +24,9 @@ public interface ICBuildConfiguration2 {
|
||||||
*/
|
*/
|
||||||
void setActive();
|
void setActive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URI for the directory in which the build is executed.
|
||||||
|
*/
|
||||||
|
URI getBuildDirectoryURI() throws CoreException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2018 QNX Software Systems 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
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.build;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||||
|
import org.eclipse.cdt.core.build.ICBuildConfiguration2;
|
||||||
|
import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
|
||||||
|
import org.eclipse.core.resources.IBuildConfiguration;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.variables.IDynamicVariable;
|
||||||
|
import org.eclipse.core.variables.IDynamicVariableResolver;
|
||||||
|
|
||||||
|
public class CBuildDirectoryResolver implements IDynamicVariableResolver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
|
||||||
|
if (argument == null || argument.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(argument);
|
||||||
|
if (project == null || !project.exists()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IBuildConfiguration config = project.getActiveBuildConfig();
|
||||||
|
|
||||||
|
ICBuildConfigurationManager manager = CCorePlugin.getService(ICBuildConfigurationManager.class);
|
||||||
|
ICBuildConfiguration coreConfig = manager.getBuildConfiguration(config);
|
||||||
|
if (coreConfig == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (coreConfig instanceof ICBuildConfiguration2) {
|
||||||
|
URI uri = ((ICBuildConfiguration2) coreConfig).getBuildDirectoryURI();
|
||||||
|
if (uri != null) {
|
||||||
|
return new File(uri).getAbsolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue