Skip to content

Commit 98f1f29

Browse files
committed
chore: refactored buildscript
1 parent d2d23fc commit 98f1f29

File tree

5 files changed

+119
-308
lines changed

5 files changed

+119
-308
lines changed

build.gradle.kts

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
version = "0.6.2"
2+
group = "com.auritylab.graphql-kotlin-toolkit"
3+
14
plugins {
25
id("org.jetbrains.kotlin.jvm") version "1.4.10" apply false
36
id("org.jetbrains.kotlin.plugin.spring") version "1.4.10" apply false
@@ -12,13 +15,14 @@ allprojects {
1215
}
1316

1417
subprojects {
15-
group = "com.auritylab.graphql-kotlin-toolkit"
16-
version = "0.6.2"
18+
group = parent!!.group
19+
version = parent!!.version
1720

1821
apply(plugin = "org.jlleitschuh.gradle.ktlint")
1922
apply(plugin = "org.jetbrains.dokka")
2023
apply(plugin = "org.jetbrains.kotlin.jvm")
2124
apply(plugin = "maven-publish")
25+
apply(plugin = "signing")
2226

2327
dependencies {
2428
"implementation"(platform("org.jetbrains.kotlin:kotlin-bom"))
@@ -45,6 +49,95 @@ subprojects {
4549
jvmTarget = "1.8"
4650
}
4751
}
52+
53+
configure<SigningExtension> {
54+
the<PublishingExtension>().publications
55+
.findByName("maven")
56+
?.let { sign(it) }
57+
}
58+
59+
tasks.create("sourceJar", Jar::class) {
60+
archiveClassifier.set("sources")
61+
doLast {
62+
from(the<SourceSetContainer>().getByName("main").allSource)
63+
}
64+
}
65+
66+
tasks.create("javadocJar", Jar::class) {
67+
group = JavaBasePlugin.DOCUMENTATION_GROUP
68+
description = "Assembles Kotlin docs with Dokka"
69+
archiveClassifier.set("javadoc")
70+
from(tasks.getByName("dokka"))
71+
}
72+
73+
afterEvaluate {
74+
// Check if publication shall be configured for this project.
75+
val publicationEnabled = ext.properties["publication.enabled"]?.let { it as? Boolean } ?: false
76+
val publicationArtifactId = ext.properties["publication.artifactId"]?.let { it as? String } ?: ""
77+
val publicationName = ext.properties["publication.name"]?.let { it as? String } ?: ""
78+
val publicationDescription = ext.properties["publication.description"]?.let { it as? String } ?: ""
79+
80+
if (publicationEnabled) {
81+
configure<PublishingExtension> {
82+
publications {
83+
create<MavenPublication>("maven") {
84+
artifactId = publicationArtifactId
85+
from(components.getByName("java"))
86+
artifact(tasks.getByName("sourceJar"))
87+
artifact(tasks.getByName("javadocJar"))
88+
89+
repositories {
90+
maven {
91+
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
92+
credentials {
93+
username = if (project.hasProperty("ossrhUsername"))
94+
project.property("ossrhUsername") as String else null
95+
password = if (project.hasProperty("ossrhPassword"))
96+
project.property("ossrhPassword") as String else null
97+
}
98+
}
99+
}
100+
101+
pom {
102+
name.set(publicationName)
103+
description.set(publicationDescription)
104+
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
105+
106+
organization {
107+
name.set("AurityLab UG (haftungsbeschraenkt)")
108+
url.set("https://github.com/AurityLab")
109+
}
110+
111+
issueManagement {
112+
system.set("GitHub")
113+
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/issues")
114+
}
115+
116+
licenses {
117+
license {
118+
name.set("Apache License 2.0")
119+
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/blob/master/LICENSE")
120+
distribution.set("repo")
121+
}
122+
}
123+
124+
scm {
125+
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
126+
connection.set("scm:git:git://github.com/AurityLab/graphql-kotlin-toolkit.git")
127+
developerConnection.set("scm:git:ssh://git@github.com:AurityLab/graphql-kotlin-toolkit.git")
128+
}
129+
130+
developers {
131+
developer {
132+
id.set("WipeAir")
133+
}
134+
}
135+
}
136+
}
137+
}
138+
}
139+
}
140+
}
48141
}
49142

50143
tasks.create("allPublish") {
Lines changed: 5 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
plugins {
2-
id("signing")
1+
ext {
2+
this["publication.enabled"] = true
3+
this["publication.artifactId"] = "codegen"
4+
this["publication.name"] = "GraphQL Kotlin Toolkit: Codegen"
5+
this["publication.description"] = "GraphQL Code generator for Kotlin"
36
}
47

58
dependencies {
@@ -11,78 +14,3 @@ dependencies {
1114
testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.3.0")
1215
testImplementation("org.jetbrains.kotlin:kotlin-reflect")
1316
}
14-
15-
tasks.create("sourceJar", Jar::class) {
16-
archiveClassifier.set("sources")
17-
from(sourceSets.main.get().allSource)
18-
}
19-
20-
tasks.create("javadocJar", Jar::class) {
21-
group = JavaBasePlugin.DOCUMENTATION_GROUP
22-
description = "Assembles Kotlin docs with Dokka"
23-
archiveClassifier.set("javadoc")
24-
from(tasks.dokka)
25-
}
26-
27-
publishing {
28-
publications {
29-
create<MavenPublication>("maven") {
30-
artifactId = "codegen"
31-
from(components["java"])
32-
artifact(tasks.getByName("sourceJar"))
33-
artifact(tasks.getByName("javadocJar"))
34-
35-
repositories {
36-
maven {
37-
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
38-
credentials {
39-
username = if (project.hasProperty("ossrhUsername"))
40-
project.property("ossrhUsername") as String else null
41-
password = if (project.hasProperty("ossrhPassword"))
42-
project.property("ossrhPassword") as String else null
43-
}
44-
}
45-
}
46-
47-
pom {
48-
name.set("GraphQL Kotlin Toolkit: Codegen")
49-
description.set("GraphQL Code generator for Kotlin")
50-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
51-
52-
organization {
53-
name.set("AurityLab UG (haftungsbeschraenkt)")
54-
url.set("https://github.com/AurityLab")
55-
}
56-
57-
issueManagement {
58-
system.set("GitHub")
59-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/issues")
60-
}
61-
62-
licenses {
63-
license {
64-
name.set("Apache License 2.0")
65-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/blob/master/LICENSE")
66-
distribution.set("repo")
67-
}
68-
}
69-
70-
scm {
71-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
72-
connection.set("scm:git:git://github.com/AurityLab/graphql-kotlin-toolkit.git")
73-
developerConnection.set("scm:git:ssh://git@github.com:AurityLab/graphql-kotlin-toolkit.git")
74-
}
75-
76-
developers {
77-
developer {
78-
id.set("WipeAir")
79-
}
80-
}
81-
}
82-
}
83-
}
84-
}
85-
86-
signing {
87-
sign(publishing.publications.getByName("maven"))
88-
}
Lines changed: 5 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,10 @@
1-
plugins {
2-
id("signing")
1+
ext {
2+
this["publication.enabled"] = true
3+
this["publication.artifactId"] = "common"
4+
this["publication.name"] = "GraphQL Kotlin Toolkit: Common"
5+
this["publication.description"] = "GraphQL Code generator for Kotlin"
36
}
47

58
dependencies {
69
implementation("com.graphql-java:graphql-java:15.0")
710
}
8-
9-
tasks.create("sourceJar", Jar::class) {
10-
archiveClassifier.set("sources")
11-
from(sourceSets.main.get().allSource)
12-
}
13-
14-
tasks.create("javadocJar", Jar::class) {
15-
group = JavaBasePlugin.DOCUMENTATION_GROUP
16-
description = "Assembles Kotlin docs with Dokka"
17-
archiveClassifier.set("javadoc")
18-
from(tasks.dokka)
19-
}
20-
21-
publishing {
22-
publications {
23-
create<MavenPublication>("maven") {
24-
artifactId = "common"
25-
from(components["java"])
26-
artifact(tasks.getByName("sourceJar"))
27-
artifact(tasks.getByName("javadocJar"))
28-
29-
repositories {
30-
maven {
31-
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
32-
credentials {
33-
username = if (project.hasProperty("ossrhUsername"))
34-
project.property("ossrhUsername") as String else null
35-
password = if (project.hasProperty("ossrhPassword"))
36-
project.property("ossrhPassword") as String else null
37-
}
38-
}
39-
}
40-
41-
pom {
42-
name.set("GraphQL Kotlin Toolkit: Common")
43-
description.set("GraphQL Code generator for Kotlin")
44-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
45-
46-
organization {
47-
name.set("AurityLab UG (haftungsbeschraenkt)")
48-
url.set("https://github.com/AurityLab")
49-
}
50-
51-
issueManagement {
52-
system.set("GitHub")
53-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/issues")
54-
}
55-
56-
licenses {
57-
license {
58-
name.set("Apache License 2.0")
59-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/blob/master/LICENSE")
60-
distribution.set("repo")
61-
}
62-
}
63-
64-
scm {
65-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
66-
connection.set("scm:git:git://github.com/AurityLab/graphql-kotlin-toolkit.git")
67-
developerConnection.set("scm:git:ssh://git@github.com:AurityLab/graphql-kotlin-toolkit.git")
68-
}
69-
70-
developers {
71-
developer {
72-
id.set("WipeAir")
73-
}
74-
}
75-
}
76-
}
77-
}
78-
}
79-
80-
signing {
81-
sign(publishing.publications.getByName("maven"))
82-
}
Lines changed: 7 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
plugins {
22
id("org.jetbrains.kotlin.kapt")
3-
id("signing")
3+
}
4+
5+
ext {
6+
this["publication.enabled"] = true
7+
this["publication.artifactId"] = "jpa"
8+
this["publication.name"] = "GraphQL Kotlin Toolkit: JPA"
9+
this["publication.description"] = "GraphQL Tools for JPA"
410
}
511

612
dependencies {
@@ -17,78 +23,3 @@ dependencies {
1723
testImplementation("me.lazmaid.kraph:kraph:0.6.1")
1824
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
1925
}
20-
21-
tasks.create("sourceJar", Jar::class) {
22-
archiveClassifier.set("sources")
23-
from(sourceSets.main.get().allSource)
24-
}
25-
26-
tasks.create("javadocJar", Jar::class) {
27-
group = JavaBasePlugin.DOCUMENTATION_GROUP
28-
description = "Assembles Kotlin docs with Dokka"
29-
archiveClassifier.set("javadoc")
30-
from(tasks.dokka)
31-
}
32-
33-
publishing {
34-
publications {
35-
create<MavenPublication>("maven") {
36-
artifactId = "jpa"
37-
from(components["java"])
38-
artifact(tasks.getByName("sourceJar"))
39-
artifact(tasks.getByName("javadocJar"))
40-
41-
repositories {
42-
maven {
43-
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
44-
credentials {
45-
username = if (project.hasProperty("ossrhUsername"))
46-
project.property("ossrhUsername") as String else null
47-
password = if (project.hasProperty("ossrhPassword"))
48-
project.property("ossrhPassword") as String else null
49-
}
50-
}
51-
}
52-
53-
pom {
54-
name.set("GraphQL Kotlin Toolkit: JPA")
55-
description.set("GraphQL Tools for JPA")
56-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
57-
58-
organization {
59-
name.set("AurityLab UG (haftungsbeschraenkt)")
60-
url.set("https://github.com/AurityLab")
61-
}
62-
63-
issueManagement {
64-
system.set("GitHub")
65-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/issues")
66-
}
67-
68-
licenses {
69-
license {
70-
name.set("Apache License 2.0")
71-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit/blob/master/LICENSE")
72-
distribution.set("repo")
73-
}
74-
}
75-
76-
scm {
77-
url.set("https://github.com/AurityLab/graphql-kotlin-toolkit")
78-
connection.set("scm:git:git://github.com/AurityLab/graphql-kotlin-toolkit.git")
79-
developerConnection.set("scm:git:ssh://git@github.com:AurityLab/graphql-kotlin-toolkit.git")
80-
}
81-
82-
developers {
83-
developer {
84-
id.set("WipeAir")
85-
}
86-
}
87-
}
88-
}
89-
}
90-
}
91-
92-
signing {
93-
sign(publishing.publications.getByName("maven"))
94-
}

0 commit comments

Comments
 (0)