<commit_before>import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import groovy.lang.GroovyObject
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
import java.util.Date

plugins {
    `java-library` apply false // is applied in commons; make configurations available in this script
    `maven-publish` apply false
    id("com.jfrog.artifactory") apply false
}

project(":detekt-cli") {
    apply {
        plugin("application")
        plugin("com.github.johnrengelman.shadow")
    }

    tasks.withType<ShadowJar>() {
        mergeServiceFiles()
    }
}

subprojects {

    apply {
        plugin("maven-publish")
        plugin("com.jfrog.artifactory")
    }

    val bintrayUser = findProperty("bintrayUser")?.toString()
        ?: System.getenv("BINTRAY_USER")
    val bintrayKey = findProperty("bintrayKey")?.toString()
        ?: System.getenv("BINTRAY_API_KEY")

    publishing {
        repositories {
            maven {
                name = "bintray"
                url = uri("https://api.bintray.com/maven/arturbosch/code-analysis/detekt/;publish=1;override=1")
                credentials {
                    username = bintrayUser
                    password = bintrayKey
                }
            }
        }
        publications.register<MavenPublication>(DETEKT_PUBLICATION) {
            groupId = project.group as? String
            artifactId = project.name
            version = project.version as? String
            pom {
                description.set("Static code analysis for Kotlin")
                name.set("detekt")
                url.set("https://detekt.github.io/detekt")
                licenses {
                    license {
                        name.set("The Apache Software License, Version 2.0")
                        url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
                        distribution.set("repo")
                    }
                }
                developers {
                    developer {
                        id.set("<NAME>")
                        name.set("<NAME>")
                        email.set("<EMAIL>.de")
                    }
                }
                scm {
                    url.set("https://github.com/detekt/detekt")
                }
            }
        }
    }

    configure<ArtifactoryPluginConvention> {
        setContextUrl("https://oss.jfrog.org/artifactory")
        publish(delegateClosureOf<PublisherConfig> {
            repository(delegateClosureOf<GroovyObject> {
                setProperty("repoKey", "oss-snapshot-local")
                setProperty("username", bintrayUser)
                setProperty("password", bintrayKey)
                setProperty("maven", true)
            })
            defaults(delegateClosureOf<GroovyObject> {
                invokeMethod("publications", DETEKT_PUBLICATION)
                setProperty("publishArtifacts", true)
                setProperty("publishPom", true)
            })
        })
    }
}

configure(subprojects.filter { it.name != "detekt-bom" }) {
    val sourcesJar by tasks.registering(Jar::class) {
        dependsOn(tasks.classes)
        archiveClassifier.set("sources")
        from(sourceSets.main.get().allSource)
    }

    val javadocJar by tasks.registering(Jar::class) {
        from(tasks.javadoc)
        archiveClassifier.set("javadoc")
    }

    artifacts {
        archives(sourcesJar)
        archives(javadocJar)
    }

    publishing {
        publications.named<MavenPublication>(DETEKT_PUBLICATION) {
            from(components["java"])
            artifact(sourcesJar.get())
            artifact(javadocJar.get())
            if (project.name == "detekt-cli") {
                artifact(tasks.getByName("shadowJar"))
            }
        }
    }<commit_msg>Setup local PGP signing of published artifacts (#2893)<commit_after>import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import groovy.lang.GroovyObject
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
import java.util.Date

plugins {
    `java-library` apply false // is applied in commons; make configurations available in this script
    `maven-publish` apply false
    `signing` apply false
    id("com.jfrog.artifactory") apply false
}

project(":detekt-cli") {
    apply {
        plugin("application")
        plugin("com.github.johnrengelman.shadow")
    }

    tasks.withType<ShadowJar>() {
        mergeServiceFiles()
    }
}

subprojects {

    apply {
        plugin("maven-publish")
        plugin("signing")
        plugin("com.jfrog.artifactory")
    }

    val bintrayUser = findProperty("bintrayUser")?.toString()
        ?: System.getenv("BINTRAY_USER")
    val bintrayKey = findProperty("bintrayKey")?.toString()
        ?: System.getenv("BINTRAY_API_KEY")

    publishing {
        repositories {
            maven {
                name = "bintray"
                url = uri("https://api.bintray.com/maven/arturbosch/code-analysis/detekt/;publish=1;override=1")
                credentials {
                    username = bintrayUser
                    password = <PASSWORD>
                }
            }
        }
        publications.register<MavenPublication>(DETEKT_PUBLICATION) {
            groupId = project.group as? String
            artifactId = project.name
            version = project.version as? String
            pom {
                description.set("Static code analysis for Kotlin")
                name.set("detekt")
                url.set("https://detekt.github.io/detekt")
                licenses {
                    license {
                        name.set("The Apache Software License, Version 2.0")
                        url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
                        distribution.set("repo")
                    }
                }
                developers {
                    developer {
                        id.set("<NAME>")
                        name.set("<NAME>")
                        email.set("<EMAIL>")
                    }
                }
                scm {
                    url.set("https://github.com/detekt/detekt")
                }
            }
        }
    }

    configure<ArtifactoryPluginConvention> {
        setContextUrl("https://oss.jfrog.org/artifactory")
        publish(delegateClosureOf<PublisherConfig> {
            repository(delegateClosureOf<GroovyObject> {
                setProperty("repoKey", "oss-snapshot-local")
                setProperty("username", bintrayUser)
                setProperty("password", bintrayKey)
                setProperty("maven", true)
            })
            defaults(delegateClosureOf<GroovyObject> {
                invokeMethod("publications", DETEKT_PUBLICATION)
                setProperty("publishArtifacts", true)
                setProperty("publishPom", true)
            })
        })
    }

    val signingKey = findProperty("signingKey")?.toString()
        ?: System.getenv("SIGNING_KEY")
    val signingPwd = findProperty("signingPwd")?.toString()
        ?: System.getenv("SIGNING_PWD")
    if (signingKey != null && signingPwd != null) {
        signing {
            useInMemoryPgpKeys(signingKey, signingPwd)
            sign(publishing.publications[DETEKT_PUBLICATION])
        }
    } else {
        logger.info("Signing Disabled as the PGP key was not found")
    }
}

configure(subprojects.filter { it.name != "detekt-bom" }) {
    val sourcesJar by tasks.registering(Jar::class) {
        dependsOn(tasks.classes)
        archiveClassifier.set("sources")
        from(sourceSets.main.get().allSource)
    }

    val javadocJar by tasks.registering(Jar::class) {
        from(tasks.javadoc)
        archiveClassifier.set("javadoc")
    }

    artifacts {
        archives(sourcesJar)
        archives(javadocJar)
    }

    publishing {
        publications.named<MavenPublication>(DETEKT_PUBLICATION) {
            from(components["java"])
            artifact(sourcesJar.get())
            artifact(javadocJar.get())
            if (project.name == "detekt-cli") {
                artifact(tasks.getByName("shadowJar"))
            }
        }
    }
{'fraction_non_alphanumeric': 0.11112443059218413, 'fraction_numerical': 0.0019180052745145048, 'mean_word_length': 1.779147235176549, 'pattern_counts': {'":': 2, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5619581', 'n_tokens_mistral': 2431, 'n_tokens_neox': 2276, 'n_words': 324}