Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorJeff Johnston2018-01-05 20:11:03 +0000
committerJeff Johnston2018-01-11 00:47:29 +0000
commit1ae56d435a608f068c66a203fcfbe9965dcd2a99 (patch)
treed2015c4f6de72c2e3adc0a64ff4f666d864eb2af /build
parent7627e275ef3604b179fe8c92ca8c4ad461824a67 (diff)
downloadorg.eclipse.cdt-1ae56d435a608f068c66a203fcfbe9965dcd2a99.tar.gz
org.eclipse.cdt-1ae56d435a608f068c66a203fcfbe9965dcd2a99.tar.xz
org.eclipse.cdt-1ae56d435a608f068c66a203fcfbe9965dcd2a99.zip
Bug 528169 - Run autotools commands within containers
- add new optional build property to run all Autotool commands in Container - for Autotool nature projects only, add a checkbox to the ContainerPropertyTab to turn this new option on/off - change the AbstractAutotoolsHandler class to look at the optional build properties for the project to determine if the fallback CommandLauncher used to run commands should come from the CommandLauncherManager to run in Container or to a local CommandLauncher - change AutotoolsNewMakeGenerator the same way - add new messages as needed (add a tooltip to warn user that choosing new option may cause inconsistencies for files shared among configurations) Change-Id: Id828ec3015f32f320d2247bd0577944164c71df8
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java25
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java22
2 files changed, 38 insertions, 9 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
index 09593196586..1f2687866a1 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
@@ -51,6 +51,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.makefile.IMakefile;
import org.eclipse.cdt.make.core.makefile.ITarget;
import org.eclipse.cdt.make.core.makefile.ITargetRule;
+import org.eclipse.cdt.managedbuilder.buildproperties.IOptionalBuildProperties;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@@ -114,6 +115,9 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private static final String TARGET = "buildTarget"; //$NON-NLS-1$
private static final String DEFAULT_AUTORECONF = "autoreconf"; //$NON-NLS-1$
+ public static final String RUN_IN_CONFIGURE_LAUNCHER = "org.eclipse.cdt.autotools.core.property.launchAutotoolsInContainer"; //$NON-NLS-1$
+
+
private IProject project;
private IProgressMonitor monitor;
@@ -341,6 +345,15 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
initializeBuildConfigDirs(icfg, toolsCfg);
ICommandLauncher configureLauncher = CommandLauncherManager.getInstance().getCommandLauncher(project);
+ IOptionalBuildProperties props = icfg.getOptionalBuildProperties();
+ boolean runInCfgLauncher = false;
+ if (props != null) {
+ String runInCfgLauncherProperty = props.getProperty(RUN_IN_CONFIGURE_LAUNCHER);
+ if (runInCfgLauncherProperty != null) {
+ runInCfgLauncher = Boolean.parseBoolean(runInCfgLauncherProperty);
+ }
+ }
+
// Create the top-level directory for the build output
if (!createDirectory(buildDir)) {
@@ -397,7 +410,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
System.arraycopy(newArgs, 0, makeargs, 0, newArgs.length);
}
makeargs[makeargs.length - 1] = target;
- rc = runCommand(localCommandLauncher, makeCmd,
+ rc = runCommand(runInCfgLauncher ? configureLauncher : localCommandLauncher, makeCmd,
getProjectLocation(),
makeargs,
AutotoolsPlugin.getResourceString("MakeGenerator.clean.topdir"), //$NON-NLS-1$
@@ -447,7 +460,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
System.arraycopy(newArgs, 0, makeargs, 0, newArgs.length);
}
makeargs[makeargs.length - 1] = target;
- rc = runCommand(localCommandLauncher, makeCmd,
+ rc = runCommand(runInCfgLauncher ? configureLauncher : localCommandLauncher, makeCmd,
buildLocation,
makeargs,
AutotoolsPlugin.getFormattedString("MakeGenerator.clean.builddir", new String[]{buildDir}), //$NON-NLS-1$
@@ -509,7 +522,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
configStatus.delete();
// Get any user-specified arguments for autogen.
String[] autogenArgs = getAutogenArgs(autogenCmdParms);
- rc = runScript(localCommandLauncher, autogenPath,
+ rc = runScript(runInCfgLauncher ? configureLauncher : localCommandLauncher, autogenPath,
autogenPath.removeLastSegments(1), autogenArgs,
AutotoolsPlugin.getFormattedString("MakeGenerator.autogen.sh", new String[]{buildDir}), //$NON-NLS-1$
errMsg, console, autogenEnvs, consoleStart);
@@ -532,7 +545,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
reconfCmd = DEFAULT_AUTORECONF;
IPath reconfCmdPath = new Path(reconfCmd);
reconfArgs[0] = "-i"; //$NON-NLS-1$
- rc = runScript(localCommandLauncher, reconfCmdPath,
+ rc = runScript(runInCfgLauncher ? configureLauncher : localCommandLauncher, reconfCmdPath,
getSourcePath(),
reconfArgs,
AutotoolsPlugin.getFormattedString("MakeGenerator.autoreconf", new String[]{buildDir}), //$NON-NLS-1$
@@ -565,7 +578,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
String[] makeargs = new String[1];
IPath makeCmd = builder.getBuildCommand();
makeargs[0] = "-f" + getMakefileCVSPath().toOSString(); //$NON-NLS-1$
- rc = runCommand(localCommandLauncher, makeCmd,
+ rc = runCommand(runInCfgLauncher ? configureLauncher : localCommandLauncher, makeCmd,
getProjectLocation().append(buildDir),
makeargs,
AutotoolsPlugin.getFormattedString("MakeGenerator.makefile.cvs", new String[]{buildDir}), //$NON-NLS-1$
@@ -597,7 +610,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
reconfCmd = DEFAULT_AUTORECONF;
IPath reconfCmdPath = new Path(reconfCmd);
reconfArgs[0] = "-i"; //$NON-NLS-1$
- rc = runScript(localCommandLauncher, reconfCmdPath,
+ rc = runScript(runInCfgLauncher ? configureLauncher : localCommandLauncher, reconfCmdPath,
getSourcePath(),
reconfArgs,
AutotoolsPlugin.getFormattedString("MakeGenerator.autoreconf", new String[]{buildDir}), //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java
index d26e6cc9643..ae18900b0e8 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java
@@ -20,6 +20,7 @@ import java.util.StringTokenizer;
import org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CommandLauncher;
+import org.eclipse.cdt.core.CommandLauncherManager;
import org.eclipse.cdt.core.ConsoleOutputStream;
import org.eclipse.cdt.core.ICommandLauncher;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
@@ -28,6 +29,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.autotools.core.AutotoolsNewMakeGenerator;
+import org.eclipse.cdt.managedbuilder.buildproperties.IOptionalBuildProperties;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
@@ -300,9 +302,23 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
ArrayList<String> additionalEnvs = new ArrayList<>();
String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs);
- // Get a launcher for the config command...default non-remote to use local
- // commands
- RemoteCommandLauncher launcher = new RemoteCommandLauncher(new CommandLauncher());
+ // Get a launcher for the config command...default for non-remote is a local
+ // launcher, but user can override to perform all Autotool commands in a
+ // Container when build in Container is enabled so check optional build
+ // properties
+ IOptionalBuildProperties props = cfg.getOptionalBuildProperties();
+ boolean runInContainer = false;
+ if (props != null) {
+ String runInContainerProperty = props
+ .getProperty(AutotoolsNewMakeGenerator.RUN_IN_CONFIGURE_LAUNCHER);
+ if (runInContainerProperty != null) {
+ runInContainer = Boolean.parseBoolean(runInContainerProperty);
+ }
+ }
+ ICommandLauncher fallbackLauncher = runInContainer
+ ? CommandLauncherManager.getInstance().getCommandLauncher(project)
+ : new CommandLauncher();
+ RemoteCommandLauncher launcher = new RemoteCommandLauncher(fallbackLauncher);
launcher.setProject(project);
// Set the environment
IEnvironmentVariable variables[] = ManagedBuildManager.getEnvironmentVariableProvider()

Back to the top