org.gradle.platform.base.component.BaseComponentSpec Java Examples

The following examples show how to use org.gradle.platform.base.component.BaseComponentSpec. 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
Source File: ComponentTypeRuleDefinitionHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private <T extends ComponentSpec, I extends BaseComponentSpec> void doRegister(final ModelType<T> type, final ModelType<I> implementation, final ProjectSourceSet projectSourceSet, ComponentSpecContainer componentSpecs, final ProjectIdentifier projectIdentifier) {
    componentSpecs.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() {
        public T create(String name) {
            FunctionalSourceSet componentSourceSet = projectSourceSet.maybeCreate(name);
            ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(projectIdentifier.getPath(), name);

            // safe because we implicitly know that U extends V, but can't express this in the type system
            @SuppressWarnings("unchecked")
            T created = (T) BaseComponentSpec.create(implementation.getConcreteClass(), id, componentSourceSet, instantiator);

            return created;
        }
    });
}
 
Example #2
Source File: ComponentTypeRuleDefinitionHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private <T extends ComponentSpec, I extends BaseComponentSpec> void doRegister(final ModelType<T> type, final ModelType<I> implementation, final ProjectSourceSet projectSourceSet, ComponentSpecContainer componentSpecs, final ProjectIdentifier projectIdentifier) {
    componentSpecs.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() {
        public T create(String name) {
            FunctionalSourceSet componentSourceSet = projectSourceSet.maybeCreate(name);
            ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(projectIdentifier.getPath(), name);

            // safe because we implicitly know that U extends V, but can't express this in the type system
            @SuppressWarnings("unchecked")
            T created = (T) BaseComponentSpec.create(implementation.getConcreteClass(), id, componentSourceSet, instantiator);

            return created;
        }
    });
}
 
Example #3
Source File: ComponentTypeRuleDefinitionHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ComponentTypeRuleDefinitionHandler(final Instantiator instantiator) {
    super("component", ComponentType.class, ComponentSpec.class, BaseComponentSpec.class, ComponentTypeBuilder.class, JavaReflectionUtil.factory(new DirectInstantiator(), DefaultComponentTypeBuilder.class), new RegistrationAction(instantiator));
}
 
Example #4
Source File: ComponentTypeRuleDefinitionHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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 #5
Source File: ComponentTypeRuleDefinitionHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ComponentTypeRuleDefinitionHandler(final Instantiator instantiator) {
    super("component", ComponentType.class, ComponentSpec.class, BaseComponentSpec.class, ComponentTypeBuilder.class, JavaReflectionUtil.factory(new DirectInstantiator(), DefaultComponentTypeBuilder.class), new RegistrationAction(instantiator));
}
 
Example #6
Source File: ComponentTypeRuleDefinitionHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
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());
}