@Override public void apply(Project project) { this.project = project; project.getPlugins().apply(getPluginClass()); project.getPlugins().apply(MavenPublishPlugin.class); publication = project.getExtensions().getByType(PublishingExtension.class) .getPublications() .create(getPublicationName(), MavenPublication.class); publication.from(getSoftwareComponent()); project.getPlugins().withType(SourcesJarPlugin.class, sourcesJarPlugin -> publication.artifact(sourcesJarPlugin.getJarTask(), a -> a.setClassifier(sourcesJarPlugin.getClassifier())) ); project.getPlugins().withType(JavadocJarPlugin.class, javadocJarPlugin -> publication.artifact(javadocJarPlugin.getJarTask(), a -> a.setClassifier(javadocJarPlugin.getClassifier())) ); }
/** * 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); }); }
/** * @see me.seeber.gradle.plugin.AbstractProjectConfigPlugin#initialize() */ @Override public void initialize() { getProject().getPlugins().apply(ProjectConfigPlugin.class); getProject().getPlugins().apply(MavenPublishPlugin.class); getProject().getPluginManager().withPlugin("java", p -> { getProject().getPluginManager().apply(MavenJavaRules.class); }); }
@Override public void apply(Project project) { project.getPlugins().apply(StdModulePlugin.class); final StdPluginExtension extension = project.getExtensions().create("stdplugin", StdPluginExtension.class, project); // Gradle project.getPlugins().apply(JavaGradlePluginPlugin.class); project.getRepositories().add(project.getRepositories().jcenter()); // project.getDependencies().add(JavaPlugin.COMPILE_CONFIGURATION_NAME, project.getDependencies().gradleApi()); // project.getDependencies().add(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME, project.getDependencies().gradleTestKit()); // Maven project.getPlugins().apply(MavenPublishPlugin.class); // Bintray /* project.getPlugins().apply(BintrayPlugin.class); BintrayExtension bintray = project.getExtensions().getByType(BintrayExtension.class); String bintrayUsername = StdProjectPlugin.getExtraPropertyOrNull(project.getRootProject(), "bintrayUsername"); if (bintrayUsername != null) bintray.setUser(bintrayUsername); String bintrayApiKey = StdProjectPlugin.getExtraPropertyOrNull(project.getRootProject(), "bintrayApiKey"); if (bintrayApiKey != null) bintray.setKey(bintrayApiKey); bintray.getPkg().setRepo("gradle-plugins"); */ // Plugin final File pluginDescriptorDir = new File(project.getBuildDir(), "generated-resources/gradle-plugin"); Task generatePluginDescriptors = project.getTasks().create("generatePluginDescriptors", GeneratePluginDescriptors.class, new Action<GeneratePluginDescriptors>() { @Override public void execute(GeneratePluginDescriptors t) { // t.setGroup("Build"); t.setDescription("Generates gradle plugin descriptors."); t.setDestinationDir(pluginDescriptorDir); t.conventionMapping("pluginImplementations", new Callable<Map<String, String>>() { @Override public Map<String, String> call() throws Exception { return extension.implementations; } }); } }); SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets(); sourceSets.getByName("main").getOutput().dir(Collections.<String, Object>singletonMap("builtBy", generatePluginDescriptors), pluginDescriptorDir); }