• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PublishingPlugin类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.gradle.api.publish.plugins.PublishingPlugin的典型用法代码示例。如果您正苦于以下问题:Java PublishingPlugin类的具体用法?Java PublishingPlugin怎么用?Java PublishingPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

PublishingPlugin类属于org.gradle.api.publish.plugins包,在下文中一共展示了PublishingPlugin类的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: apply

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public void apply(final Project project) {
    project.getPluginManager().apply(PublishingPlugin.class);

    final TaskContainer tasks = project.getTasks();
    final Task publishLocalLifecycleTask = tasks.create(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
    publishLocalLifecycleTask.setDescription("Publishes all Maven publications produced by this project to the local Maven cache.");
    publishLocalLifecycleTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);

    // Can't move this to rules yet, because it has to happen before user deferred configurable actions
    project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
        public void execute(PublishingExtension extension) {
            // Register factory for MavenPublication
            extension.getPublications().registerFactory(MavenPublication.class, new MavenPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
        }
    });
}
 

开发者ID:lxxlxx888,
项目名称:Reer,
代码行数:17,
代码来源:MavenPublishPlugin.java

示例2: realizePublishingTasks

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
@Mutate
@SuppressWarnings("UnusedDeclaration")
public void realizePublishingTasks(ModelMap<Task> tasks, PublishingExtension extension, @Path("buildDir") File buildDir) {
    // Create generatePom tasks for any Maven publication
    PublicationContainer publications = extension.getPublications();
    Task publishLifecycleTask = tasks.get(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME);
    Task publishLocalLifecycleTask = tasks.get(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);

    for (final MavenPublicationInternal publication : publications.withType(MavenPublicationInternal.class)) {
        String publicationName = publication.getName();

        createGeneratePomTask(tasks, publication, publicationName, buildDir);
        createLocalInstallTask(tasks, publishLocalLifecycleTask, publication, publicationName);
        createPublishTasksForEachMavenRepo(tasks, extension, publishLifecycleTask, publication, publicationName);
    }
}
 

开发者ID:lxxlxx888,
项目名称:Reer,
代码行数:17,
代码来源:MavenPublishPlugin.java

示例3: createPublishTasksForEachMavenRepo

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createPublishTasksForEachMavenRepo(ModelMap<Task> tasks, PublishingExtension extension, final Task publishLifecycleTask, final MavenPublicationInternal publication,
                                                final String publicationName) {
    for (final MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
        final String repositoryName = repository.getName();

        String publishTaskName = "publish" + capitalize(publicationName) + "PublicationTo" + capitalize(repositoryName) + "Repository";

        tasks.create(publishTaskName, PublishToMavenRepository.class, new Action<PublishToMavenRepository>() {
            public void execute(PublishToMavenRepository publishTask) {
                publishTask.setPublication(publication);
                publishTask.setRepository(repository);
                publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
                publishTask.setDescription("Publishes Maven publication '" + publicationName + "' to Maven repository '" + repositoryName + "'.");

            }
        });
        publishLifecycleTask.dependsOn(publishTaskName);
    }
}
 

开发者ID:lxxlxx888,
项目名称:Reer,
代码行数:20,
代码来源:MavenPublishPlugin.java

示例4: apply

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public void apply(final Project project) {
    project.getPlugins().apply(PublishingPlugin.class);

    final TaskContainer tasks = project.getTasks();
    final Task publishLocalLifecycleTask = tasks.create(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
    publishLocalLifecycleTask.setDescription("Publishes all Maven publications produced by this project to the local Maven cache.");
    publishLocalLifecycleTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);

    // Can't move this to rules yet, because it has to happen before user deferred configurable actions
    project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
        public void execute(PublishingExtension extension) {
            // Register factory for MavenPublication
            extension.getPublications().registerFactory(MavenPublication.class, new MavenPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
        }
    });
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:17,
代码来源:MavenPublishPlugin.java

示例5: createPublishTasksForEachMavenRepo

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createPublishTasksForEachMavenRepo(CollectionBuilder<Task> tasks, PublishingExtension extension, final Task publishLifecycleTask, final MavenPublicationInternal publication,
                                                final String publicationName) {
    for (final MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
        final String repositoryName = repository.getName();

        String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName));

        tasks.create(publishTaskName, PublishToMavenRepository.class, new Action<PublishToMavenRepository>() {
            public void execute(PublishToMavenRepository publishTask) {
                publishTask.setPublication(publication);
                publishTask.setRepository(repository);
                publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
                publishTask.setDescription(String.format("Publishes Maven publication '%s' to Maven repository '%s'.", publicationName, repositoryName));

                //Because dynamic rules are not yet implemented we have to violate input immutability here as an interim step
                publishLifecycleTask.dependsOn(publishTask);
            }
        });
    }
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:21,
代码来源:MavenPublishPlugin.java

