Skip to content

Commit

Permalink
Use auto-generated type-safe project accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Apr 13, 2021
1 parent 7dbc414 commit b9601f2
Show file tree
Hide file tree
Showing 27 changed files with 140 additions and 198 deletions.
60 changes: 30 additions & 30 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,35 @@ val buildRevision: String by extra { versioning.info.commit }
val builtByValue by extra { project.findProperty("builtBy") ?: project.property("defaultBuiltBy") }

val platformProjects by extra(listOf(
projects.platform.commons,
projects.platform.console,
projects.platform.`console-standalone`,
projects.platform.engine,
projects.platform.jfr,
projects.platform.launcher,
projects.platform.reporting,
projects.platform.runner,
projects.platform.suite.aggregator,
projects.platform.suite.api,
projects.platform.suite.commons,
projects.platform.suite.engine,
projects.platform.testkit
))
projects.junitPlatformCommons,
projects.junitPlatformConsole,
projects.junitPlatformConsoleStandalone,
projects.junitPlatformEngine,
projects.junitPlatformJfr,
projects.junitPlatformLauncher,
projects.junitPlatformReporting,
projects.junitPlatformRunner,
projects.junitPlatformSuite,
projects.junitPlatformSuiteApi,
projects.junitPlatformSuiteCommons,
projects.junitPlatformSuiteEngine,
projects.junitPlatformTestkit
).map { it.dependencyProject })

val jupiterProjects by extra(listOf(
projects.jupiter.aggregator,
projects.jupiter.api,
projects.jupiter.engine,
projects.jupiter.migrationsupport,
projects.jupiter.params
))
projects.junitJupiter,
projects.junitJupiterApi,
projects.junitJupiterEngine,
projects.junitJupiterMigrationsupport,
projects.junitJupiterParams
).map { it.dependencyProject })

val vintageProjects by extra(listOf(
projects.vintage.engine
projects.junitVintageEngine.dependencyProject
))

val mavenizedProjects by extra(platformProjects + jupiterProjects + vintageProjects)
val modularProjects by extra(mavenizedProjects - listOf(projects.platform.`console-standalone`))
val modularProjects by extra(mavenizedProjects - listOf(projects.junitPlatformConsoleStandalone.dependencyProject))

