Package org.gradle.api.artifacts

Examples of org.gradle.api.artifacts.Configuration


    public void apply(final Project project) {
        project.apply(Collections.singletonMap("plugin", JavaPlugin.class));

        // set up a configuration named 'antlr' for the user to specify the antlr libs to use in case
        // they want a specific version etc.
        final Configuration antlrConfiguration = project.getConfigurations().create(ANTLR_CONFIGURATION_NAME)
                .setVisible(false)
                .setDescription("The Antlr libraries to be used for this project.");

        antlrConfiguration.getIncoming().beforeResolve(new Action<ResolvableDependencies>() {
            public void execute(ResolvableDependencies resolvableDependencies) {
                DependencySet dependencies = antlrConfiguration.getDependencies();
                if (dependencies.isEmpty()) {
                    dependencies.add(project.getDependencies().create("antlr:antlr:2.7.7@jar"));
                }
            }
        });
View Full Code Here


            if (!buildProjectDependencies) {
                return;
            }
            projectAccessListener.beforeResolvingProjectDependency(dependencyProject);

            Configuration configuration = getProjectConfiguration();
            context.add(configuration);
            context.add(configuration.getAllArtifacts());
        }
View Full Code Here

        return ConfigureUtil.configure(configureClosure, dependency);
    }

    private Dependency doAdd(Configuration configuration, Object dependencyNotation, Closure configureClosure) {
        if (dependencyNotation instanceof Configuration) {
            Configuration other = (Configuration) dependencyNotation;
            if (!configurationContainer.contains(other)) {
                throw new UnsupportedOperationException("Currently you can only declare dependencies on configurations from the same project.");
            }
            configuration.extendsFrom(other);
            return null;
View Full Code Here

        return dependencyFactory.createDependency(DependencyFactory.ClassPathNotation.LOCAL_GROOVY);
    }

    public Object methodMissing(String name, Object args) {
        Object[] argsArray = (Object[]) args;
        Configuration configuration = configurationContainer.findByName(name);
        if (configuration == null) {
            throw new MissingMethodException(name, this.getClass(), argsArray);
        }

        List<?> normalizedArgs = CollectionUtils.flattenCollections(argsArray);
View Full Code Here

        setupRoutesCompilation();
        setupPlayAppClasspath();
    }

    private void setupPlayAppClasspath() {
        final Configuration playAppCompileClasspath = createConfigurationWithDefaultDependency(PLAYAPP_COMPILE_CONFIGURATION_NAME, DEFAULT_PLAY_DEPENDENCY);
        playAppCompileClasspath.setDescription("The dependencies to be used for Scala compilation of a Play application.");

        project.getTasks().withType(ScalaCompile.class).all(new Action<ScalaCompile>(){
            public void execute(ScalaCompile scalaCompile) {
                scalaCompile.getConventionMapping().map("classpath", new Callable<FileCollection>() {
                    public FileCollection call() throws Exception {
                        return project.getConfigurations().getByName(PLAYAPP_COMPILE_CONFIGURATION_NAME);
                    }
                });
            }
        });

        final Configuration playAppRuntimeClasspath = project.getConfigurations().create(PLAYAPP_RUNTIME_CONFIGURATION_NAME);
        playAppRuntimeClasspath.extendsFrom(playAppCompileClasspath);
    }
View Full Code Here

        final Configuration playAppRuntimeClasspath = project.getConfigurations().create(PLAYAPP_RUNTIME_CONFIGURATION_NAME);
        playAppRuntimeClasspath.extendsFrom(playAppCompileClasspath);
    }

    private void setupTwirlCompilation() {
        Configuration twirlConfiguration = createConfigurationWithDefaultDependency(TWIRL_CONFIGURATION_NAME, DEFAULT_TWIRL_DEPENDENCY);
        twirlConfiguration.setDescription("The dependencies to be used Play Twirl template compilation.");
        project.getTasks().withType(TwirlCompile.class).all(new Action<TwirlCompile>(){
            public void execute(TwirlCompile twirlCompile) {
                twirlCompile.getConventionMapping().map("compilerClasspath", new Callable<FileCollection>() {
                    public FileCollection call() throws Exception {
                        return project.getConfigurations().getByName(TWIRL_CONFIGURATION_NAME);
View Full Code Here

        }
        return routesCompilerVersion;
    }

    private void setupRoutesCompilation() {
        Configuration routesConfiguration = createConfigurationWithDefaultDependency(PLAY_ROUTES_CONFIGURATION_NAME, DEFAULT_PLAY_ROUTES_DEPENDENCY);
        routesConfiguration.setVisible(false);
        routesConfiguration.setDescription("The dependencies to be used Play Routes compilation.");

        project.getTasks().withType(RoutesCompile.class).all(new Action<RoutesCompile>(){
            public void execute(RoutesCompile routesCompile) {
                final Configuration routesConfiguration = project.getConfigurations().getByName(PLAY_ROUTES_CONFIGURATION_NAME);
                routesCompile.getConventionMapping().map("routesCompilerVersion", new Callable<String>() {
                    public String call() throws Exception {
                        return detectRoutesCompilerVersion(routesConfiguration);
                    }
                });
View Full Code Here

            }
        });
    }

    private Configuration createConfigurationWithDefaultDependency(String configurationName, final String defaultDependency) {
        final Configuration configuration = project.getConfigurations().create(configurationName);
        configuration.setVisible(false);

        configuration.getIncoming().beforeResolve(new Action<ResolvableDependencies>() {
            public void execute(ResolvableDependencies resolvableDependencies) {
                DependencySet dependencies = configuration.getDependencies();
                if (dependencies.isEmpty()) {
                    dependencies.add(project.getDependencies().create(defaultDependency));
                }
            }
        });
View Full Code Here

        assertFalse(conf2ScopeMappingContainer.equals(new DefaultConf2ScopeMappingContainer(testMappings)));
    }

    private Map<Configuration, Conf2ScopeMapping> createTestMappings() {
        Map<Configuration, Conf2ScopeMapping> testMappings = new HashMap<Configuration, Conf2ScopeMapping>() {{
            Configuration configuration = context.mock(Configuration.class);
            put(configuration, new Conf2ScopeMapping(10, configuration, "scope"));
        }};
        return testMappings;
    }
View Full Code Here

    }

    private void configureConfigurations(final Project project) {

        ConfigurationContainer configurations = project.getConfigurations();
        Configuration moduleConfiguration = configurations.create(DEPLOY_CONFIGURATION_NAME).setVisible(false)
                .setTransitive(false).setDescription("Classpath for deployable modules, not transitive.");
        Configuration earlibConfiguration = configurations.create(EARLIB_CONFIGURATION_NAME).setVisible(false)
                .setDescription("Classpath for module dependencies.");

        configurations.getByName(Dependency.DEFAULT_CONFIGURATION)
                .extendsFrom(moduleConfiguration, earlibConfiguration);
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.artifacts.Configuration

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.