示例6: createGeneratePomTask

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createGeneratePomTask(CollectionBuilder<Task> tasks, final MavenPublicationInternal publication, String publicationName) {
    String descriptorTaskName = String.format("generatePomFileFor%sPublication", capitalize(publicationName));
    tasks.create(descriptorTaskName, GenerateMavenPom.class, new Action<GenerateMavenPom>() {
        public void execute(final GenerateMavenPom generatePomTask) {
            generatePomTask.setDescription(String.format("Generates the Maven POM file for publication '%s'.", publication.getName()));
            generatePomTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
            generatePomTask.setPom(publication.getPom());

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

            // Wire the generated pom into the publication.
            publication.setPomFile(generatePomTask.getOutputs().getFiles());
        }
    });
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:21,
代码来源:MavenPublishPlugin.java

示例7: createGeneratePomTask

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createGeneratePomTask(final MavenPublicationInternal publication, String publicationName) {
    String descriptorTaskName = String.format("generatePomFileFor%sPublication", capitalize(publicationName));
    GenerateMavenPom generatePomTask = project.getTasks().create(descriptorTaskName, GenerateMavenPom.class);
    generatePomTask.setDescription(String.format("Generates the Maven POM file for publication '%s'.", publication.getName()));
    generatePomTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
    generatePomTask.setPom(publication.getPom());

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

    // Wire the generated pom into the publication.
    publication.setPomFile(generatePomTask.getOutputs().getFiles());
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:18,
代码来源:MavenPublishTaskModelRule.java

示例8: apply

点赞 3

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public void apply(final Project project) {
    project.getPlugins().apply(PublishingPlugin.class);

    final TaskContainer tasks = project.getTasks();
    final Task publishLifecycleTask = tasks.getByName(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME);
    final Task publishLocalLifecycleTask = tasks.create(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
    publishLocalLifecycleTask.setDescription("Publishes all Maven publications produced by this project to the local Maven cache.");
    publishLocalLifecycleTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);

    // Can't move this to rules yet, because it has to happen before user deferred configurable actions
    project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
        public void execute(PublishingExtension extension) {
            // Register factory for MavenPublication
            extension.getPublications().registerFactory(MavenPublication.class, new MavenPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
        }
    });

    modelRules.rule(new MavenPublishTaskModelRule(project, publishLifecycleTask, publishLocalLifecycleTask));
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:20,
代码来源:MavenPublishPlugin.java

示例9: createLocalInstallTask

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createLocalInstallTask(ModelMap<Task> tasks, final Task publishLocalLifecycleTask, final MavenPublicationInternal publication, final String publicationName) {
    final String installTaskName = "publish" + capitalize(publicationName) + "PublicationToMavenLocal";

    tasks.create(installTaskName, PublishToMavenLocal.class, new Action<PublishToMavenLocal>() {
        public void execute(PublishToMavenLocal publishLocalTask) {
            publishLocalTask.setPublication(publication);
            publishLocalTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
            publishLocalTask.setDescription("Publishes Maven publication '" + publicationName + "' to the local Maven repository.");
        }
    });
    publishLocalLifecycleTask.dependsOn(installTaskName);
}
 

开发者ID:lxxlxx888,
项目名称:Reer,
代码行数:13,
代码来源:MavenPublishPlugin.java

示例10: createGeneratePomTask

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createGeneratePomTask(ModelMap<Task> tasks, final MavenPublicationInternal publication, final String publicationName, final File buildDir) {
    String descriptorTaskName = "generatePomFileFor" + capitalize(publicationName) + "Publication";
    tasks.create(descriptorTaskName, GenerateMavenPom.class, new Action<GenerateMavenPom>() {
        public void execute(final GenerateMavenPom generatePomTask) {
            generatePomTask.setDescription("Generates the Maven POM file for publication '" + publicationName + "'.");
            generatePomTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
            generatePomTask.setPom(publication.getPom());
            generatePomTask.setDestination(new File(buildDir, "publications/" + publication.getName() + "/pom-default.xml"));
        }
    });
    // Wire the generated pom into the publication.
    publication.setPomFile(tasks.get(descriptorTaskName).getOutputs().getFiles());
}
 

开发者ID:lxxlxx888,
项目名称:Reer,
代码行数:14,
代码来源:MavenPublishPlugin.java

示例11: apply

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public void apply(final Project project) {
    project.getPluginManager().apply(PublishingPlugin.class);

    // Can't move this to rules yet, because it has to happen before user deferred configurable actions
    project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
        public void execute(PublishingExtension extension) {
            // Register factory for MavenPublication
            extension.getPublications().registerFactory(IvyPublication.class, new IvyPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
        }
    });
}
 

开发者ID:lxxlxx888,
项目名称:Reer,
代码行数:12,
代码来源:IvyPublishPlugin.java

示例12: createTasks

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
@Mutate
@SuppressWarnings("UnusedDeclaration")
public void createTasks(ModelMap<Task> tasks, PublishingExtension publishingExtension, @Path("buildDir") final File buildDir) {
    PublicationContainer publications = publishingExtension.getPublications();
    RepositoryHandler repositories = publishingExtension.getRepositories();

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

        final String publicationName = publication.getName();
        final String descriptorTaskName = "generateDescriptorFileFor" + capitalize(publicationName) + "Publication";

        tasks.create(descriptorTaskName, GenerateIvyDescriptor.class, new Action<GenerateIvyDescriptor>() {
            public void execute(final GenerateIvyDescriptor descriptorTask) {
                descriptorTask.setDescription("Generates the Ivy Module Descriptor XML file for publication '" + publicationName + "'.");
                descriptorTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
                descriptorTask.setDescriptor(publication.getDescriptor());
                descriptorTask.setDestination(new File(buildDir, "publications/" + publicationName + "/ivy.xml"));
            }
        });
        publication.setDescriptorFile(tasks.get(descriptorTaskName).getOutputs().getFiles());

        for (final IvyArtifactRepository repository : repositories.withType(IvyArtifactRepository.class)) {
            final String repositoryName = repository.getName();
            final String publishTaskName = "publish" + capitalize(publicationName) + "PublicationTo" + capitalize(repositoryName) + "Repository";

            tasks.create(publishTaskName, PublishToIvyRepository.class, new Action<PublishToIvyRepository>() {
                public void execute(PublishToIvyRepository publishTask) {
                    publishTask.setPublication(publication);
                    publishTask.setRepository(repository);
                    publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
                    publishTask.setDescription("Publishes Ivy publication '" + publicationName + "' to Ivy repository '" + repositoryName + "'.");
                }
            });
            tasks.get(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME).dependsOn(publishTaskName);
        }
    }
}
 

