Package org.gradle.api

Examples of org.gradle.api.Plugin


        }});
    }

    @Test
    public void usePluginById() {
        Plugin addedPlugin = projectsPluginHandler.apply(pluginId);
        assertThat(pluginWithIdMock, sameInstance(addedPlugin));
        assertThat(projectsPluginHandler.apply(pluginId), sameInstance(addedPlugin));

        assertThat(projectsPluginHandler.findPlugin(addedPlugin.getClass()), sameInstance(addedPlugin));
        assertThat(projectsPluginHandler.findPlugin(pluginId), sameInstance(addedPlugin));
    }
View Full Code Here


    @Test
    public void usePluginWithIdByType() {
        Class<? extends Plugin> type = pluginWithIdMock.getClass();

        Plugin addedPlugin = projectsPluginHandler.apply(type);
        assertThat(pluginWithIdMock, sameInstance(addedPlugin));
        assertThat(projectsPluginHandler.apply(type), sameInstance(addedPlugin));
        assertThat(projectsPluginHandler.apply(pluginId), sameInstance(addedPlugin));

        assertThat(projectsPluginHandler.findPlugin(type), sameInstance(addedPlugin));
View Full Code Here

    }

    @Test
    public void usePluginWithoutId() {
        Class<? extends Plugin> type = pluginWithoutIdMock.getClass();
        Plugin addedPlugin = projectsPluginHandler.apply(type);
        assertThat(pluginWithoutIdMock, sameInstance(addedPlugin));
        assertThat(projectsPluginHandler.apply(type), sameInstance(addedPlugin));

        assertThat(projectsPluginHandler.findPlugin(type), sameInstance(addedPlugin));
    }
View Full Code Here

        assertThat(projectsPluginHandler.findPlugin(pluginWithIdMock.getClass()), sameInstance((Plugin) pluginWithIdMock));
    }

    @Test
    public void hasAndFindForPluginWithoutId() {
        Plugin plugin = pluginWithoutIdMock;
        Class<? extends Plugin> pluginType = plugin.getClass();
        projectsPluginHandler.apply(pluginType);
        assertThat(projectsPluginHandler.hasPlugin(pluginType), equalTo(true));
        assertThat(projectsPluginHandler.findPlugin(pluginType), sameInstance(plugin));
    }
View Full Code Here

        return null;
    }

    private <T extends Plugin> T addPluginInternal(Class<T> type) {
        if (findPlugin(type) == null) {
            Plugin plugin = providePlugin(type);
            addObject(plugin);
        }
        return type.cast(findPlugin(type));
    }
View Full Code Here

        }
        return type.cast(findPlugin(type));
    }

    public Plugin getPlugin(String id) {
        Plugin plugin = findPlugin(id);
        if (plugin == null) {
            throw new UnknownPluginException("Plugin with id " + id + " has not been used.");
        }
        return plugin;
    }
View Full Code Here

    public <T extends Plugin> T getAt(Class<T> type) throws UnknownPluginException {
        return getPlugin(type);
    }

    public <T extends Plugin> T getPlugin(Class<T> type) throws UnknownPluginException {
        Plugin plugin = findPlugin(type);
        if (plugin == null) {
            throw new UnknownPluginException("Plugin with type " + type + " has not been used.");
        }
        return type.cast(plugin);
    }
View Full Code Here

        return findPlugin(type) != null;
    }

    private Plugin doFindPlugin(String id) {
        for (final PluginManager.PluginWithId pluginWithId : pluginManager.pluginsForId(id)) {
            Plugin plugin = Iterables.find(DefaultPluginContainer.this, new Predicate<Plugin>() {
                public boolean apply(Plugin plugin) {
                    return pluginWithId.clazz.equals(plugin.getClass());
                }
            });

            if (plugin != null) {
                return plugin;
View Full Code Here

    }

    public Plugin findPlugin(String id) {
        String qualified = PluginManager.maybeQualify(id);
        if (qualified != null) {
            Plugin plugin = doFindPlugin(qualified);
            if (plugin != null) {
                return plugin;
            }
        }

        Plugin plugin = doFindPlugin(id);
        if (plugin != null) {
            return plugin;
        }

        return null;
View Full Code Here

            throw new PluginApplicationException(pluginId == null ? "class '" + type.getName() + "'" : "id '" + pluginId + "'", e);
        }
    }

    public Plugin getPlugin(String id) {
        Plugin plugin = findPlugin(id);
        if (plugin == null) {
            throw new UnknownPluginException("Plugin with id " + id + " has not been used.");
        }
        return plugin;
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.Plugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.