-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle
More file actions
144 lines (124 loc) · 4.89 KB
/
build.gradle
File metadata and controls
144 lines (124 loc) · 4.89 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
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
// This replaces the code generator's default build.gradle template (see:
// https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache)
// which had a number of issues making it unsuitable for the LaunchDarkly API
// client build: it relied on a very old version of Gradle and the Gradle plugins,
// it used the obsolete jcenter repository, and it did not include the necessary
// javax.annotation dependency. It also had the option of building for Android,
// but we do not need that. This script also adds code signing and pom properties.
// IMPORTANT: If the Java client fails to build due to a dependency problem, it
// probably means that the Swagger code generator changed the dependencies in its
// own build.gradle and we did not update them here. Unfortunately, overriding the
// build.gradle in this way does not allow us to copy their dependencies.
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
}
plugins {
id 'java'
id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
id 'org.ajoberstar.git-publish' version '3.0.0'
}
repositories {
mavenLocal()
mavenCentral()
}
def centralPortalUsername = hasProperty('centralPortalUsername') ? centralPortalUsername : System.getenv('CENTRAL_PORTAL_USERNAME')
def centralPortalPassword = hasProperty('centralPortalPassword') ? centralPortalPassword : System.getenv('CENTRAL_PORTAL_PASSWORD')
allprojects {
group = 'com.launchdarkly'
version = '22.0.0'
archivesBaseName = 'api-client'
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
dependencies {
implementation 'io.swagger:swagger-annotations:1.5.24'
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'io.gsonfire:gson-fire:1.8.4'
implementation 'org.openapitools:jackson-databind-nullable:0.2.1'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
implementation 'org.threeten:threetenbp:1.4.3'
implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'
implementation 'javax.annotation:javax.annotation-api:1.3.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.14.0'
}
compileJava {
// The generated code should be treated as UTF-8 because some of the properties
// in our openapi.json may include non-ASCII Unicode characters.
options.encoding = "UTF-8"
}
compileTestJava {
options.encoding = "UTF-8"
}
javadoc {
options.encoding = "UTF-8"
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
if (JavaVersion.current().isJava8Compatible()) {
// Suppress the many Javadoc warnings that we would otherwise get from the generated code
tasks.withType(Javadoc) {
options.addBooleanOption('Xdoclint:none', true)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = 'api-client'
artifact sourcesJar
artifact javadocJar
pom {
name = "API Client for Java"
packaging = 'jar'
description = 'Official LaunchDarkly API Client for Java'
url = 'https://github.com/launchdarkly/api-client-java'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'launchdarkly'
name = 'LaunchDarkly'
email = 'support@launchdarkly.com'
}
}
scm {
connection = 'scm:git:git://github.com/launchdarkly/api-client-java.git'
developerConnection = 'scm:git:ssh:git@github.com:launchdarkly/api-client-java.git'
url = 'https://github.com/launchdarkly/api-client-java'
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
nexusPublishing {
packageGroup = "com.launchdarkly"
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username = centralPortalUsername
password = centralPortalPassword
}
}
}