-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
111 lines (95 loc) · 3.22 KB
/
build.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
plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'signing'
id 'maven-publish'
}
group 'cc.jilt' // we need a domain we own for Maven Central, and jilt.org is scalped
version '1.6.3'
shadowJar {
relocate 'com.squareup', 'org.jilt.shaded.com.squareup'
archiveClassifier = '' // we want the shadow JAR to be the main output JAR
configurations = [project.configurations.compileClasspath]
}
java {
withSourcesJar()
withJavadocJar()
}
artifacts {
archives shadowJar, sourcesJar, javadocJar
}
// defaults if the value of the username and password for Maven Central is not found -
// they are only needed when running the 'uploadArchives' task to release a new version
def ossrhUsername = findProperty('ossrhUsername') ?: 'username'
def ossrhPassword = findProperty('ossrhPassword') ?: 'password'
publishing {
publications {
shadow(MavenPublication) {
from components.java
pom {
name = 'Jilt'
description = 'Java annotation processor for auto-generating Builder (including Staged Builder) pattern classes'
url = 'https://github.com/skinny85/jilt'
scm {
url = 'https://github.com/skinny85/jilt.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Adam Ruka'
}
}
}
}
}
repositories {
maven {
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = ossrhUsername
password = ossrhPassword
}
name = 'MavenCentral'
}
}
}
signing {
useGpgCmd()
sign publishing.publications.shadow
}
// turn off signing unless we're uploading archives to Maven Central,
// as it will fail if a valid PGP key is not set
tasks.withType(Sign).configureEach {
onlyIf { project.hasProperty('publishToMavenCentral') }
}
repositories {
mavenCentral()
}
if (JavaVersion.current() < JavaVersion.VERSION_17) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceSets.test.java.exclude '**/Record*.java', '**/JSpecify*.java', '**/TypeUseAnnotationsTest.java'
} else {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
dependencies {
testImplementation 'org.jspecify:jspecify:0.3.0'
}
}
dependencies {
compileOnly 'com.squareup:javapoet:1.13.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:3.6.2'
testImplementation 'com.google.code.findbugs:jsr305:3.0.2'
testAnnotationProcessor project
}
// required in Gradle 8, since the above line 'testAnnotationProcessor project'
// creates an implicit dependency on shadowJar from compileTestJava
tasks.named('compileTestJava').configure {
it.dependsOn(tasks.named('shadowJar'))
}