Skip to content

Commit 788f3b9

Browse files
committed
remove afterEvaluate while publishing
1 parent 028cd65 commit 788f3b9

File tree

2 files changed

+53
-56
lines changed

2 files changed

+53
-56
lines changed

build.gradle.kts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ plugins {
1515
java
1616
}
1717
group = "com.trendyol"
18-
19-
beforeEvaluate {
20-
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
21-
val details = versionDetails()
22-
version = details.lastTag
23-
}
18+
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
19+
val details = versionDetails()
20+
version = details.lastTag
2421

2522
allprojects {
2623
extra.set("dokka.outputDirectory", rootDir.resolve("docs"))

buildSrc/src/main/kotlin/stove-publishing.gradle.kts

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66
fun getProperty(
77
projectKey: String,
8-
environmentKey: String,
8+
environmentKey: String
99
): String? {
1010
return if (project.hasProperty(projectKey)) {
1111
project.property(projectKey) as? String?
@@ -14,64 +14,64 @@ fun getProperty(
1414
}
1515
}
1616

17-
afterEvaluate {
18-
publishing {
19-
publications {
20-
create<MavenPublication>("publish-${project.name}") {
21-
groupId = rootProject.group.toString()
22-
version = rootProject.version.toString()
23-
artifactId = project.name
24-
from(components["java"])
25-
pom {
26-
name.set(project.name)
27-
description.set(project.properties["projectDescription"].toString())
28-
url.set(project.properties["projectUrl"].toString())
29-
packaging = "jar"
30-
licenses {
31-
license {
32-
name.set(project.properties["licence"].toString())
33-
url.set(project.properties["licenceUrl"].toString())
34-
}
35-
}
36-
developers {
37-
developer {
38-
id.set("osoykan")
39-
name.set("Oguzhan Soykan")
40-
email.set("[email protected]")
41-
}
17+
publishing {
18+
publications {
19+
create<MavenPublication>("publish-${project.name}") {
20+
groupId = rootProject.group.toString()
21+
version = rootProject.version.toString()
22+
artifactId = project.name
23+
from(components["java"])
24+
pom {
25+
name.set(project.name)
26+
description.set(project.properties["projectDescription"].toString())
27+
url.set(project.properties["projectUrl"].toString())
28+
packaging = "jar"
29+
licenses {
30+
license {
31+
name.set(project.properties["licence"].toString())
32+
url.set(project.properties["licenceUrl"].toString())
4233
}
43-
scm {
44-
connection.set("scm:[email protected]:Trendyol/stove4k.git")
45-
developerConnection.set("scm:git:ssh://github.com:Trendyol/stove4k.git")
46-
url.set(project.properties["projectUrl"].toString())
34+
}
35+
developers {
36+
developer {
37+
id.set("osoykan")
38+
name.set("Oguzhan Soykan")
39+
email.set("[email protected]")
4740
}
4841
}
42+
scm {
43+
connection.set("scm:[email protected]:Trendyol/stove4k.git")
44+
developerConnection.set("scm:git:ssh://github.com:Trendyol/stove4k.git")
45+
url.set(project.properties["projectUrl"].toString())
46+
}
4947
}
5048
}
49+
}
5150

52-
repositories {
53-
maven {
54-
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
55-
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
56-
url = if (rootProject.version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
57-
// url = rootProject.buildDir.resolve("publications").toURI()
58-
credentials {
59-
username = getProperty("nexus_username", "nexus_username")
60-
password = getProperty("nexus_password", "nexus_password")
61-
}
51+
repositories {
52+
maven {
53+
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
54+
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
55+
url = if (rootProject.version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
56+
// url = rootProject.buildDir.resolve("publications").toURI()
57+
credentials {
58+
username = getProperty("nexus_username", "nexus_username")
59+
password = getProperty("nexus_password", "nexus_password")
6260
}
6361
}
6462
}
63+
}
6564

66-
val signingKey = getProperty(projectKey = "gpg.key", environmentKey = "gpg_private_key")
67-
val passPhrase = getProperty(projectKey = "gpg.passphrase", environmentKey = "gpg_passphrase")
68-
signing {
69-
if (passPhrase == null) {
70-
logger.warn(
71-
"The passphrase for the signing key was not found. Either provide it as env variable 'gpg_passphrase' or as project property 'gpg_passphrase'. Otherwise the signing might fail!"
72-
)
73-
}
74-
useInMemoryPgpKeys(signingKey, passPhrase)
75-
sign(publishing.publications)
65+
val signingKey = getProperty(projectKey = "gpg.key", environmentKey = "gpg_private_key")
66+
val passPhrase = getProperty(projectKey = "gpg.passphrase", environmentKey = "gpg_passphrase")
67+
signing {
68+
if (passPhrase == null) {
69+
logger.warn(
70+
"The passphrase for the signing key was not found. " +
71+
"Either provide it as env variable 'gpg_passphrase' or " +
72+
"as project property 'gpg_passphrase'. Otherwise the signing might fail!"
73+
)
7674
}
75+
useInMemoryPgpKeys(signingKey, passPhrase)
76+
sign(publishing.publications)
7777
}

0 commit comments

Comments
 (0)