diff options
author | cpeyser <cpeyser@google.com> | 2017-04-04 20:39:17 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2017-04-05 15:19:04 +0200 |
commit | b5bb3a21bca352bf0e7ed8f5fe866369979be272 (patch) | |
tree | c886cf06857329dcff90aa7e3174449a6368d645 /src | |
parent | d6d27083b526a9288bd9bd1d35e0442b5c9f7ab6 (diff) |
Add environment variables to CppCompileInfo.
PiperOrigin-RevId: 152173189
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | 9 | ||||
-rw-r--r-- | src/main/protobuf/extra_actions_base.proto | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java index 741ca596c8..89294373bc 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java @@ -37,6 +37,7 @@ import com.google.devtools.build.lib.actions.ExecutionInfoSpecifier; import com.google.devtools.build.lib.actions.Executor; import com.google.devtools.build.lib.actions.ResourceSet; import com.google.devtools.build.lib.actions.extra.CppCompileInfo; +import com.google.devtools.build.lib.actions.extra.EnvironmentVariable; import com.google.devtools.build.lib.actions.extra.ExtraActionInfo; import com.google.devtools.build.lib.analysis.actions.ExecutionRequirements; import com.google.devtools.build.lib.analysis.config.PerLabelOptions; @@ -76,6 +77,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.UUID; import javax.annotation.Nullable; @@ -770,6 +772,13 @@ public class CppCompileAction extends AbstractAction info.addAllSourcesAndHeaders( Artifact.toExecPaths(context.getDeclaredIncludeSrcs())); } + for (Entry<String, String> envVariable : getEnvironment().entrySet()) { + info.addVariable( + EnvironmentVariable.newBuilder() + .setName(envVariable.getKey()) + .setValue(envVariable.getValue()) + .build()); + } return super.getExtraActionInfo() .setExtension(CppCompileInfo.cppCompileInfo, info.build()); diff --git a/src/main/protobuf/extra_actions_base.proto b/src/main/protobuf/extra_actions_base.proto index 3c63e8b854..759e0c37d3 100644 --- a/src/main/protobuf/extra_actions_base.proto +++ b/src/main/protobuf/extra_actions_base.proto @@ -109,7 +109,7 @@ message SpawnInfo { } repeated string argument = 1; - // An *unordered* list of environment variables and their values. + // A list of environment variables and their values. No order is enforced. repeated EnvironmentVariable variable = 2; repeated string input_file = 4; repeated string output_file = 5; @@ -130,6 +130,8 @@ message CppCompileInfo { // actually performed. If set, this field will include the value of // "source_file" in addition to the headers. repeated string sources_and_headers = 5; + // A list of environment variables and their values. No order is enforced. + repeated EnvironmentVariable variable = 6; } // Provides access to data that is specific to C++ link actions. |