开发者ID:lxxlxx888,
项目名称:Reer,
代码行数:38,
代码来源:IvyPublishPlugin.java

示例13: createInstallTask

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
/**
 * Create the install task from the Maven configuration
 *
 * @param tasks Task model to create task in
 */
@Mutate
public void createInstallTask(ModelMap<Task> tasks) {
    tasks.create("install", Task.class, t -> {
        t.setDescription("Install to local repository, convenience alias for 'publishToMavenLocal'");
        t.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
        t.dependsOn(MavenPublishPlugin.PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
    });
}
 

开发者ID:jochenseeber,
项目名称:gradle-project-config,
代码行数:14,
代码来源:MavenConfigPlugin.java

示例14: createLocalInstallTask

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createLocalInstallTask(CollectionBuilder<Task> tasks, final Task publishLocalLifecycleTask, final MavenPublicationInternal publication, final String publicationName) {
    final String installTaskName = String.format("publish%sPublicationToMavenLocal", capitalize(publicationName));

    tasks.create(installTaskName, PublishToMavenLocal.class, new Action<PublishToMavenLocal>() {
        public void execute(PublishToMavenLocal publishLocalTask) {
            publishLocalTask.setPublication(publication);
            publishLocalTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
            publishLocalTask.setDescription(String.format("Publishes Maven publication '%s' to the local Maven repository.", publicationName));

            //Because dynamic rules are not yet implemented we have to violate input immutability here as an interim step
            publishLocalLifecycleTask.dependsOn(installTaskName);
        }
    });
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:15,
代码来源:MavenPublishPlugin.java

示例15: apply

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public void apply(final Project project) {
    project.getPlugins().apply(PublishingPlugin.class);

    // Can't move this to rules yet, because it has to happen before user deferred configurable actions
    project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
        public void execute(PublishingExtension extension) {
            // Register factory for MavenPublication
            extension.getPublications().registerFactory(IvyPublication.class, new IvyPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
        }
    });
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:12,
代码来源:IvyPublishPlugin.java

示例16: createPublishTasksForEachMavenRepo

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createPublishTasksForEachMavenRepo(TaskContainer tasks, PublishingExtension extension, MavenPublicationInternal publication, String publicationName) {
    for (MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
        String repositoryName = repository.getName();

        String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName));

        PublishToMavenRepository publishTask = tasks.create(publishTaskName, PublishToMavenRepository.class);
        publishTask.setPublication(publication);
        publishTask.setRepository(repository);
        publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
        publishTask.setDescription(String.format("Publishes Maven publication '%s' to Maven repository '%s'.", publicationName, repositoryName));

        publishLifecycleTask.dependsOn(publishTask);
    }
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:16,
代码来源:MavenPublishTaskModelRule.java

示例17: createLocalInstallTask

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
private void createLocalInstallTask(TaskContainer tasks, MavenPublicationInternal publication, String publicationName) {
    String installTaskName = String.format("publish%sPublicationToMavenLocal", capitalize(publicationName));

    PublishToMavenLocal publishLocalTask = tasks.create(installTaskName, PublishToMavenLocal.class);
    publishLocalTask.setPublication(publication);
    publishLocalTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
    publishLocalTask.setDescription(String.format("Publishes Maven publication '%s' to the local Maven repository.", publicationName));

    publishLocalLifecycleTask.dependsOn(installTaskName);
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:11,
代码来源:MavenPublishTaskModelRule.java

示例18: createTasks

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public void createTasks(TaskContainer tasks, 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));

        GenerateIvyDescriptor descriptorTask = tasks.create(descriptorTaskName, GenerateIvyDescriptor.class);
        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(project.getBuildDir(), "publications/" + publication.getName() + "/ivy.xml");
            }
        });

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

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

            PublishToIvyRepository publishTask = tasks.create(publishTaskName, PublishToIvyRepository.class);
            publishTask.setPublication(publication);
            publishTask.setRepository(repository);
            publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
            publishTask.setDescription(String.format("Publishes Ivy publication '%s' to Ivy repository '%s'.", publicationName, repositoryName));

            tasks.getByName(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME).dependsOn(publishTask);
        }
    }
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:38,
代码来源:IvyPublicationTasksModelRule.java

