diff options
author | 2016-11-16 15:48:25 +0000 | |
---|---|---|
committer | 2016-11-16 16:07:04 +0000 | |
commit | b782fd45f7046a94a617ec8aec76ee5513555924 (patch) | |
tree | df8cc2fe27d862d35302a8dd116d1dfd47f4ef82 /src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java | |
parent | 4e8e67bcf25ea4e06c16104fc7f4db528a16508f (diff) |
Simplify Crosstool Build Variables context
This cl merges two classes used to hold build variables context into one. Those
classes are (previously top-level) jcgd.build.lib.rules.cpp.Variables, and its
inner class View. Both represent a collection of build variables and imo it
makes sense to merge them to make the code simpler.
Also, I cleaned up the build variables api to use primitive strings or instances of VariableValueBuilders, and I've hidden subclasses of VariableValues.
Last but not least, I refactored the code to use immutable collections exclusively. That revealed that 'module_files' variable is sometimes registered twice. I want to clean this eventually ([]).
--
MOS_MIGRATED_REVID=139329823
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java index 9e09b0643c..1e37bda60c 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java @@ -514,8 +514,7 @@ public class FdoSupport { } if (featureConfiguration.isEnabled(CppRuleClasses.FDO_INSTRUMENT)) { - buildVariables.addVariable("fdo_instrument_path", - fdoInstrument.getPathString()); + buildVariables.addStringVariable("fdo_instrument_path", fdoInstrument.getPathString()); } // Optimization phase @@ -530,16 +529,16 @@ public class FdoSupport { builder.addMandatoryInputs(auxiliaryInputs); if (!Iterables.isEmpty(auxiliaryInputs)) { if (featureConfiguration.isEnabled(CppRuleClasses.AUTOFDO)) { - buildVariables.addVariable("fdo_profile_path", - getAutoProfilePath(fdoProfile, fdoRootExecPath).getPathString()); + buildVariables.addStringVariable( + "fdo_profile_path", getAutoProfilePath(fdoProfile, fdoRootExecPath).getPathString()); } if (featureConfiguration.isEnabled(CppRuleClasses.FDO_OPTIMIZE)) { if (fdoMode == FdoMode.LLVM_FDO) { - buildVariables.addVariable("fdo_profile_path", + buildVariables.addStringVariable( + "fdo_profile_path", getLLVMProfilePath(fdoProfile, fdoRootExecPath).getPathString()); } else { - buildVariables.addVariable("fdo_profile_path", - fdoRootExecPath.getPathString()); + buildVariables.addStringVariable("fdo_profile_path", fdoRootExecPath.getPathString()); } } } @@ -698,8 +697,7 @@ public class FdoSupport { CcToolchainFeatures.Variables.Builder buildVariables ) { if (featureConfiguration.isEnabled(CppRuleClasses.FDO_INSTRUMENT)) { - buildVariables.addVariable("fdo_instrument_path", - fdoInstrument.getPathString()); + buildVariables.addStringVariable("fdo_instrument_path", fdoInstrument.getPathString()); } } |