Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java21
-rw-r--r--build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewGCCToolChainWizard.java8
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java73
3 files changed, 90 insertions, 12 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index c922c4e32c2..4b1bc8b16ff 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -321,10 +321,13 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
if (tmpFile == null) {
// Have to assume there wasn't a source file. Add one in the
// resource's container
+ // TODO really?
IPath parentPath = resource instanceof IFile ? resource.getParent().getLocation()
: resource.getLocation();
- tmpFile = Files.createTempFile(parentPath.toFile().toPath(), ".sc", ".cpp"); //$NON-NLS-1$ //$NON-NLS-2$
- commandLine.add(tmpFile.toString());
+ if (parentPath.toFile().exists()) {
+ tmpFile = Files.createTempFile(parentPath.toFile().toPath(), ".sc", ".cpp"); //$NON-NLS-1$ //$NON-NLS-2$
+ commandLine.add(tmpFile.toString());
+ }
}
return getScannerInfo(buildConfig, commandLine, buildDirectory, tmpFile);
@@ -490,7 +493,8 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
if (cCommand.contains("gcc")) { //$NON-NLS-1$
cppCommand = cCommand.replace("gcc", "g++"); //$NON-NLS-1$ //$NON-NLS-2$
// Also recognize c++ as an alias for g++
- commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "c++"), "cc", "c++" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ commands = new String[] { cCommand, cppCommand, cCommand.replace("gcc", "cc"), //$NON-NLS-1$ //$NON-NLS-2$
+ cCommand.replace("gcc", "c++") }; //$NON-NLS-1$ //$NON-NLS-2$
} else if (cCommand.contains("clang")) { //$NON-NLS-1$
cppCommand = cCommand.replace("clang", "clang++"); //$NON-NLS-1$ //$NON-NLS-2$
commands = new String[] { cCommand, cppCommand };
@@ -533,12 +537,23 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
// ran into an option, we're done.
break;
}
+ if (i > 1 && cmd.get(i - 1).equals("-o")) { //$NON-NLS-1$
+ // this is an output file
+ --i;
+ continue;
+ }
try {
Path srcPath = Paths.get(arg);
URI uri;
if (srcPath.isAbsolute()) {
uri = srcPath.toUri();
} else {
+ if (arg.startsWith("/") && Platform.getOS().equals(Platform.OS_WIN32)) { //$NON-NLS-1$
+ String drive = srcPath.getName(0).toString();
+ if (drive.length() == 1) {
+ srcPath = Paths.get(drive + ":\\").resolve(srcPath.subpath(1, srcPath.getNameCount())); //$NON-NLS-1$
+ }
+ }
uri = Paths.get(buildDirectoryURI).resolve(srcPath).toUri().normalize();
}
diff --git a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewGCCToolChainWizard.java b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewGCCToolChainWizard.java
index fd34546ad67..797a14f52b4 100644
--- a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewGCCToolChainWizard.java
+++ b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewGCCToolChainWizard.java
@@ -30,8 +30,8 @@ public class NewGCCToolChainWizard extends ToolChainWizard {
@Override
public boolean performFinish() {
Path path = settingsPage.getPath();
- String os = settingsPage.getOS();
- String arch = settingsPage.getArch();
+ String os = settingsPage.getOS().trim();
+ String arch = settingsPage.getArch().trim();
IEnvironmentVariable[] envvars = envPage.getEnvVars();
new Job(Messages.NewGCCToolChainWizard_Add) {
@@ -47,7 +47,9 @@ public class NewGCCToolChainWizard extends ToolChainWizard {
}
GCCToolChain gcc = new GCCToolChain(provider, path, arch, envvars);
- gcc.setProperty(IToolChain.ATTR_OS, os);
+ if (!os.isEmpty()) {
+ gcc.setProperty(IToolChain.ATTR_OS, os);
+ }
provider.addToolChain(gcc);
return Status.OK_STATUS;
} catch (CoreException e) {
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
index 8910088d725..9a66e66d4b7 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
@@ -25,11 +25,15 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
public class MakeBuildSettingsTab extends CommonBuildTab {
private Button projectButton;
private Button configButton;
+ private Text buildCmdText;
+ private Text cleanCmdText;
private boolean defaultProject;
@@ -49,18 +53,35 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
tcControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// Build Output Group
- Group group = new Group(comp, SWT.NONE);
- group.setText("Build Output Location");
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ Group outputGroup = new Group(comp, SWT.NONE);
+ outputGroup.setText("Build Output Location");
+ outputGroup.setLayout(new GridLayout());
+ outputGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- projectButton = new Button(group, SWT.RADIO);
+ projectButton = new Button(outputGroup, SWT.RADIO);
projectButton.setText("Build in project directory");
projectButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- configButton = new Button(group, SWT.RADIO);
+ configButton = new Button(outputGroup, SWT.RADIO);
configButton.setText("Build in configuration specific folder");
configButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Group cmdGroup = new Group(comp, SWT.NONE);
+ cmdGroup.setText("Build Commands");
+ cmdGroup.setLayout(new GridLayout(2, false));
+ cmdGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Label label = new Label(cmdGroup, SWT.NONE);
+ label.setText("Build:");
+
+ buildCmdText = new Text(cmdGroup, SWT.BORDER);
+ buildCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ label = new Label(cmdGroup, SWT.NONE);
+ label.setText("Clean:");
+
+ cleanCmdText = new Text(cmdGroup, SWT.BORDER);
+ cleanCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}
@Override
@@ -85,6 +106,16 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
defaultProject = false;
}
}
+
+ String buildCommand = properties.get(StandardBuildConfiguration.BUILD_COMMAND);
+ if (buildCommand != null && !buildCommand.trim().isEmpty()) {
+ buildCmdText.setText(buildCommand);
+ }
+
+ String cleanCommand = properties.get(StandardBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCommand != null && !cleanCommand.trim().isEmpty()) {
+ cleanCmdText.setText(cleanCommand);
+ }
}
@Override
@@ -102,6 +133,16 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
properties.put(StandardBuildConfiguration.BUILD_CONTAINER,
stdConfig.getProject().getFullPath().toString());
}
+
+ String buildCommand = buildCmdText.getText().trim();
+ if (!buildCommand.isEmpty()) {
+ properties.put(StandardBuildConfiguration.BUILD_COMMAND, buildCommand);
+ }
+
+ String cleanCommand = cleanCmdText.getText().trim();
+ if (!cleanCommand.isEmpty()) {
+ properties.put(StandardBuildConfiguration.CLEAN_COMMAND, cleanCommand);
+ }
}
} catch (CoreException e) {
MakeUIPlugin.log(e.getStatus());
@@ -125,6 +166,16 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
defaultProject = false;
}
}
+
+ String buildCommand = buildConfig.getProperty(StandardBuildConfiguration.BUILD_COMMAND);
+ if (buildCommand != null && !buildCommand.trim().isEmpty()) {
+ buildCmdText.setText(buildCommand);
+ }
+
+ String cleanCommand = buildConfig.getProperty(StandardBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCommand != null && !cleanCommand.trim().isEmpty()) {
+ cleanCmdText.setText(cleanCommand);
+ }
}
@Override
@@ -140,6 +191,16 @@ public class MakeBuildSettingsTab extends CommonBuildTab {
} else if (!defaultProject && projectButton.getSelection()) {
stdConfig.setBuildContainer(stdConfig.getProject());
}
+
+ String buildCommand = buildCmdText.getText().trim();
+ if (!buildCommand.isEmpty()) {
+ stdConfig.setBuildCommand(buildCommand.split(" ")); //$NON-NLS-1$
+ }
+
+ String cleanCommand = cleanCmdText.getText().trim();
+ if (!cleanCommand.isEmpty()) {
+ stdConfig.setCleanCommand(cleanCommand.split(" ")); //$NON-NLS-1$
+ }
}
} catch (CoreException e) {
MakeUIPlugin.log(e.getStatus());

Back to the top