Package org.gradle.api.artifacts

Examples of org.gradle.api.artifacts.Configuration


    private class TaskDependencyImpl extends AbstractTaskDependency {
        public void resolve(TaskDependencyResolveContext context) {
            if (!instruction.isRebuild()) {
                return;
            }
            Configuration configuration = getProjectConfiguration();
            context.add(configuration);
            context.add(configuration.getBuildArtifacts());
            for (String taskName : instruction.getTaskNames()) {
                context.add(dependencyProject.getTasks().getByName(taskName));
            }
        }
View Full Code Here


    private JUnit4Mockery context = new JUnit4Mockery();

    @Test
    public void testAddConfigurations() {
        Configuration configurationStub1 = createNamesAndExtendedConfigurationStub("conf1");
        Configuration configurationStub2 = createNamesAndExtendedConfigurationStub("conf2", configurationStub1);
        final DefaultModuleDescriptor moduleDescriptor = HelperUtil.createModuleDescriptor(Collections.EMPTY_SET);

        configurationsToModuleDescriptorConverter.addConfigurations(moduleDescriptor, WrapUtil.toSet(configurationStub1, configurationStub2));

        assertIvyConfigurationIsCorrect(moduleDescriptor.getConfiguration(configurationStub1.getName()),
                expectedIvyConfiguration(configurationStub1));
        assertIvyConfigurationIsCorrect(moduleDescriptor.getConfiguration(configurationStub2.getName()),
                expectedIvyConfiguration(configurationStub2));
        assertThat(moduleDescriptor.getConfigurations().length, equalTo(2));
    }
View Full Code Here

                configuration.isTransitive(),
                null);
    }

    private Configuration createNamesAndExtendedConfigurationStub(final String name, final Configuration... extendsFromConfigurations) {
        final Configuration configurationStub = IvyConverterTestUtil.createNamedConfigurationStub(name, context);
        context.checking(new Expectations() {{
            allowing(configurationStub).isTransitive();
            will(returnValue(true));

            allowing(configurationStub).getDescription();
View Full Code Here

                });
                task.classpath(new Object[] {new Callable() {
                    public Object call() throws Exception {
                        FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
                                .getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                        Configuration providedRuntime = project.getConfigurations().getByName(
                                PROVIDED_RUNTIME_CONFIGURATION_NAME);
                        return runtimeClasspath.minus(providedRuntime);
                    }
                }});
            }
        });
       
        War war = project.getTasks().add(WAR_TASK_NAME, War.class);
        war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
        war.setGroup(BasePlugin.BUILD_GROUP);
        Configuration archivesConfiguration = project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION);
        disableJarTaskAndRemoveFromArchivesConfiguration(project, archivesConfiguration);
        archivesConfiguration.addArtifact(new ArchivePublishArtifact(war));
        configureConfigurations(project.getConfigurations());
    }
View Full Code Here

            }
        }
    }

    public void configureConfigurations(ConfigurationContainer configurationContainer) {
        Configuration provideCompileConfiguration = configurationContainer.add(PROVIDED_COMPILE_CONFIGURATION_NAME).setVisible(false).
                setDescription("Additional compile classpath for libraries that should not be part of the WAR archive.");
        Configuration provideRuntimeConfiguration = configurationContainer.add(PROVIDED_RUNTIME_CONFIGURATION_NAME).setVisible(false).
                extendsFrom(provideCompileConfiguration).
                setDescription("Additional runtime classpath for libraries that should not be part of the WAR archive.");
        configurationContainer.getByName(JavaPlugin.COMPILE_CONFIGURATION_NAME).extendsFrom(provideCompileConfiguration);
        configurationContainer.getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME).extendsFrom(provideRuntimeConfiguration);
    }