示例19: apply

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public void apply(final Project project) {
    project.getPlugins().apply(PublishingPlugin.class);

    // Can't move this to rules yet, because it has to happen before user deferred configurable actions
    project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
        public void execute(PublishingExtension extension) {
            // Register factory for MavenPublication
            extension.getPublications().registerFactory(IvyPublication.class, new IvyPublicationFactory(dependencyMetaDataProvider, instantiator, fileResolver));
        }
    });

    modelRules.rule(new IvyPublicationTasksModelRule(project));
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:14,
代码来源:IvyPublishPlugin.java

示例20: GeneratePomFileTask

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
public GeneratePomFileTask()
{
    super();
    setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);

    final Project project = getProject();
    buildUtil = new BuildUtil(project);

    final TaskInputs inputs = getInputs();
    inputs.property("groupId", project.getGroup());
    inputs.property("artifactId", project.getName());
    inputs.property("version", project.getVersion());
    inputs.property("name", buildUtil.getLongName());
    inputs.property("description", project.getDescription());
    inputs.property("url", buildUtil.getExtraPropertyValue(ExtProp.Website));
    inputs.property("authorName", buildUtil.getExtraPropertyValue(ExtProp.AuthorName));
    inputs.property("orgName", buildUtil.getExtraPropertyValue(ExtProp.OrgName));
    inputs.property("orgUrl", buildUtil.getExtraPropertyValue(ExtProp.OrgUrl));
    inputs.property("github", buildUtil.getExtraPropertyValue(ExtProp.Github));

    getOutputs().file(pomFile);

    doLast(new Closure<Void>(this)
    {
        @Override
        @SuppressWarnings({"ResultOfMethodCallIgnored", "MethodDoesntCallSuperMethod"})
        public Void call()
        {
            pomFile.getParentFile().mkdirs();
            PomXml pomXml = createPom();
            try {
                writePomXml(pomXml);
            }
            catch (JAXBException e) {
                throw new GradleException("error creating pom", e);
            }
            return null;
        }
    });
}
 

开发者ID:checkstyle-addons,
项目名称:checkstyle-addons,
代码行数:41,
代码来源:GeneratePomFileTask.java

示例21: createTasks

点赞 2

import org.gradle.api.publish.plugins.PublishingPlugin; //导入依赖的package包/类
@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) {
                    publishTask.setPublication(publication);
                    publishTask.setRepository(repository);
                    publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
                    publishTask.setDescription(String.format("Publishes Ivy publication '%s' to Ivy repository '%s'.", publicationName, repositoryName));

                    //Because dynamic rules are not yet implemented we have to violate input immutability here as an interim step
                    publishLifecycleTask.dependsOn(publishTask);
                }
            });
        }
    }
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:47,
代码来源:IvyPublishPlugin.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)