Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2015-03-22 15:39:08 -0400
committerGerrit Code Review @ Eclipse.org2015-03-23 15:29:31 -0400
commit862705bb45d13bcb45e860b9a97b358db9f1b92f (patch)
tree3ccab67303d1f5525036536b20aa692561a17896 /build/org.eclipse.cdt.autotools.core/src
parent12bb52805e76f63810b92d9b1ac79638e90a8f33 (diff)
downloadorg.eclipse.cdt-862705bb45d13bcb45e860b9a97b358db9f1b92f.tar.gz
org.eclipse.cdt-862705bb45d13bcb45e860b9a97b358db9f1b92f.tar.xz
org.eclipse.cdt-862705bb45d13bcb45e860b9a97b358db9f1b92f.zip
Bug 426628 - Define V=1 env variable by default for Autotools projects
This enables verbose output which is necessary for proper GCC output parsing. Change-Id: I965c50cb4ca3ea46e73efa4d8eb3d7de582deabc Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core/src')
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsEnvironmentVariableSupplier.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsEnvironmentVariableSupplier.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsEnvironmentVariableSupplier.java
new file mode 100644
index 0000000000..221578fc9d
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsEnvironmentVariableSupplier.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Ericson and others.
+ * 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:
+ * Marc-Andre Laperle (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.autotools.core;
+
+import org.eclipse.cdt.core.envvar.EnvironmentVariable;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
+import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Supplies some default environment variables for the Autotools toolchain. For
+ * example, V=1 to enable verbose output necessary for proper GCC output
+ * parsing.
+ *
+ * @noreference This class is not intended to be referenced by clients.
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public class AutotoolsEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier {
+
+ private static class VerboseEnvironmentVariable extends EnvironmentVariable implements IBuildEnvironmentVariable {
+ private static final String VERBOSE_VAR_NAME = "V";
+ private static final String VERBOSE_VAR_VALUE = "1";
+
+ private VerboseEnvironmentVariable(String name, String value, int op, String delimiter) {
+ super(name, value, op, delimiter);
+ }
+
+ private static boolean isVar(String name) {
+ // Windows has case insensitive env var names
+ return Platform.getOS().equals(Platform.OS_WIN32) ? name.equalsIgnoreCase(VerboseEnvironmentVariable.VERBOSE_VAR_NAME)
+ : name.equals(VerboseEnvironmentVariable.VERBOSE_VAR_NAME);
+ }
+
+ private static IBuildEnvironmentVariable create(IConfiguration configuration) {
+ return new VerboseEnvironmentVariable(VERBOSE_VAR_NAME, VERBOSE_VAR_VALUE, IEnvironmentVariable.ENVVAR_PREPEND, null);
+ }
+ }
+
+ public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration,
+ IEnvironmentVariableProvider provider) {
+ IBuildEnvironmentVariable path = VerboseEnvironmentVariable.create(configuration);
+ return new IBuildEnvironmentVariable[] { path };
+ }
+
+ @Override
+ public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
+ IEnvironmentVariableProvider provider) {
+ if (VerboseEnvironmentVariable.isVar(variableName)) {
+ return VerboseEnvironmentVariable.create(configuration);
+ } else {
+ return null;
+ }
+ }
+}

Back to the top