Debian Codegraph @

gradle/plugins/common/src/main/kotlin/junitbuild.publishing-conventions.gradle.kts

raw
1 plugins {
2 `maven-publish`
3 signing
4 id("junitbuild.base-conventions")
5 id("junitbuild.build-parameters")
6 }
7
8 val isSnapshot = project.version.toString().contains("SNAPSHOT")
9
10 val jupiterProjects: List<Project> by rootProject
11 val platformProjects: List<Project> by rootProject
12 val vintageProjects: List<Project> by rootProject
13
14 when (project) {
15 in jupiterProjects -> {
16 group = property("jupiterGroup")!!
17 }
18 in platformProjects -> {
19 group = property("platformGroup")!!
20 version = property("platformVersion")!!
21 }
22 in vintageProjects -> {
23 group = property("vintageGroup")!!
24 version = property("vintageVersion")!!
25 }
26 }
27
28 // ensure project is built successfully before publishing it
29 tasks.withType<PublishToMavenRepository>().configureEach {
30 dependsOn(provider {
31 val tempRepoName: String by rootProject
32 if (repository.name != tempRepoName) {
33 listOf(tasks.build)
34 } else {
35 emptyList()
36 }
37 })
38 }
39 tasks.withType<PublishToMavenLocal>().configureEach {
40 dependsOn(tasks.build)
41 }
42
43 val signArtifacts = buildParameters.publishing.signArtifacts.getOrElse(!(isSnapshot || buildParameters.ci))
44
45 signing {
46 useGpgCmd()
47 sign(publishing.publications)
48 isRequired = signArtifacts
49 }
50
51 tasks.withType<Sign>().configureEach {
52 enabled = signArtifacts
53 }
54
55 publishing {
56 publications {
57 create<MavenPublication>("maven") {
58 pom {
59 name.set(provider {
60 project.description ?: "${project.group}:${project.name}"
61 })
62 url = "https://junit.org/junit5/"
63 scm {
64 connection = "scm:git:git://github.com/junit-team/junit5.git"
65 developerConnection = "scm:git:git://github.com/junit-team/junit5.git"
66 url = "https://github.com/junit-team/junit5"
67 }
68 licenses {
69 license {
70 val license: License by rootProject.extra
71 name = license.name
72 url = license.url.toString()
73 }
74 }
75 developers {
76 developer {
77 id = "bechte"
78 name = "Stefan Bechtold"
79 email = "[email protected]"
80 }
81 developer {
82 id = "jlink"
83 name = "Johannes Link"
84 email = "[email protected]"
85 }
86 developer {
87 id = "marcphilipp"
88 name = "Marc Philipp"
89 email = "[email protected]"
90 }
91 developer {
92 id = "mmerdes"
93 name = "Matthias Merdes"
94 email = "[email protected]"
95 }
96 developer {
97 id = "sbrannen"
98 name = "Sam Brannen"
99 email = "[email protected]"
100 }
101 developer {
102 id = "sormuras"
103 name = "Christian Stein"
104 email = "[email protected]"
105 }
106 developer {
107 id = "juliette-derancourt"
108 name = "Juliette de Rancourt"
109 email = "[email protected]"
110 }
111 }
112 }
113 }
114 }
115 }