<commit_before>plugins {
	`java-library-conventions`
}

apply(from = "$rootDir/gradle/testing.gradle.kts")

javaLibrary {
	mainJavaVersion = JavaVersion.VERSION_11
}

dependencies {
	implementation("de.sormuras:bartholdy:${Versions.bartholdy}") {
		because("manage external tool installations")
	}
	implementation("commons-io:commons-io:${Versions.commonsIo}") {
		because("moving/deleting directory trees")
	}

	testImplementation("org.assertj:assertj-core:${Versions.assertJ}") {
		because("more assertions")
	}
	testImplementation("com.tngtech.archunit:archunit-junit5-api:${Versions.archunit}") {
		because("checking the architecture of JUnit 5")
	}
	testImplementation("org.codehaus.groovy:groovy-all:${Versions.groovy}") {
		because("it provides convenience methods to handle process output")
		exclude(group = "org.junit.platform", module = "junit-platform-launcher")
	}
	testImplementation("biz.aQute.bnd:biz.aQute.bndlib:${Versions.bnd}") {
		because("parsing OSGi metadata")
	}
	testRuntimeOnly("com.tngtech.archunit:archunit-junit5-engine:${Versions.archunit}") {
		because("contains the ArchUnit TestEngine implementation")
	}
	testRuntimeOnly("org.slf4j:slf4j-jdk14:${Versions.slf4j}") {
		because("provide appropriate SLF4J binding")
	}
}

tasks.test {
	inputs.dir("projects")

	// Opt-in via system property: '-Dplatform.tooling.support.tests.enabled=true'
	enabled = System.getProperty("platform.tooling.support.tests.enabled")?.toBoolean() ?: false

	// The following if-block is necessary since Gradle will otherwise
	// always publish all mavenizedProjects even if this "test" task
	// is not executed.
	if (enabled) {
		// All maven-aware projects must be installed, i.e. published to the local repository
		val mavenizedProjects: List<Project> by rootProject.extra
		mavenizedProjects
				.map { project -> project.tasks.named(MavenPublishPlugin.PUBLISH_LOCAL_LIFECYCLE_TASK_NAME)}
				.forEach { dependsOn(it) }
		// Pass "java.home.N" system properties from sources like "~/.gradle/gradle.properties".
		// Values will be picked up by: platform.tooling.support.Helper::getJavaHome
		for (N in 8..99) {
			val home = project.properties["java.home.$N"] ?: System.getenv("JDK$N")
			if (home != null) systemProperty("java.home.$N", home)
		}
		// TODO Enabling parallel execution fails due to Gradle's listener not being thread-safe:
		//   Received a completed event for test with unknown id "10.5".
		//   Registered test ids: "[:platform-tooling-support-tests:test, 10.1]"
		// systemProperty("junit.jupiter.execution.parallel.enabled", "true")

		// Pass version constants (declared in Versions.kt) to tests as system properties
		systemProperty("Versions.apiGuardian", Versions.apiGuardian)
		systemProperty("Versions.assertJ", Versions.assertJ)
		systemProperty("Versions.junit4", Versions.junit4)
		systemProperty("Versions.ota4j", Versions.ota4j)
	}

	filter {
		// Include only tests from this module
		includeTestsMatching("platform.tooling.support.*")
	}

	(options as JUnitPlatformOptions).apply {
		includeEngines("archunit")
	}

	maxParallelForks = 1 // Bartholdy.install is not parallel safe, see https://github.com/sormuras/bartholdy/issues/4
}
<commit_msg>Require junit-bom to be published for tooling tests<commit_after>plugins {
	`java-library-conventions`
}

apply(from = "$rootDir/gradle/testing.gradle.kts")

javaLibrary {
	mainJavaVersion = JavaVersion.VERSION_11
}

dependencies {
	implementation("de.sormuras:bartholdy:${Versions.bartholdy}") {
		because("manage external tool installations")
	}
	implementation("commons-io:commons-io:${Versions.commonsIo}") {
		because("moving/deleting directory trees")
	}

	testImplementation("org.assertj:assertj-core:${Versions.assertJ}") {
		because("more assertions")
	}
	testImplementation("com.tngtech.archunit:archunit-junit5-api:${Versions.archunit}") {
		because("checking the architecture of JUnit 5")
	}
	testImplementation("org.codehaus.groovy:groovy-all:${Versions.groovy}") {
		because("it provides convenience methods to handle process output")
		exclude(group = "org.junit.platform", module = "junit-platform-launcher")
	}
	testImplementation("biz.aQute.bnd:biz.aQute.bndlib:${Versions.bnd}") {
		because("parsing OSGi metadata")
	}
	testRuntimeOnly("com.tngtech.archunit:archunit-junit5-engine:${Versions.archunit}") {
		because("contains the ArchUnit TestEngine implementation")
	}
	testRuntimeOnly("org.slf4j:slf4j-jdk14:${Versions.slf4j}") {
		because("provide appropriate SLF4J binding")
	}
}

tasks.test {
	inputs.dir("projects")

	// Opt-in via system property: '-Dplatform.tooling.support.tests.enabled=true'
	enabled = System.getProperty("platform.tooling.support.tests.enabled")?.toBoolean() ?: false

	// The following if-block is necessary since Gradle will otherwise
	// always publish all mavenizedProjects even if this "test" task
	// is not executed.
	if (enabled) {
		// All maven-aware projects must be installed, i.e. published to the local repository
		val mavenizedProjects: List<Project> by rootProject.extra
		(mavenizedProjects + project(":junit-bom"))
				.map { project -> project.tasks.named(MavenPublishPlugin.PUBLISH_LOCAL_LIFECYCLE_TASK_NAME)}
				.forEach { dependsOn(it) }
		// Pass "java.home.N" system properties from sources like "~/.gradle/gradle.properties".
		// Values will be picked up by: platform.tooling.support.Helper::getJavaHome
		for (N in 8..99) {
			val home = project.properties["java.home.$N"] ?: System.getenv("JDK$N")
			if (home != null) systemProperty("java.home.$N", home)
		}
		// TODO Enabling parallel execution fails due to Gradle's listener not being thread-safe:
		//   Received a completed event for test with unknown id "10.5".
		//   Registered test ids: "[:platform-tooling-support-tests:test, 10.1]"
		// systemProperty("junit.jupiter.execution.parallel.enabled", "true")

		// Pass version constants (declared in Versions.kt) to tests as system properties
		systemProperty("Versions.apiGuardian", Versions.apiGuardian)
		systemProperty("Versions.assertJ", Versions.assertJ)
		systemProperty("Versions.junit4", Versions.junit4)
		systemProperty("Versions.ota4j", Versions.ota4j)
	}

	filter {
		// Include only tests from this module
		includeTestsMatching("platform.tooling.support.*")
	}

	(options as JUnitPlatformOptions).apply {
		includeEngines("archunit")
	}

	maxParallelForks = 1 // Bartholdy.install is not parallel safe, see https://github.com/sormuras/bartholdy/issues/4
}

{'fraction_non_alphanumeric': 0.13364341085271317, 'fraction_numerical': 0.00806201550387597, 'mean_word_length': 5.017723880597015, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '6080433', 'n_tokens_mistral': 2217, 'n_tokens_neox': 2062, 'n_words': 424}