forked from typesense/typesense-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
144 lines (124 loc) · 4.41 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
plugins {
id 'java'
id 'signing'
id 'maven-publish'
id 'io.github.gradle-nexus.publish-plugin' version "${nexusPluginVersion}"
id 'com.github.johnrengelman.shadow' version "${shadowJarPluginVersion}"
id 'org.hidetake.swagger.generator' version '2.19.2'
}
apply plugin: DownloadSpecsPlugin
repositories {
mavenCentral()
}
group = 'org.typesense'
version = '0.6.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
jar {
manifest {
attributes(
"Main-Class": "org.typesense.api.Client",
"Multi-Release": "true"
)
}
exclude "META-INF/DEPENDENCIES"
}
sourceSets {
integrationTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
java.srcDir file('src/integration-test/java')
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
integrationTestImplementation.extendsFrom implementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.register('integrationTest', Test) {
description = 'Runs integration tests (assumes running Docker image or local server)'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
shouldRunAfter test
}
check.dependsOn integrationTest
dependencies {
implementation "javax.xml.bind:jaxb-api:${javaxXmlBindVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonCoreVersion}"
implementation "io.swagger.core.v3:swagger-annotations:${swaggerCoreV3Version}"
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
implementation "com.squareup.okhttp3:okhttp:${okhttp3Version}"
implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
integrationTestImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
integrationTestImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}"
integrationTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.36'
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
swaggerSources {
typesense {
inputFile = file("$buildDir/openapi.yml")
code {
language = "java"
configFile = file("swagger-config.json")
components = ['models']
}
}
}
swaggerSources.typesense.code.dependsOn downloadApiSpec
compileJava.dependsOn swaggerSources.typesense.code
sourceSets.main.java.srcDir "${swaggerSources.typesense.code.outputDir}/src/main/java"
sourceSets.main.resources.srcDir "${swaggerSources.typesense.code.outputDir}/src/main/resources"
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
pom {
name = 'typesense-java'
description = 'Typesense Java Client'
url = 'https://github.com/typesense/typesense-java'
licenses {
license {
name = 'GNU General Public License v3.0'
url = 'https://www.gnu.org/licenses/gpl-3.0.en.html'
}
}
developers {
developer {
id = 'typesense'
name = 'Typesense'
}
}
scm {
url = 'https://github.com/typesense/typesense-java'
connection = 'scm:git://github.com/typesense/typesense-java.git'
developerConnection = 'scm:git://github.com/typesense/typesense-java.git'
}
}
}
}
}
if (project.hasProperty("signing.keyId")) {
signing {
sign publishing.publications.mavenJava
}
}