val license by extra(License(
name = "Eclipse Public License v2.0",
Expand All @@ -76,14 +76,14 @@ val tempRepoDir by extra(file("$buildDir/repo"))

val enableJaCoCo = project.hasProperty("enableJaCoCo")
val jacocoTestProjects = listOf(
projects.jupiter.engine,
projects.jupiter.migrationsupport,
projects.jupiter.params,
projects.platform.runner,
projects.platform.suite.commons,
projects.platform.suite.engine,
projects.vintage.engine,
projects.platform.tests
projects.junitJupiterEngine,
projects.junitJupiterMigrationsupport,
projects.junitJupiterParams,
projects.junitPlatformRunner,
projects.junitPlatformSuiteCommons,
projects.junitPlatformSuiteEngine,
projects.junitVintageEngine,
projects.platformTests
)
val jacocoCoveredProjects = modularProjects
val jacocoClassesDir = file("$buildDir/jacoco/classes")
Expand Down
6 changes: 0 additions & 6 deletions buildSrc/src/main/kotlin/ProjectExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@ import org.gradle.kotlin.dsl.provideDelegate

val Project.javaModuleName: String
get() = "org." + this.name.replace('-', '.')

val Project.projects: Projects
get() {
var versions: Projects? by rootProject.extra
return versions ?: Projects(rootProject).also { versions = it }
}
53 changes: 0 additions & 53 deletions buildSrc/src/main/kotlin/Projects.kt

This file was deleted.

10 changes: 5 additions & 5 deletions buildSrc/src/main/kotlin/testing-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ dependencies {
"testImplementation"(libs.findDependency("assertj").get())
"testImplementation"(libs.findDependency("mockito").get())

if (project != projects.jupiter.engine) {
"testImplementation"(projects.jupiter.aggregator)
if (project != project(":junit-jupiter-engine")) {
"testImplementation"(project(":junit-jupiter"))
}
"testImplementation"(testFixtures(projects.jupiter.api))
"testImplementation"(testFixtures(project(":junit-jupiter-api")))

"testRuntimeOnly"(projects.platform.launcher)
"testRuntimeOnly"(projects.platform.jfr)
"testRuntimeOnly"(project(":junit-platform-engine"))
"testRuntimeOnly"(project(":junit-platform-jfr"))

"testRuntimeOnly"(libs.findBundle("log4j").get())
}
24 changes: 12 additions & 12 deletions documentation/documentation.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ javaLibrary {
val apiReport by configurations.creating

dependencies {
implementation(project(projects.jupiter.api.path)) {
implementation(projects.junitJupiterApi) {
because("Jupiter API is used in src/main/java")
}

// Pull in all "modular projects" to ensure that they are included
// in reports generated by the ApiReportGenerator.
modularProjects.forEach { apiReport(it) }

testImplementation(projects.jupiter.aggregator)
testImplementation(projects.jupiter.migrationsupport)
testImplementation(projects.platform.console)
testImplementation(projects.platform.runner)
testImplementation(projects.platform.suite.aggregator)
testImplementation(projects.platform.testkit)
testImplementation(projects.junitJupiter)
testImplementation(projects.junitJupiterMigrationsupport)
testImplementation(projects.junitPlatformConsole)
testImplementation(projects.junitPlatformRunner)
testImplementation(projects.junitPlatformSuite)
testImplementation(projects.junitPlatformTestkit)
testImplementation(kotlin("stdlib"))

testImplementation(projects.vintage.engine)
testImplementation(projects.junitVintageEngine)
testRuntimeOnly(libs.bundles.log4j)

testImplementation(libs.classgraph) {
Expand Down Expand Up @@ -413,14 +413,14 @@ fun JavaExec.redirectOutput(outputFile: File) {

eclipse {
classpath {
plusConfigurations.add(projects.platform.console.configurations["shadowed"])
plusConfigurations.add(projects.jupiter.params.configurations["shadowed"])
plusConfigurations.add(projects.junitPlatformConsole.dependencyProject.configurations["shadowed"])
plusConfigurations.add(projects.junitJupiterParams.dependencyProject.configurations["shadowed"])
}
}

idea {
module {
scopes["PROVIDED"]!!["plus"]!!.add(projects.platform.console.configurations["shadowed"])
scopes["PROVIDED"]!!["plus"]!!.add(projects.jupiter.params.configurations["shadowed"])
scopes["PROVIDED"]!!["plus"]!!.add(projects.junitPlatformConsole.dependencyProject.configurations["shadowed"])
scopes["PROVIDED"]!!["plus"]!!.add(projects.junitJupiterParams.dependencyProject.configurations["shadowed"])
}
}
4 changes: 2 additions & 2 deletions junit-jupiter-api/junit-jupiter-api.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
description = "JUnit Jupiter API"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
api(libs.opentest4j)
api(projects.platform.commons)
api(projects.junitPlatformCommons)

compileOnly(kotlin("stdlib"))
}
14 changes: 7 additions & 7 deletions junit-jupiter-engine/junit-jupiter-engine.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ plugins {
description = "JUnit Jupiter Engine"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
api(projects.platform.engine)
api(projects.jupiter.api)
api(projects.junitPlatformEngine)
api(projects.junitJupiterApi)

testImplementation(projects.platform.launcher)
testImplementation(projects.platform.runner)
testImplementation(projects.platform.testkit)
testImplementation(testFixtures(projects.platform.commons))
testImplementation(projects.junitPlatformLauncher)
testImplementation(projects.junitPlatformRunner)
testImplementation(projects.junitPlatformTestkit)
testImplementation(testFixtures(projects.junitPlatformCommons))
testImplementation(kotlin("stdlib"))
testImplementation(libs.kotlinx.coroutines)
testImplementation(libs.groovy3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ plugins {
description = "JUnit Jupiter Migration Support"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.junit4)
api(libs.apiguardian)
api(projects.jupiter.api)
api(projects.junitJupiterApi)

testImplementation(projects.jupiter.engine)
testImplementation(projects.platform.launcher)
testImplementation(projects.platform.runner)
testImplementation(projects.platform.testkit)
testImplementation(projects.junitJupiterEngine)
testImplementation(projects.junitPlatformLauncher)
testImplementation(projects.junitPlatformRunner)
testImplementation(projects.junitPlatformTestkit)
}

tasks.jar {
Expand Down
12 changes: 6 additions & 6 deletions junit-jupiter-params/junit-jupiter-params.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ plugins {
description = "JUnit Jupiter Params"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
api(projects.jupiter.api)
api(projects.junitJupiterApi)

shadowed(libs.univocity.parsers)

testImplementation(projects.platform.testkit)
testImplementation(projects.jupiter.engine)
testImplementation(projects.platform.launcher)
testImplementation(projects.platform.runner)
testImplementation(projects.junitPlatformTestkit)
testImplementation(projects.junitJupiterEngine)
testImplementation(projects.junitPlatformLauncher)
testImplementation(projects.junitPlatformRunner)

compileOnly(kotlin("stdlib"))
testImplementation(kotlin("stdlib"))
Expand Down
8 changes: 4 additions & 4 deletions junit-jupiter/junit-jupiter.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins {
description = "JUnit Jupiter (Aggregator)"

dependencies {
api(platform(projects.bom))
api(projects.jupiter.api)
api(projects.jupiter.params)
api(platform(projects.junitBom))
api(projects.junitJupiterApi)
api(projects.junitJupiterParams)

runtimeOnly(projects.jupiter.engine)
runtimeOnly(projects.junitJupiterEngine)
}
2 changes: 1 addition & 1 deletion junit-platform-commons/junit-platform-commons.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
description = "JUnit Platform Commons"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ plugins {
description = "JUnit Platform Console Standalone"

dependencies {
shadowed(projects.platform.reporting)
shadowed(projects.platform.console)
shadowed(projects.jupiter.engine)
shadowed(projects.jupiter.params)
shadowed(projects.vintage.engine)
shadowed(projects.junitPlatformReporting)
shadowed(projects.junitPlatformConsole)
shadowed(projects.junitJupiterEngine)
shadowed(projects.junitJupiterParams)
shadowed(projects.junitVintageEngine)
}

val jupiterVersion = rootProject.version
Expand All @@ -28,11 +28,11 @@ tasks {
// https://github.com/junit-team/junit5/issues/761
// prevent duplicates, add 3rd-party licenses explicitly
exclude("META-INF/LICENSE*.md")
from(project.projects.platform.console.projectDir) {
from(project.projects.junitPlatformConsole.dependencyProject.projectDir) {
include("LICENSE-picocli.md")
into("META-INF")
}
from(project.projects.jupiter.params.projectDir) {
from(project.projects.junitJupiterParams.dependencyProject.projectDir) {
include("LICENSE-univocity-parsers.md")
into("META-INF")
}
Expand Down
4 changes: 2 additions & 2 deletions junit-platform-console/junit-platform-console.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ plugins {
description = "JUnit Platform Console"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
api(projects.platform.reporting)
api(projects.junitPlatformReporting)

shadowed(libs.picocli)
}
Expand Down
4 changes: 2 additions & 2 deletions junit-platform-engine/junit-platform-engine.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
description = "JUnit Platform Engine API"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
api(libs.opentest4j)
api(projects.platform.commons)
api(projects.junitPlatformCommons)

testImplementation(libs.assertj)
}
4 changes: 2 additions & 2 deletions junit-platform-jfr/junit-platform-jfr.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins {
description = "JUnit Platform Flight Recorder Support"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
api(projects.platform.launcher)
api(projects.junitPlatformLauncher)
}

javaLibrary {
Expand Down
4 changes: 2 additions & 2 deletions junit-platform-launcher/junit-platform-launcher.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
description = "JUnit Platform Launcher"

dependencies {
api(platform(projects.bom))
api(platform(projects.junitBom))
api(libs.apiguardian)
api(projects.platform.engine)
api(projects.junitPlatformEngine)
}
Loading

0 comments on commit b9601f2

Please sign in to comment.