diff options
author | 2015-05-20 15:25:50 +0000 | |
---|---|---|
committer | 2015-05-21 09:49:44 +0000 | |
commit | 5b168f3abe7eb1a85425bfa43e99994ed46eb4f0 (patch) | |
tree | 60c7f1d475942f17599706f4ea78bfbf354a36b6 /src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java | |
parent | 7d429acdb4fd8e9889b8a88895b598057752f261 (diff) |
Have ConfiguredTargetFactory subclasses declare which FragmentOptions
they need to create their fragments.
This is prerequisite work for fragment-limited configurations
(configurations that only include the fragments needed by their rules'
transitive closures). Given a set of desired fragment classes, we need
to know which FragmentOptions are needed to instantiate those fragments.
Note that we can't map this relationship the other way (given a set
of FragmentOptions, which fragment classes do they load?). That's
because different fragment loaders may consume overlapping options.
A good example is CppOptions, which is, e.g., used by both the C++
and Python configuration loaders.
At some point, we're probably going to want to force configuration
loaders to only understand options from their own "domain" (or have
well-defined hierarchies). But that's not the reality of today.
--
MOS_MIGRATED_REVID=94091093
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java index 2acfe17981..79e26b2708 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java @@ -14,10 +14,12 @@ package com.google.devtools.build.lib.rules.python; import com.google.common.base.Function; +import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment; import com.google.devtools.build.lib.analysis.config.BuildOptions; import com.google.devtools.build.lib.analysis.config.ConfigurationEnvironment; import com.google.devtools.build.lib.analysis.config.ConfigurationFragmentFactory; +import com.google.devtools.build.lib.analysis.config.FragmentOptions; import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException; import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.rules.cpp.CppOptions; @@ -37,6 +39,11 @@ public class PythonConfigurationLoader implements ConfigurationFragmentFactory { this.cpuTransformer = cpuTransformer; } + @Override + public ImmutableSet<Class<? extends FragmentOptions>> requiredOptions() { + return ImmutableSet.of(PythonOptions.class, CppOptions.class); + } + @Nullable private CrosstoolConfig.CToolchain getToolchain( ConfigurationEnvironment env, BuildOptions buildOptions, Label crosstoolTop) |