-
Notifications
You must be signed in to change notification settings - Fork 25
/
build.gradle
191 lines (164 loc) · 5.12 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
* The MIT License (MIT)
* Copyright (c) 2017 Sybit GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
*/
plugins {
id 'java-library'
id 'jacoco'
id 'idea'
id 'maven-publish'
id 'com.github.jk1.dependency-license-report' version '2.8'
}
/*
* Gets the version name from the latest Git tag
*/
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
catch (ignored) {
return "";
}
} as Object
group = 'com.sybit'
version = getVersionName()
description = "Java API for Airtable"
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.deprecation = true
options.compilerArgs += ['-Xlint:deprecation']
// options.compilerArgs += ['-Xlint:unchecked']
sourceCompatibility = 18
}
sourceSets {
integrationTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
java {
srcDir file('src/itest/java')
}
resources {
srcDir file('src/itest/resources')
}
}
}
idea {
module {
testSources.from(sourceSets.integrationTest.java.srcDirs)
}
}
repositories {
mavenCentral()
}
configurations {
integrationTestImplementation.extendsFrom implementation, testImplementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly, testRuntimeOnly
}
dependencies {
implementation 'com.konghq:unirest-java:3.14.5'
implementation 'org.apache.httpcomponents.client5:httpclient5:5.3.1'
implementation 'org.json:json:20240303'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'commons-beanutils:commons-beanutils:1.9.4'
implementation 'commons-io:commons-io:2.16.1'
implementation 'org.slf4j:slf4j-api:2.0.13'
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.github.tomakehurst:wiremock:3.0.1'
testImplementation 'org.slf4j:slf4j-jdk14:2.0.13'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.10.3'
}
java {
withSourcesJar()
withJavadocJar()
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
tasks.named('jacocoTestReport') {
reports {
xml.required = true
}
}
tasks.register('integrationTest', Test) {
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
shouldRunAfter test
useJUnitPlatform()
// This is not needed, but I like to see which tests have run
testLogging {
events "passed", "skipped", "failed"
}
}
publishing {
publications {
gpr(MavenPublication) {
from(components.java)
}
/*
maven(MavenPublication) {
artifactId = rootProject.name
groupId = group
version getVersionName()
pom {
name = 'Airtable.java'
description = 'This is a Java API client for Airtable'
url = 'https://github.com/Sybit-Education/airtable.java'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'stritti'
name = 'Stephan Strittmatter'
email = 'stephan.strittmatter@sybit.de'
}
}
scm {
connection = 'scm:git:git://Sybit-Education/airtable.java.git'
developerConnection = 'scm:git:ssh://Sybit-Education/airtable.java.git'
url = 'https://github.com/Sybit-Education/airtable.java'
}
}
if (plugins.hasPlugin('war')) {
from components.web
} else {
from components.java
}
//we have to change scope from runtime to compile. Especially for Gson-lib.
pom.withXml {
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.implementation.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each { it.scope*.value = 'implementation' }
}
artifact sourcesJar
artifact javadocJar
}
*/
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Sybit-Education/airtable.java")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("ACTION_DEPLOY_USER")
password = project.findProperty("gpr.key") ?: System.getenv("ACTION_DEPLOY_TOKEN")
}
}
}
}
check.dependsOn integrationTest