-
Notifications
You must be signed in to change notification settings - Fork 11
/
shared.gradle
133 lines (128 loc) · 3.98 KB
/
shared.gradle
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
ext {
isPublishable = false
version_assertj = '3.25.1'
version_awaitility = '4.2.0'
version_bouncycastle = '1.77'
version_jackson = '2.10.1' // Matches transitive version for retrofit2:converter-jackson:2.8.1
version_junit = '5.10.1'
version_mockito = '4.8.0'
version_mustache = '1.15'
version_projectlombok = '1.18.30'
version_retrofit = '2.9.0'
version_rxjava2 = '2.2.21'
version_swagger_parser = '2.1.1'
}
project.group = 'com.marcnuri.yakc'
project.version = '0.0.29'
repositories {
jcenter()
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
ext.configurePublishing = { Project evaluatedProject ->
if (!evaluatedProject.isPublishable || project.hasProperty("skipPublishing")) {
return
}
def delombokedSourceDir = "$buildDir/delombok"
def isRelease = !version.endsWith('SNAPSHOT')
def ossrhUsername = findProperty("ossrhUsername")
def ossrhPassword = findProperty("ossrhPassword")
def releaseUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
apply plugin: 'maven-publish'
apply plugin: 'org.kordamp.gradle.jandex'
jar.dependsOn jandex
task delombok(dependsOn: classes) {
group = 'maven'
inputs.dir projectDir.toPath().resolve("src").toFile()
outputs.dir file(delombokedSourceDir)
doLast {
ant.taskdef(
name: 'delombok',
classname: 'lombok.delombok.ant.Tasks$Delombok',
classpath: configurations.compileClasspath.asPath + ";" + configurations.runtimeClasspath.asPath
)
ant.mkdir(dir: delombokedSourceDir)
evaluatedProject.sourceSets.main.java.srcDirs.each { srcDir ->
ant.delombok(verbose: 'true', encoding: 'UTF-8', to: delombokedSourceDir, from: srcDir)
}
}
}
task delombokedJavadoc(type: Javadoc, dependsOn: delombok) {
group = 'maven'
source = delombokedSourceDir
classpath = files(configurations.compileClasspath.asPath, configurations.runtimeClasspath.asPath)
}
task sourcesJar(type: Jar, dependsOn: classes) {
group = 'maven'
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: delombokedJavadoc) {
group = 'maven'
archiveClassifier.set('javadoc')
from delombokedJavadoc.destinationDir
}
task assemblePublication(dependsOn: [classes, assemble, sourcesJar, javadocJar]) {
group = 'maven'
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
repositories {
maven {
url = isRelease ? releaseUrl : snapshotUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = pomName
description = pomDescription
url = 'https://github.com/manusa/yakc'
packaging = 'jar'
scm {
connection = 'scm:git:git://github.com/manusa/yakc.git'
developerConnection = 'scm:git:ssh://github.com:manusa/yakc.git'
url = 'https://github.com/manusa/yakc'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Marc Nuri'
email = '[email protected]'
}
}
}
}
}
}
publishToMavenLocal.group 'maven'
publishToMavenLocal.dependsOn assemblePublication
publish.group 'maven'
publish.dependsOn publishToMavenLocal
if (project.hasProperty("sign")) {
apply plugin: 'signing'
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
}
}