Search in sources :

Example 1 with RuleSource

use of org.gradle.model.RuleSource in project gradle by gradle.

the class RuleBasedPluginApplicator method applyRules.

public void applyRules(@Nullable String pluginId, Class<?> clazz) {
    ModelRegistry modelRegistry = target.getModelRegistry();
    Iterable<Class<? extends RuleSource>> declaredSources = ruleDetector.getDeclaredSources(clazz);
    for (Class<? extends RuleSource> ruleSource : declaredSources) {
        ExtractedRuleSource<?> rules = ruleInspector.extract(ruleSource);
        for (Class<?> dependency : rules.getRequiredPlugins()) {
            target.getPluginManager().apply(dependency);
        }
        modelRegistry.getRoot().applyToSelf(rules);
    }
}
Also used : RuleSource(org.gradle.model.RuleSource) ExtractedRuleSource(org.gradle.model.internal.inspect.ExtractedRuleSource) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry)

Example 2 with RuleSource

use of org.gradle.model.RuleSource in project gradle by gradle.

the class RuleBasedPluginTarget method applyRules.

@Override
public void applyRules(@Nullable String pluginId, Class<?> clazz) {
    target.prepareForRuleBasedPlugins();
    ModelRegistry modelRegistry = target.getModelRegistry();
    Iterable<Class<? extends RuleSource>> declaredSources = ruleDetector.getDeclaredSources(clazz);
    for (Class<? extends RuleSource> ruleSource : declaredSources) {
        ExtractedRuleSource<?> rules = ruleInspector.extract(ruleSource);
        for (Class<?> dependency : rules.getRequiredPlugins()) {
            target.getPluginManager().apply(dependency);
        }
        modelRegistry.getRoot().applyToSelf(rules);
    }
}
Also used : RuleSource(org.gradle.model.RuleSource) ExtractedRuleSource(org.gradle.model.internal.inspect.ExtractedRuleSource) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry)

Aggregations

RuleSource (org.gradle.model.RuleSource)2 ExtractedRuleSource (org.gradle.model.internal.inspect.ExtractedRuleSource)2 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)2