Java Code Examples for org.gradle.api.plugins.ExtensionContainer#getByType()

The following examples show how to use org.gradle.api.plugins.ExtensionContainer#getByType() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public Settings(@Nonnull Project project, @Nonnull ExtensionContainer container) {
    _project = project;
    _golang = container.getByType(GolangSettings.class);
    if (!(_golang instanceof ExtensionAware)) {
        throw new IllegalStateException("golang instance (" + _golang + ") of provided extension container (" + container + ") is not an instance of " + ExtensionAware.class.getName() + ".");
    }
    final ExtensionContainer globalExtensions = ((ExtensionAware) _golang).getExtensions();
    _build = globalExtensions.getByType(BuildSettings.class);
    _toolchain = globalExtensions.getByType(ToolchainSettings.class);
    _dependencies = globalExtensions.getByType(DependenciesSettings.class);
    _testing = globalExtensions.getByType(TestingSettings.class);
}
 
Example 2
public void execute(final RegistrationContext<ComponentSpec, BaseComponentSpec> context) {
    ExtensionContainer extensions = context.getExtensions();
    ProjectSourceSet projectSourceSet = extensions.getByType(ProjectSourceSet.class);
    ComponentSpecContainer componentSpecs = extensions.getByType(ComponentSpecContainer.class);
    doRegister(context.getType(), context.getImplementation(), projectSourceSet, componentSpecs, context.getProjectIdentifier());
}
 
Example 3
@Model
LanguageRegistry languages(ExtensionContainer extensions) {
    return extensions.getByType(LanguageRegistry.class);
}
 
Example 4
@Model
ProjectSourceSet sources(ExtensionContainer extensions) {
    return extensions.getByType(ProjectSourceSet.class);
}
 
Example 5
@Model
PublishingExtension publishing(ExtensionContainer extensions) {
    return extensions.getByType(PublishingExtension.class);
}
 
Example 6
Source Project: pygradle   File: ExtensionUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static <T> T getPythonComponentExtension(PythonExtension extension, Class<T> type) {
    ExtensionContainer extensionContainer = ((ExtensionAware) extension).getExtensions();
    return extensionContainer.getByType(type);
}
 
Example 7
public void execute(final RegistrationContext<ComponentSpec, BaseComponentSpec> context) {
    ExtensionContainer extensions = context.getExtensions();
    ProjectSourceSet projectSourceSet = extensions.getByType(ProjectSourceSet.class);
    ComponentSpecContainer componentSpecs = extensions.getByType(ComponentSpecContainer.class);
    doRegister(context.getType(), context.getImplementation(), projectSourceSet, componentSpecs, context.getProjectIdentifier());
}
 
Example 8
@Model
LanguageRegistry languages(ExtensionContainer extensions) {
    return extensions.getByType(LanguageRegistry.class);
}
 
Example 9
@Model
ProjectSourceSet sources(ExtensionContainer extensions) {
    return extensions.getByType(ProjectSourceSet.class);
}
 
Example 10
@Model
PublishingExtension publishing(ExtensionContainer extensions) {
    return extensions.getByType(PublishingExtension.class);
}