mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-03-28 14:56:28 +01:00
Support environment variables in Core Build projects for Local (#901)
Added an Environment tab to the Core Build launch configurations for the Local target. Similar as the standard C/C++ Application launch configurations for Managed Build.
This commit is contained in:
parent
cfe1db70b4
commit
c51cecd75a
4 changed files with 17 additions and 4 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true
|
||||
Bundle-Version: 8.8.500.qualifier
|
||||
Bundle-Version: 8.8.600.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -15,7 +15,9 @@ import java.io.IOException;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.build.ICBuildConfiguration;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
|
@ -32,6 +34,7 @@ import org.eclipse.core.variables.VariablesPlugin;
|
|||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchManager;
|
||||
import org.eclipse.launchbar.core.target.ILaunchTarget;
|
||||
import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
|
||||
|
||||
|
@ -65,7 +68,15 @@ public class CoreBuildLocalRunLaunchDelegate extends CoreBuildLaunchConfigDelega
|
|||
builder.directory(new File(workingDirectory));
|
||||
}
|
||||
|
||||
buildConfig.setBuildEnvironment(builder.environment());
|
||||
Map<String, String> environment = builder.environment();
|
||||
Map<String, String> launchEnvironment = configuration
|
||||
.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap<>());
|
||||
if (!configuration.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true)) {
|
||||
environment.clear();
|
||||
}
|
||||
environment.putAll(launchEnvironment);
|
||||
|
||||
buildConfig.setBuildEnvironment(environment);
|
||||
Process process = builder.start();
|
||||
DebugPlugin.newProcess(launch, process, exeFile.getPath().lastSegment());
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.launch; singleton:=true
|
||||
Bundle-Version: 10.4.500.qualifier
|
||||
Bundle-Version: 10.4.600.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.launch.ui.CArgumentsTab;
|
|||
import org.eclipse.cdt.launch.ui.corebuild.CoreBuildMainTab;
|
||||
import org.eclipse.cdt.launch.ui.corebuild.CoreBuildTab;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||
import org.eclipse.debug.ui.EnvironmentTab;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||
|
||||
|
@ -24,8 +25,9 @@ public class LocalLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
|
|||
ILaunchConfigurationTab mainTab = new CoreBuildMainTab();
|
||||
ILaunchConfigurationTab buildTab = new CoreBuildTab();
|
||||
ILaunchConfigurationTab argumentsTab = new CArgumentsTab();
|
||||
ILaunchConfigurationTab environmentTab = new EnvironmentTab();
|
||||
|
||||
setTabs(new ILaunchConfigurationTab[] { mainTab, buildTab, argumentsTab });
|
||||
setTabs(new ILaunchConfigurationTab[] { mainTab, buildTab, argumentsTab, environmentTab });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue