diff options
author | Wainer dos Santos Moschetta | 2016-02-19 18:02:40 -0500 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-03-14 17:20:50 -0400 |
commit | 880b1b606a76bf51cee39f80ddb69d37cacf5d1f (patch) | |
tree | 58e719ee14fdf08a114dfbf284d73a4dbdc9f42a /build/org.eclipse.cdt.autotools.core/src | |
parent | 9d492879be0dd33d284cbf131cc2c1ef45f6c6b9 (diff) | |
download | org.eclipse.cdt-880b1b606a76bf51cee39f80ddb69d37cacf5d1f.tar.gz org.eclipse.cdt-880b1b606a76bf51cee39f80ddb69d37cacf5d1f.tar.xz org.eclipse.cdt-880b1b606a76bf51cee39f80ddb69d37cacf5d1f.zip |
Bug 467771 - add basis to support autotools option as NAME=VALUE
It is not obvious in autotools preferences UI how to set variables like CC=/sbin/gcc
Introduces the basis to allow extend the UI to include such as kind of variables.
Change-Id: Ife0aada50d8c253f3fff39e7087f5fd54803ba48
Signed-off-by: Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core/src')
7 files changed, 99 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java index a0ebb91ef5..2068ad00fa 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java @@ -58,5 +58,10 @@ public class AutotoolsOptionConstants { public static final String TOOL_AUTOGEN = "autogen"; // $NON-NLS-1$ public static final String CATEGORY_OPTIONS = "options"; // $NON-NLS-1$ public static final String OPT_AUTOGENOPTS = "autogenOpts"; // $NON-NLS-1$ + /** + * @since 2.0 + */ + public static final String CATEGORY_ENVVAR = "cat_envvar"; // $NON-NLS-1$ + public final static String OPT_ENVVAR = "env_vars"; // $NON-NLS-1$ } diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/IAutotoolsOption.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/IAutotoolsOption.java index d51d675b47..f31212eab8 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/IAutotoolsOption.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/IAutotoolsOption.java @@ -22,6 +22,10 @@ public interface IAutotoolsOption { int TOOL = 5; int FLAG = 6; int FLAGVALUE = 7; + /** + * @since 2.0 + */ + int ENVVAR = 8; int getType(); diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java index c0c162068b..5a1b16e07b 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java @@ -102,6 +102,8 @@ public class AutotoolsConfiguration implements IAConfiguration { new Option(AutotoolsOptionConstants.OPT_PROGRAM_PREFIX, "program_prefix", IConfigureOption.STRING), // $NON-NLS-1$ new Option(AutotoolsOptionConstants.OPT_PROGRAM_SUFFIX, "program_suffix", IConfigureOption.STRING), // $NON-NLS-1$ new Option(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME, "program_transform_name", IConfigureOption.STRING), // $NON-NLS-1$ + new Option(AutotoolsOptionConstants.CATEGORY_ENVVAR, IConfigureOption.CATEGORY), + new Option(AutotoolsOptionConstants.OPT_ENVVAR, IConfigureOption.ENVVAR), new Option(AutotoolsOptionConstants.CATEGORY_FEATURES, IConfigureOption.CATEGORY), new Option(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE, "enable_maintainer_mode", IConfigureOption.BIN), // $NON-NLS-1$ new Option(AutotoolsOptionConstants.FLAG_CFLAGS, "cflags", AutotoolsOptionConstants.FLAG_CFLAGS_FLAGS, IConfigureOption.FLAG), // $NON-NLS-1$ @@ -193,6 +195,12 @@ public class AutotoolsConfiguration implements IAConfiguration { lastFlag.addChild(opt.name); configOptions.put(opt.name, fv); break; + case IConfigureOption.ENVVAR: + VariableConfigureOption v = new VariableConfigureOption(opt.name, opt.transformedName, this); + if (defaultValue != null) + v.setValue(defaultValue); + configOptions.put(opt.name, v); + break; } } toolList = tools.toArray(new Option[tools.size()]); diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java index 4581667a54..b8e0e3a4f2 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfigurationManager.java @@ -566,6 +566,7 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener { case FLAGVALUE: case MULTIARG: case INTERNAL: + case ENVVAR: return true; } return false; diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties index 6b62caa9f7..b9ba02bbae 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties @@ -91,6 +91,10 @@ Option.configure.cflags_gcov.parm=-fprofile-arcs -ftest-coverage Option.configure.cflags=Compiler Flags: +Option.configure.cat_envvar=Environment variables +Option.configure.env_vars=Export environment variables +Option.configure.env_vars.tip=Environment variables to be used during configuration + Option.configure.autogen=autogen Option.configure.options=Options Option.configure.autogenOpts=Additional command-line options diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/IConfigureOption.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/IConfigureOption.java index 46385573bc..4854ca9582 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/IConfigureOption.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/IConfigureOption.java @@ -24,6 +24,10 @@ public interface IConfigureOption { int TOOL = IAutotoolsOption.TOOL; int FLAG = IAutotoolsOption.FLAG; int FLAGVALUE = IAutotoolsOption.FLAGVALUE; + /** + * @since 2.0 + */ + int ENVVAR = IAutotoolsOption.ENVVAR; String getName(); diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/VariableConfigureOption.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/VariableConfigureOption.java new file mode 100644 index 0000000000..036e3b4f96 --- /dev/null +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/VariableConfigureOption.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2016 IBM Corporation. + * 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 + * + * Contributors: + * Wainer dos Santos Moschetta - initial implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.autotools.core.configure; + +/** + * This class represents a a list of environment variables as NAME="VALUE" + * + * @since 2.0 + * + */ +public class VariableConfigureOption extends AbstractConfigurationOption { + + private String value; + + public VariableConfigureOption(String name, AutotoolsConfiguration cfg) { + super(name, cfg); + this.value = ""; // $NON-NLS-1$ + } + + public VariableConfigureOption(String name, String transformedName, AutotoolsConfiguration autotoolsConfiguration) { + super(name, transformedName, autotoolsConfiguration); + this.value = ""; // $NON-NLS-1$ + } + + public VariableConfigureOption(String name, AutotoolsConfiguration cfg, String value) { + super(name, cfg); + this.value = value; + } + + @Override + public String getParameter() { + if (isParmSet()) + return this.value; + return ""; //$NON-NLS-1$ + } + + @Override + public boolean isParmSet() { + return !this.value.isEmpty(); + } + + @Override + public IConfigureOption copy(AutotoolsConfiguration cfg) { + return new VariableConfigureOption(name, cfg, value); + } + + @Override + public void setValue(String newValue) { + if (!newValue.equals(value)) { + cfg.setDirty(true); + value = newValue; + } + } + + @Override + public String getValue() { + return value; + } + + @Override + public int getType() { + return ENVVAR; + } + +} |