Skip to content

Commit

Permalink
Pass overwrittenVariables to C++ compile action args
Browse files Browse the repository at this point in the history
With this CL aspects have access to C++ modules specific compiler flags.

RELNOTES: None.
PiperOrigin-RevId: 283708758
  • Loading branch information
hlopko authored and copybara-github committed Dec 4, 2019
1 parent be5630b commit 8f3e5ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,17 @@ protected List<String> getArguments(

/**
* Returns {@link CommandLine} instance that contains the exactly same command line as the {@link
* CppCompileAction} owning this {@link CompileCommandLine}.
* CppCompileAction}.
*
* @param cppCompileAction - {@link CppCompileAction} owning this {@link CompileCommandLine}.
*/
public CommandLine getFilteredFeatureConfigurationCommandLine() {
public CommandLine getFilteredFeatureConfigurationCommandLine(CppCompileAction cppCompileAction) {
return new CommandLine() {

@Override
public Iterable<String> arguments() throws CommandLineExpansionException {
return ImmutableList.copyOf(getCompilerOptions(/* overwrittenVariables= */ null));
CcToolchainVariables overwrittenVariables = cppCompileAction.getOverwrittenVariables();
return ImmutableList.copyOf(getCompilerOptions(overwrittenVariables));
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ public Sequence<CommandLineArgsApi> getStarlarkArgs() throws EvalException {
.filter(artifact -> artifact.isDirectory())
.collect(ImmutableSet.toImmutableSet());

CommandLine commandLine = compileCommandLine.getFilteredFeatureConfigurationCommandLine();
CommandLine commandLine = compileCommandLine.getFilteredFeatureConfigurationCommandLine(this);

CommandLineAndParamFileInfo commandLineAndParamFileInfo =
new CommandLineAndParamFileInfo(commandLine, /* paramFileInfo= */ null);
Expand Down Expand Up @@ -1169,6 +1169,10 @@ private static CcToolchainVariables getOverwrittenVariables(Iterable<Artifact> p
return variableBuilder.build();
}

public CcToolchainVariables getOverwrittenVariables() {
return overwrittenVariables;
}

@Override
public Iterable<Artifact> getAllowedDerivedInputs() {
Set<Artifact> result = CompactHashSet.create();
Expand Down

0 comments on commit 8f3e5ed

Please sign in to comment.