Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support environment variables in Core Build projects for Local #901

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
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;
Expand All @@ -32,6 +34,7 @@
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;

Expand Down Expand Up @@ -65,7 +68,15 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun
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) {
Expand Down
2 changes: 1 addition & 1 deletion launch/org.eclipse.cdt.launch/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
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;

Expand All @@ -24,8 +25,9 @@ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
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