Search in sources :

Example 1 with PackageProviderForConfigurations

use of com.google.devtools.build.lib.analysis.config.PackageProviderForConfigurations in project bazel by bazelbuild.

the class ConfigurationFragmentFunction method compute.

@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException, ConfigurationFragmentFunctionException {
    ConfigurationFragmentKey configurationFragmentKey = (ConfigurationFragmentKey) skyKey.argument();
    BuildOptions buildOptions = configurationFragmentKey.getBuildOptions();
    ConfigurationFragmentFactory factory = getFactory(configurationFragmentKey.getFragmentType());
    try {
        PackageProviderForConfigurations packageProvider = new SkyframePackageLoaderWithValueEnvironment(env, ruleClassProvider);
        ConfigurationEnvironment confEnv = new ConfigurationBuilderEnvironment(packageProvider);
        Fragment fragment = factory.create(confEnv, buildOptions);
        if (env.valuesMissing()) {
            return null;
        }
        return new ConfigurationFragmentValue(fragment);
    } catch (InvalidConfigurationException e) {
        // exception with missing Skyframe dependencies.
        if (env.valuesMissing()) {
            return null;
        }
        throw new ConfigurationFragmentFunctionException(e);
    }
}
Also used : ConfigurationFragmentKey(com.google.devtools.build.lib.skyframe.ConfigurationFragmentValue.ConfigurationFragmentKey) PackageProviderForConfigurations(com.google.devtools.build.lib.analysis.config.PackageProviderForConfigurations) ConfigurationEnvironment(com.google.devtools.build.lib.analysis.config.ConfigurationEnvironment) BuildOptions(com.google.devtools.build.lib.analysis.config.BuildOptions) ConfigurationFragmentFactory(com.google.devtools.build.lib.analysis.config.ConfigurationFragmentFactory) Fragment(com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment) InvalidConfigurationException(com.google.devtools.build.lib.analysis.config.InvalidConfigurationException)

Aggregations

Fragment (com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment)1 BuildOptions (com.google.devtools.build.lib.analysis.config.BuildOptions)1 ConfigurationEnvironment (com.google.devtools.build.lib.analysis.config.ConfigurationEnvironment)1 ConfigurationFragmentFactory (com.google.devtools.build.lib.analysis.config.ConfigurationFragmentFactory)1 InvalidConfigurationException (com.google.devtools.build.lib.analysis.config.InvalidConfigurationException)1 PackageProviderForConfigurations (com.google.devtools.build.lib.analysis.config.PackageProviderForConfigurations)1 ConfigurationFragmentKey (com.google.devtools.build.lib.skyframe.ConfigurationFragmentValue.ConfigurationFragmentKey)1