View Full Code Here

        test.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
    }

    void configureConfigurations(final Project project) {
        ConfigurationContainer configurations = project.getConfigurations();
        Configuration compileConfiguration = configurations.add(COMPILE_CONFIGURATION_NAME).setVisible(false).
                setDescription("Classpath for compiling the sources.");
        Configuration runtimeConfiguration = configurations.add(RUNTIME_CONFIGURATION_NAME).setVisible(false)
                .extendsFrom(compileConfiguration).
                        setDescription("Classpath for running the compiled sources.");

        Configuration compileTestsConfiguration = configurations.add(TEST_COMPILE_CONFIGURATION_NAME).setVisible(false)
                .extendsFrom(compileConfiguration).setDescription("Classpath for compiling the test sources.");

        configurations.add(TEST_RUNTIME_CONFIGURATION_NAME).setVisible(false).extendsFrom(runtimeConfiguration,
                compileTestsConfiguration).
                setDescription("Classpath for running the test sources.");
View Full Code Here

     * @param configurationName name of configuration to use to find the other projects
     */
    private void addDependsOnTaskInOtherProjects(final Task task, boolean useDependedOn, String otherProjectTaskName,
                                                 String configurationName) {
        Project project = task.getProject();
        final Configuration configuration = project.getConfigurations().getByName(configurationName);
        task.dependsOn(configuration.getTaskDependencyFromProjectDependency(useDependedOn, otherProjectTaskName));
    }
View Full Code Here

                Conf2ScopeMappingContainer.PROVIDED);
    }

    private void configureInstall(Project project) {
        Upload installUpload = project.getTasks().add(INSTALL_TASK_NAME, Upload.class);
        Configuration configuration = project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION);
        installUpload.dependsOn(configuration.getBuildArtifacts());
        installUpload.setConfiguration(configuration);
        installUpload.getRepositories().mavenInstaller(WrapUtil.toMap("name", RepositoryHandler.DEFAULT_MAVEN_INSTALLER_NAME));
        installUpload.setDescription("Does a maven install of the archives artifacts into the local .m2 cache.");
    }
View Full Code Here

    private List<DependencyResolver> createPublishResolversDummy() {
        return WrapUtil.toList(context.mock(DependencyResolver.class, "publish"));
    }

    private Set<Configuration> createConfigurations() {
        final Configuration configurationStub1 = context.mock(Configuration.class, "confStub1");
        final Configuration configurationStub2 = context.mock(Configuration.class, "confStub2");
        context.checking(new Expectations() {{
            allowing(configurationStub1).getName();
            will(returnValue("conf1"));

            allowing(configurationStub1).getHierarchy();
View Full Code Here

    private JUnit4Mockery context = new JUnit4Mockery();

    @Test
    public void testAddArtifacts() {
        final PublishArtifact publishArtifactConf1 = createNamedPublishArtifact("conf1");
        Configuration configurationStub1 = createConfigurationStub(publishArtifactConf1);
        final PublishArtifact publishArtifactConf2 = createNamedPublishArtifact("conf2");
        Configuration configurationStub2 = createConfigurationStub(publishArtifactConf2);
        final ArtifactsExtraAttributesStrategy artifactsExtraAttributesStrategyMock = context.mock(ArtifactsExtraAttributesStrategy.class);
        final Map<String, String> extraAttributesArtifact1 = WrapUtil.toMap("name", publishArtifactConf1.getName());
        final Map<String, String> extraAttributesArtifact2 = WrapUtil.toMap("name", publishArtifactConf2.getName());
        context.checking(new Expectations() {{
            one(artifactsExtraAttributesStrategyMock).createExtraAttributes(publishArtifactConf1);
            will(returnValue(extraAttributesArtifact1));
            one(artifactsExtraAttributesStrategyMock).createExtraAttributes(publishArtifactConf2);
            will(returnValue(extraAttributesArtifact2));
        }});
        DefaultModuleDescriptor moduleDescriptor = HelperUtil.createModuleDescriptor(WrapUtil.toSet(configurationStub1.getName(),
                configurationStub2.getName()));

        DefaultArtifactsToModuleDescriptorConverter artifactsToModuleDescriptorConverter =
                new DefaultArtifactsToModuleDescriptorConverter(artifactsExtraAttributesStrategyMock);

        artifactsToModuleDescriptorConverter.addArtifacts(moduleDescriptor, WrapUtil.toSet(configurationStub1, configurationStub2));
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.