-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
177 lines (152 loc) · 4.71 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
import java.text.SimpleDateFormat
buildscript {
ext {
gradleVersionProperty = '8.7'
karateVersion = '1.4.1'
masterThoughtVersion = '5.8.0'
junitPlatformsLauncherVersion = '1.10.2'
reportportalAgentJavaKarateVersion = '5.0.5'
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://jitpack.io' }
}
}
plugins {
id 'project-report'
id 'eclipse'
id 'java'
id 'idea'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id "maven-publish"
}
group 'com.github.znsio'
version '0.0.1'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://jitpack.io' }
}
sourceSets {
test {
resources {
srcDir file('src/test/java')
exclude '**/*.java'
}
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
dependencies {
implementation "com.intuit.karate:karate-core:${karateVersion}"
implementation "com.intuit.karate:karate-junit5:${karateVersion}"
implementation "net.masterthought:cucumber-reporting:${masterThoughtVersion}"
implementation "org.junit.platform:junit-platform-launcher:${junitPlatformsLauncherVersion}"
implementation "com.epam.reportportal:agent-java-karate:${reportportalAgentJavaKarateVersion}"
}
static def getCurrentDatestamp() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy")
return df.format(today)
}
static def getMonth() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("MMM-yyyy")
return df.format(today)
}
static def getCurrentTimestamp() {
Date today = new Date()
SimpleDateFormat df = new SimpleDateFormat("HH-mm-ss")
return df.format(today)
}
project.ext.logDir = "./target/" + getMonth() + "/" + getCurrentDatestamp() + "/" + getCurrentTimestamp()
task karateDebug(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
mainClass = 'com.intuit.karate.cli.Main'
}
shadowJar {
archiveBaseName.set("$project.name")
archiveClassifier.set('')
archiveVersion.set("$project.version")
zip64 true
manifest {
attributes "Main-Class": "com.znsio.kendo.FatJarRunner"
attributes 'Description': 'This is the kendo uber jar'
}
from sourceSets.test.output
from('.') { include 'gradle/**/*' }
from('.') { include 'gradlew*' }
from('.') { include 'build.gradle' }
from('.') { include 'src/test/**/*' }
doLast {
println "Created jar: ${rootDir}/upload/${project.name}-${project.version}.jar"
}
}
tasks.register('run', JavaExec) {
doFirst {
println "Using LOG_DIR: ${project.logDir}"
System.setProperty "LOG_DIR", "${project.logDir}"
def configFile = System.getenv("CONFIG")
if (null == configFile || !file(configFile).exists()) {
configFile = "./src/test/java/config.properties"
println("CONFIG file not provided, or does not exist")
println("Run the test by providing the CONFIG file not provided, or does not exist. Using default configFile: ${configFile}")
}
assert file(configFile).exists()
environment("CONFIG_FILE", configFile)
println("Debug mode: " + System.getProperty('debug', 'false'))
// attach debugger
// example: ./gradlew run -Ddebug=true
if (System.getProperty('debug', 'false') == 'true') {
println("In debug mode")
jvmArgs '-Xdebug', '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,' + 'address=*:5005'
}
}
mainClass = "com.znsio.kendo.FatJarRunner"
classpath = sourceSets.test.runtimeClasspath + sourceSets.main.output + sourceSets.test.output
}
task sourcesJar(type: Jar, dependsOn: classes) {
duplicatesStrategy = "include"
archiveClassifier = 'sources'
from sourceSets.test.allJava
}
artifacts {
archives sourcesJar
archives shadowJar
}
publishing {
publications {
testing(MavenPublication) {
from components.java
artifact sourcesJar
}
}
}
tasks.register('install') { dependsOn publishToMavenLocal }
task copyToUpload(type: Copy) {
from 'src/test/java/test_data.json'
into 'upload/src/test/java'
from 'src/test/java/config.properties'
into 'config.properties'
from 'runAPIWorkflowTests.sh'
into 'upload'
from(jar)
into 'upload'
}
test.dependsOn clean
shadowJar.finalizedBy copyToUpload
shadowJar.dependsOn wrapper
wrapper {
gradleVersion = gradleVersionProperty
}