Package org.gradle.api.artifacts.dsl

Examples of org.gradle.api.artifacts.dsl.RepositoryHandler


        this.factory = factory;
        this.convention = convention;
    }

    public RepositoryHandler create() {
        RepositoryHandler repositoryHandler = factory.create();
        IConventionAware conventionAwareHandler = (IConventionAware) repositoryHandler;
        if (conventionMapping == null) {
            conventionMapping = conventionAwareHandler.getConventionMapping();
            conventionMapping.setConvention(convention);
        } else {
View Full Code Here


        return create(scriptSource, parentClassLoader, new BasicDomainObjectContext());
    }

    public ScriptHandlerInternal create(ScriptSource scriptSource, ClassLoader parentClassLoader,
                                        DomainObjectContext context) {
        RepositoryHandler repositoryHandler = repositoryHandlerFactory.create();
        ConfigurationContainer configurationContainer = configurationContainerFactory.createConfigurationContainer(
                repositoryHandler, dependencyMetaDataProvider, context);
        DependencyHandler dependencyHandler = new DefaultDependencyHandler(configurationContainer, dependencyFactory,
                projectFinder);
        Collection<Object> key = Arrays.asList(scriptSource.getClassName(), parentClassLoader);
View Full Code Here

    private ResolverFactory repositoryFactoryMock = context.mock(ResolverFactory.class);
    private ClassGenerator classGeneratorMock = context.mock(ClassGenerator.class);

    @Test
    public void createsARepositoryHandler() {
        final RepositoryHandler repositoryHandlerMock = context.mock(DefaultRepositoryHandler.class);

        context.checking(new Expectations() {{
            one(classGeneratorMock).newInstance(DefaultRepositoryHandler.class, repositoryFactoryMock, classGeneratorMock);
            will(returnValue(repositoryHandlerMock));
        }});
View Full Code Here

        }});
    }

    private void expectConfigurationHandlerCreated() {
        context.checking(new Expectations() {{
            RepositoryHandler repositoryHandler = context.mock(TestRepositoryHandler.class);

            allowing(project).getRepositories();
            will(returnValue(repositoryHandler));

            allowing(repositoryHandlerFactory).create();
View Full Code Here

    }

    private void configureUploadTasks(final DefaultDeployerFactory deployerFactory) {
        project.getTasks().withType(Upload.class, new Action<Upload>() {
            public void execute(Upload upload) {
                RepositoryHandler repositories = upload.getRepositories();
                DefaultRepositoryHandler handler = (DefaultRepositoryHandler) repositories;
                DefaultMavenRepositoryHandlerConvention repositoryConvention = new DefaultMavenRepositoryHandlerConvention(handler, deployerFactory);
                new DslObject(repositories).getConvention().getPlugins().put("maven", repositoryConvention);
            }
        });
View Full Code Here

        return create(scriptSource, classLoaderScope, new BasicDomainObjectContext());
    }

    public ScriptHandler create(ScriptSource scriptSource, ClassLoaderScope classLoaderScope, DomainObjectContext context) {
        DependencyResolutionServices services = dependencyManagementServices.create(fileResolver, dependencyMetaDataProvider, projectFinder, context);
        RepositoryHandler repositoryHandler = services.getResolveRepositoryHandler();
        ConfigurationContainer configurationContainer = services.getConfigurationContainer();
        DependencyHandler dependencyHandler = services.getDependencyHandler();
        return new DefaultScriptHandler(scriptSource, repositoryHandler, dependencyHandler, configurationContainer, new ScriptHandlerClassLoaderFactory(scriptSource, classLoaderScope));
    }
View Full Code Here

    static class Rules {
        @Mutate
        @SuppressWarnings("UnusedDeclaration")
        public void createTasks(CollectionBuilder<Task> tasks, final @Path("tasks.publish") Task publishLifecycleTask, PublishingExtension publishingExtension) {
            PublicationContainer publications = publishingExtension.getPublications();
            RepositoryHandler repositories = publishingExtension.getRepositories();

            for (final IvyPublicationInternal publication : publications.withType(IvyPublicationInternal.class)) {

                final String publicationName = publication.getName();
                final String descriptorTaskName = String.format("generateDescriptorFileFor%sPublication", capitalize(publicationName));

                tasks.create(descriptorTaskName, GenerateIvyDescriptor.class, new Action<GenerateIvyDescriptor>() {
                    public void execute(final GenerateIvyDescriptor descriptorTask) {
                        descriptorTask.setDescription(String.format("Generates the Ivy Module Descriptor XML file for publication '%s'.", publication.getName()));
                        descriptorTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
                        descriptorTask.setDescriptor(publication.getDescriptor());

                        ConventionMapping descriptorTaskConventionMapping = new DslObject(descriptorTask).getConventionMapping();
                        descriptorTaskConventionMapping.map("destination", new Callable<Object>() {
                            public Object call() throws Exception {
                                return new File(descriptorTask.getProject().getBuildDir(), "publications/" + publication.getName() + "/ivy.xml");
                            }
                        });

                        publication.setDescriptorFile(descriptorTask.getOutputs().getFiles());
                    }
                });

                for (final IvyArtifactRepository repository : repositories.withType(IvyArtifactRepository.class)) {
                    final String repositoryName = repository.getName();
                    final String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName));

                    tasks.create(publishTaskName, PublishToIvyRepository.class, new Action<PublishToIvyRepository>() {
                        public void execute(PublishToIvyRepository publishTask) {
View Full Code Here

        this.publicationServices = publicationServices;
        this.instantiator = instantiator;
    }

    public void apply(final Project project) {
        RepositoryHandler repositories = publicationServices.createRepositoryHandler();
        PublicationContainer publications = instantiator.newInstance(DefaultPublicationContainer.class, instantiator);

        // TODO Registering an extension should register it with the model registry as well
        project.getExtensions().create(PublishingExtension.NAME, DefaultPublishingExtension.class, repositories, publications);
View Full Code Here

    }

    private ClassPath resolvePluginDependencies(final PluginUseMetaData metadata) {
        DependencyResolutionServices resolution = dependencyResolutionServicesFactory.create();

        RepositoryHandler repositories = resolution.getResolveRepositoryHandler();
        final String repoUrl = metadata.implementation.get("repo");
        repositories.maven(new Action<MavenArtifactRepository>() {
            public void execute(MavenArtifactRepository mavenArtifactRepository) {
                mavenArtifactRepository.setUrl(repoUrl);
            }
        });
View Full Code Here

        List<Result> nonLegacy = categorizedResults.get(false);

        // Could be different to ids in the requests as they may be unqualified
        final Map<Result, String> legacyActualPluginIds = Maps.newLinkedHashMap();
        if (!legacy.isEmpty()) {
            final RepositoryHandler repositories = scriptHandler.getRepositories();
            final List<MavenArtifactRepository> mavenRepos = repositories.withType(MavenArtifactRepository.class);

            for (final Result result : legacy) {
                result.legacyFound.action.execute(new LegacyPluginResolveContext() {
                    public Dependency add(String pluginId, final String m2RepoUrl, Object dependencyNotation) {
                        legacyActualPluginIds.put(result, pluginId);

                        boolean repoExists = any(mavenRepos, new Spec<MavenArtifactRepository>() {
                            public boolean isSatisfiedBy(MavenArtifactRepository element) {
                                return element.getUrl().toString().equals(m2RepoUrl);
                            }
                        });
                        if (!repoExists) {
                            repositories.maven(new Action<MavenArtifactRepository>() {
                                public void execute(MavenArtifactRepository mavenArtifactRepository) {
                                    mavenArtifactRepository.setUrl(m2RepoUrl);
                                }
                            });
                        }
View Full Code Here

TOP

Related Classes of org.gradle.api.artifacts.dsl.RepositoryHandler

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.