-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
162 lines (137 loc) · 4.94 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import com.expediagroup.graphql.plugin.gradle.config.GraphQLSerializer
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id "java"
id 'org.jetbrains.kotlin.jvm' version '1.9.21'
id "signing"
id "maven-publish"
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
id 'com.expediagroup.graphql' version '5.2.0'
id "org.jetbrains.dokka" version "1.9.0"
}
group 'com.indico'
repositories {
mavenCentral()
}
archivesBaseName = "indico-client-java"
version = "6.0.0"
test.onlyIf { project.hasProperty('runTests') }
tasks.register('sourceJar', Jar) {
classifier "sources"
from sourceSets.main.allJava
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc
classifier "javadoc"
from javadoc.destinationDir
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.21"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.21"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
implementation("io.ktor:ktor-client-okhttp:2.3.2")
testImplementation('org.junit.jupiter:junit-jupiter:5.5.2')
implementation("com.expediagroup:graphql-kotlin-ktor-client:6.5.3")
implementation("com.expediagroup:graphql-kotlin-client-jackson:6.5.3")
implementation("com.squareup.okhttp3:okhttp:4.10.0")
implementation('org.apache.logging.log4j:log4j-1.2-api:2.15.0')
api('org.json:json:20231013')
compileOnly("org.jetbrains:annotations:13.0")
testCompileOnly("org.jetbrains:annotations:13.0")
}
//use with update-schema.sh to refresh graphql schema
graphqlIntrospectSchema {
outputFile = file("${project.projectDir}/src/main/graphql/schema.graphql")
endpoint = "https://app.indico.io/graph/api/graphql"
headers = ["Authorization" : "Bearer " + project.getProperties().getOrDefault('graphQlToken', "")]
}
graphqlGenerateClient {
// Boolean flag indicating whether or not selection of deprecated fields is allowed.
allowDeprecatedFields = true
packageName = "com.indico.graphql"
schemaFile = file("${project.projectDir}/src/main/resources/schema.graphql")
serializer = GraphQLSerializer.JACKSON
useOptionalInputWrapper = true
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
// ossrh requires javadoc and sources https://central.sonatype.org/pages/requirements.html
java {
withJavadocJar()
withSourcesJar()
}
void sign(Project project) {
project.signing {
required { project.gradle.taskGraph.hasTask("publish") }
def signingKeyId = project.findProperty("signingKeyId")
def signingKey = project.findProperty("signingKey")
def signingPassword = project.findProperty("signingPassword")
if (signingKeyId) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
} else if (signingKey) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.maven
}
}
project.plugins.withType(MavenPublishPlugin).all {
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
publishing.publications.withType(MavenPublication).all { mavenPublication ->
mavenPublication.pom {
name = "${project.group}:${project.name}"
description = name
url = "https://github.com/indico/indico-client-java"
licenses {
license {
name = "MIT"
url = "https://github.com/IndicoDataSolutions/indico-client-java/blob/master/LICENSE"
}
}
developers {
developer {
id = "indico"
name = "Indico Engineering"
email = "[email protected]"
}
}
scm {
connection = "scm:git:https://github.com/indico/indico-client-java.git"
developerConnection = "scm:git:ssh://github.com/indico/indico-client-java.git"
url = "https://github.com/indico/indico-client-java"
}
sign(project)
}
}
}
nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
connectTimeout = Duration.ofMinutes(3)
clientTimeout = Duration.ofMinutes(3)
}
publishing {
repositories {
maven {
name = "local"
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
test {
useJUnitPlatform()
}