-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
248 lines (227 loc) · 10.5 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
plugins {
id 'java'
id 'java-library'
id 'org.labkey.build.testRunner'
id 'maven-publish'
}
import org.labkey.gradle.util.BuildUtils
import org.labkey.gradle.util.GroupNames
import org.labkey.gradle.util.PomFileHelper
project.group = "org.labkey.api"
def apiArtifactName = "labkey-api-selenium"
project.configurations {
aspectj
}
project.dependencies {
implementation "org.xerial:sqlite-jdbc:${sqliteJdbcVersion}" // declaring SQLite here to be used in TargetedMS test
api("junit:junit:${junitVersion}")
api("org.seleniumhq.selenium:selenium-api:${seleniumVersion}")
api("org.assertj:assertj-core:${assertjVersion}")
implementation("org.awaitility:awaitility:${awaitilityVersion}")
implementation("commons-io:commons-io:${commonsIoVersion}")
implementation("com.fasterxml.jackson.core:jackson-annotations:${jacksonAnnotationsVersion}")
implementation("org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}")
//api "org.seleniumhq.selenium:selenium-server:${seleniumVersion}"
implementation("org.seleniumhq.selenium:selenium-firefox-driver:${seleniumVersion}")
api("org.seleniumhq.selenium:selenium-support:${seleniumVersion}")
implementation("org.seleniumhq.selenium:selenium-remote-driver:${seleniumVersion}")
implementation("org.seleniumhq.selenium:selenium-chrome-driver:${seleniumVersion}")
implementation "org.seleniumhq.selenium:selenium-ie-driver:${seleniumVersion}"
implementation("org.eclipse.jetty:jetty-util:${jettyVersion}")
implementation("com.google.guava:guava:${guavaVersion}")
api("org.apache.httpcomponents.core5:httpcore5:${httpcore5Version}")
api("org.apache.httpcomponents.client5:httpclient5:${httpclient5Version}")
api("org.hamcrest:hamcrest:${hamcrestVersion}")
implementation("org.apache.commons:commons-text:${commonsTextVersion}")
implementation("com.fasterxml.jackson.core:jackson-databind:${jacksonDatabindVersion}")
implementation("org.apache.commons:commons-collections4:${commonsCollections4Version}")
implementation("net.sf.opencsv:opencsv:${opencsvVersion}")
aspectj "org.aspectj:aspectjtools:${aspectjVersion}"
implementation "org.apache.logging.log4j:log4j-core:${log4j2Version}"
implementation "org.apache.logging.log4j:log4j-iostreams:${log4j2Version}"
api "com.github.lookfirst:sardine:${project.lookfirstSardineVersion}"
implementation "javax.xml.bind:jaxb-api:${jaxbApiOldVersion}"
implementation "org.glassfish.jaxb:jaxb-runtime:${jaxbOldVersion}"
api "commons-beanutils:commons-beanutils:${commonsBeanutilsVersion}"
implementation "org.apache.tika:tika-core:${tikaVersion}"
implementation "org.apache.commons:commons-compress:${commonsCompressVersion}"
api "org.apache.commons:commons-lang3:${commonsLang3Version}"
implementation "org.apache.commons:commons-math3:${commonsMath3Version}" // used by test classes in targetedms
implementation "org.apache.pdfbox:pdfbox:${pdfboxVersion}"
api "org.apache.poi:poi:${poiVersion}"
implementation "org.apache.poi:poi-ooxml:${poiVersion}"
implementation "org.apache.xmlbeans:xmlbeans:${xmlbeansVersion}"
implementation "org.bouncycastle:bcpg-jdk18on:${bouncycastlePgpVersion}"
implementation "org.jetbrains:annotations:${annotationsVersion}"
implementation "org.mock-server:mockserver-netty:${mockserverNettyVersion}" // used by test classes in accounts
runtimeOnly "org.aspectj:aspectjrt:${aspectjVersion}"
api "org.aspectj:aspectjtools:${aspectjVersion}"
implementation "org.reflections:reflections:${reflectionsVersion}"
uiTestRuntimeOnly "org.aspectj:aspectjrt:${aspectjVersion}"
if (!project.hasProperty('testWithLocalApi') && // Use this property temporarily when upgrading XMLBeans or changing dependencies provided by API
(project.hasProperty("teamcity") || project.findProject(BuildUtils.getApiProjectPath(project.gradle)) == null)) {
// LabKey XML schemas are used to decode exported folder XMLs and test case XMLs
// Don't include local version so that running tests doesn't require building API module
implementation("org.labkey.api:api:${labkeySchemasTestVersion}") { transitive = false }
}
else {
// Use local version outside of TeamCity so as to not confuse IntelliJ
BuildUtils.addLabKeyDependency(
project: project,
config: "implementation",
depProjectPath: BuildUtils.getApiProjectPath(project.gradle),
depProjectConfig: 'apiJarFile',
transitive: false
)
}
}
BuildUtils.addLabKeyDependency(
project: project,
config: 'api',
depProjectPath: BuildUtils.getRemoteApiProjectPath(gradle),
depProjectConfig: 'runtimeElements',
depVersion: project.labkeyClientApiVersion)
if (project.findProject(":remoteapi:labkey-api-jdbc") != null)
{
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":remoteapi:labkey-api-jdbc")
}
if (project.hasProperty("teamcity"))
{
apply plugin: 'org.labkey.build.teamCity'
}
// If this configuration for the default jar file is included when syncing with IntelliJ
// the classes in other modules that reference classes here will not resolve properly.
if (!BuildUtils.isIntellij()) {
// the jar file that contains just the classes from this project, not all other
// projects with src/test directories
project.sourceSets {
main {
java {
srcDirs = ["src"]
exclude "test/tests/**"
}
resources {
srcDirs = ["resources"]
}
}
}
project.tasks.named('jar').configure {
Jar jar ->
jar.archiveBaseName.set(apiArtifactName)
jar.setGroup('org.labkey.api')
}
}
def initPropertiesTask = project.tasks.register("initProperties", Task) {
Task task ->
task.group = GroupNames.TEST
task.description = "Create test.properties if missing"
task.doLast({
File testProperties = project.file('test.properties')
File testPropertiesTemplate = project.file('test.properties.template')
if (!testProperties.exists())
{
project.copy {
CopySpec copy ->
copy.from(testPropertiesTemplate)
copy.into(project.file("."))
copy.rename(testPropertiesTemplate.getName(), testProperties.getName())
copy.filter { String line ->
if (line.startsWith("#!!")) {
return null
}
else {
return line
}
}
}
}
})
}
project.tasks.register("convertHarToStressXml", JavaExec) {
JavaExec task ->
task.group = GroupNames.TEST
task.description = "Convert browser HAR dump to XML for use as a stress test activity"
task.setMainClass('org.labkey.test.stress.HarConverter')
task.configure {
classpath {
[project.configurations.uiTestRuntimeClasspath, project.tasks.jar]
}
if (project.hasProperty('harInFile')) {
String[] args = [getProperty('harInFile')]
if (project.hasProperty('harOutFile')) {
args += getProperty('harOutFile')
}
task.args(args)
}
}
task.doFirst {
if (!project.hasProperty('harInFile')) {
throw new IllegalArgumentException("Specify input file for " + task.name + ". -PharInFile=<file>")
}
}
}
project.tasks.uiTests.dependsOn(initPropertiesTask)
project.parent.parent.tasks.ijConfigure.dependsOn(initPropertiesTask)
if (project.hasProperty('doPublishing'))
{
project.afterEvaluate {
PomFileHelper pomUtil = new PomFileHelper(project)
project.publishing {
publications {
libs(MavenPublication) {
groupId = project.group
artifactId = apiArtifactName
artifact project.tasks.jar
pom {
name = "LabKey Test Automation Classes"
description = "Library of classes and utilities for Selenium testing of LabKey Server components"
url = PomFileHelper.LABKEY_ORG_URL
developers PomFileHelper.getLabKeyTeamDevelopers()
licenses PomFileHelper.getApacheLicense()
organization PomFileHelper.getLabKeyOrganization()
scm {
connection = 'scm:git:https://github.com/LabKey/testAutomation'
developerConnection = 'scm:git:https://github.com/LabKey/testAutomation'
url = 'https://github.com/LabKey/testAutomation'
}
withXml {
pomUtil.getDependencyClosure(asNode(), false)
}
}
}
}
if (project.hasProperty('doPublishing'))
{
apply plugin: 'com.jfrog.artifactory'
artifactory {
contextUrl = "${artifactory_contextUrl}"
//The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = BuildUtils.getRepositoryKey(project)
if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password'))
{
username = artifactory_user
password = artifactory_password
}
}
defaults
{
publishBuildInfo = false
publishPom = true
publishIvy = false
}
}
}
project.artifactoryPublish {
publications('libs')
}
}
}
project.model {
tasks.publishLibsPublicationToMavenLocal {
enabled = false
}
}
}
}