All Downloads are FREE. Search and download functionalities are using the official Maven repository.

name.remal.gradleplugins.toolkit.buildlogic.publish-gradle-plugin.gradle Maven / Gradle / Ivy

There is a newer version: 0.69.7
Show newest version
allprojects {
    pluginManager.withPlugin('java-gradle-plugin') {
        if (project.findProperty('javaGradlePluginWithoutPublish')) {
            gradlePlugin.automatedPublishing = false
            return
        }


        apply plugin: 'com.gradle.plugin-publish'

        pluginBundle.with {
            it.website = property('repository-html-url')
            it.vcsUrl = property('repository-html-url')
            it.tags = property('repository-topics').toString().split(/,/)
                .collect { it.trim().toLowerCase() }
                .findAll { !it.isEmpty() }
                .findAll { it != 'gradle' && it != 'plugin' && it != 'gradle-plugin' }
        }

        pluginManager.withPlugin('maven-publish') {
            afterEvaluate {
                publishing.publications.withType(MavenPublication).findAll({ it.component != null }).forEach { pub ->
                    MavenArtifactSet artifacts = pub.artifacts
                    ['sources', 'javadoc', 'groovydoc'].forEach { classifier ->
                        if (!artifacts.any { it.classifier == classifier }) {
                            Jar jarTask = tasks.withType(Jar).find { it.archiveClassifier.getOrNull() == classifier }
                            if (jarTask != null) {
                                pub.artifact(jarTask)
                            }
                        }
                    }
                }
            }
        }

        pluginManager.withPlugin('name.remal.generate-sources') {
            tasks.matching { it.name == 'publishPluginJar' }.configureEach {
                Set generateTasks = [
                    'generateResources',
                    'generateJava',
                    'generateKotlin',
                    'generateGroovy',
                ].toSet()
                dependsOn(
                    tasks.matching { generateTasks.contains(it.name) }
                )
            }
        }
    }
}


File flagFile = project.file("${rootProject.buildDir}/publish-gradle-plugin.flag")
flagFile.delete()
allprojects {
    pluginManager.withPlugin('com.gradle.plugin-publish') {
        flagFile.parentFile.mkdirs()
        flagFile.text = ''
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy