<commit_before>import java.time.Duration

plugins {
	`maven-publish`
	signing
	id("de.marcphilipp.nexus-publish")
}

val isSnapshot = project.version.toString().contains("SNAPSHOT")
val isContinuousIntegrationEnvironment = System.getenv("CI")?.toBoolean() ?: false
val isJitPackEnvironment = System.getenv("JITPACK")?.toBoolean() ?: false

// ensure project is built successfully before publishing it
val build = tasks[LifecycleBasePlugin.BUILD_TASK_NAME]
tasks[PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME].dependsOn(build)
tasks[MavenPublishPlugin.PUBLISH_LOCAL_LIFECYCLE_TASK_NAME].dependsOn(build)

signing {
	sign(publishing.publications)
	setRequired(!(isSnapshot || isContinuousIntegrationEnvironment || isJitPackEnvironment))
}

nexusPublishing {
	connectTimeout.set(Duration.ofMinutes(2))
	clientTimeout.set(Duration.ofMinutes(2))
	packageGroup.set("org.junit")
	repositories {
		sonatype()
	}
}

publishing {
	publications {
		create<MavenPublication>("maven") {
			pom {
				name.set(provider {
					project.description ?: "${project.group}:${project.name}"
				})
				url.set("https://junit.org/junit5/")
				scm {
					connection.set("scm:git:git://github.com/junit-team/junit5.git")
					developerConnection.set("scm:git:git://github.com/junit-team/junit5.git")
					url.set("https://github.com/junit-team/junit5")
				}
				licenses {
					license {
						val license: License by rootProject.extra<commit_msg>Disable signing snapshots due to Gradle Module Metadata limitation<commit_after>import java.time.Duration

plugins {
	`maven-publish`
	signing
	id("de.marcphilipp.nexus-publish")
}

val isSnapshot = project.version.toString().contains("SNAPSHOT")
val isContinuousIntegrationEnvironment = System.getenv("CI")?.toBoolean() ?: false
val isJitPackEnvironment = System.getenv("JITPACK")?.toBoolean() ?: false

// ensure project is built successfully before publishing it
val build = tasks[LifecycleBasePlugin.BUILD_TASK_NAME]
tasks[PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME].dependsOn(build)
tasks[MavenPublishPlugin.PUBLISH_LOCAL_LIFECYCLE_TASK_NAME].dependsOn(build)

signing {
	sign(publishing.publications)
	isRequired = !(isSnapshot || isContinuousIntegrationEnvironment || isJitPackEnvironment)
}

tasks.withType<Sign>().configureEach {
	onlyIf {
		!isSnapshot // Gradle Module Metadata currently does not support signing snapshots
	}
}

nexusPublishing {
	connectTimeout.set(Duration.ofMinutes(2))
	clientTimeout.set(Duration.ofMinutes(2))
	packageGroup.set("org.junit")
	repositories {
		sonatype()
	}
}

publishing {
	publications {
		create<MavenPublication>("maven") {
			pom {
				name.set(provider {
					project.description ?: "${project.group}:${project.name}"
				})
				url.set("https://junit.org/junit5/")
				scm {
					connection.set("scm:git:git://github.com/junit-team/junit5.git")
					developerConnection.set("scm:git:git://github.com/junit-team/junit5.git")
					url.set("https://github.com/junit-team/junit5")
				}
				licenses {
					license {
						val license: License by rootProject.extra
{'fraction_non_alphanumeric': 0.13219335744820782, 'fraction_numerical': 0.003946070371588293, 'mean_word_length': 5.1955193482688395, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, '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': '4737664', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1001, 'n_words': 140}