-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublishing.gradle
More file actions
91 lines (81 loc) · 3.28 KB
/
Copy pathpublishing.gradle
File metadata and controls
91 lines (81 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
afterEvaluate {
if (!project.ext.has('publishingConfig')
|| !project.ext.publishingConfig instanceof Map) {
return
}
def config = project.ext.publishingConfig
publishing {
publications {
create("maven", MavenPublication) {
from(components["java"] as SoftwareComponent)
groupId = config.groupId
artifactId = config.artifactId
version = config.version
pom {
properties = [
'maven.compiler.source': '11',
'maven.compiler.target': '11',
]
name = config.name
description = config.description
url = 'https://github.com/twexapi-dev/x-api-scraper-java'
scm {
url = 'https://github.com/twexapi-dev/x-api-scraper-java'
connection = 'scm:git:https://github.com/twexapi-dev/x-api-scraper-java.git'
}
licenses {
license {
name = 'The MIT License (MIT)'
url = 'https://mit-license.org/'
}
}
developers {
developer {
name = 'TwexAPI'
organization = 'TwexAPI'
email = 'support@twexapi.io'
}
}
organization {
name = 'TwexAPI'
url = 'https://twexapi.io'
}
}
}
}
if (!project.hasProperty('skip.signing')) {
signing {
def signingKey = findProperty("signingKey")
def signingPassphrase = findProperty("signingPassphrase")
useInMemoryPgpKeys(signingKey, signingPassphrase)
sign publishing.publications.getByName("maven")
}
}
}
// Configure POM file generation task after publishing is configured
tasks.named("generatePomFileForMavenPublication") {
destination = file(layout.buildDirectory.file("pom.xml"))
jar.dependsOn('generatePomFileForMavenPublication')
}
}
// Debug task to log publishing properties before publish tasks
tasks.register('logPublishingProperties') {
doLast {
if (project.ext.has('publishingConfig')) {
def config = project.ext.publishingConfig
logger.quiet("Publishing properties for project '${project.name}':")
logger.quiet(" groupId: ${config.groupId}")
logger.quiet(" artifactId: ${config.artifactId}")
logger.quiet(" version: ${config.version}")
logger.quiet(" name: ${config.name}")
logger.quiet(" description: ${config.description}")
logger.quiet(" publicationName: maven")
}
}
}
// Make all publish tasks depend on the logging task and POM generation
tasks.matching { it.name.startsWith('publish')
|| it.name.contains('sonatypeCentralUpload') }.configureEach {
dependsOn logPublishingProperties
dependsOn 'generatePomFileForMavenPublication'
}