-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
203 lines (173 loc) · 6.05 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
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'groovy'
apply plugin: 'com.gradle.plugin-publish'
ext {
sharedDir = file("${project.rootDir}/shared")
gradle_publish = project.hasProperty('gradle.publish.key') && project.hasProperty('gradle.publish.secret')
}
if (gradle_publish) {
apply plugin: 'signing'
}
def versionMaintenance = (gradle_publish)? sailfish_version_maintenance: '0'
def versionSuffix = (gradle_publish)? '': '-SNAPSHOT'
group = 'com.exactpro'
version = "${sailfish_version_major}.${sailfish_version_minor}.${versionMaintenance}${versionSuffix}"
archivesBaseName = rootProject.name
dependencies {
implementation gradleApi()
implementation localGroovy()
if(JavaVersion.current() >= JavaVersion.VERSION_11) {
implementation 'javax.xml.bind:jaxb-api:2.3.0'
}
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
api group: 'org.freemarker', name: 'freemarker', version: '2.3.30'
implementation group: 'io.fixprotocol.orchestra', name: 'repository-quickfix', version: '1.5.0'
implementation 'commons-io:commons-io:1.4'
implementation 'com.google.guava:guava:32.0.0-jre'
}
configurations.configureEach {
resolutionStrategy {
force 'org.apache.logging.log4j:log4j-core:2.18.0'
}
}
sourceCompatibility = JavaVersion.VERSION_11 //Java version compatibility to use when compiling Java source.
targetCompatibility = JavaVersion.VERSION_11 //Java version to generate classes for.
sourceSets {
main {
java {
srcDirs = []
}
groovy {
srcDirs = ['src/main/java', 'src/main/groovy']
}
}
}
buildscript { // artifacrory plugin
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.4.12')
classpath(group: 'com.bmuschko', name: 'gradle-tomcat-plugin', version: '2.2.2')
classpath(group: 'com.gradle.plugin-publish', name: 'com.gradle.plugin-publish.gradle.plugin', version: '1.2.1')
}
}
wrapper {
gradleVersion = '7.6.3'
distributionType = 'bin'
}
repositories {
maven {
name 'MavenLocal' // for local builds only
url sharedDir
}
mavenCentral()
}
tasks.register('zipFixTypes', Zip) {
from('src/main/resources/fix/')
include('types.xml')
archiveClassifier = 'fixtypes'
}
artifactory {
publish {
defaults {
// Reference to Gradle configurations defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publishConfigs('archives')
}
}
}
publishing {
publications {
MavenJava(MavenPublication) {
from components.java
artifact(zipFixTypes)
if (gradle_publish) {
pom {
name = 'Exactpro Sailfish Gradle plugin'
packaging 'jar'
// optionally artifactId can be defined here
description 'Gradle toolset for Sailfish build. Sailfish is Test automation solution we\'re releasing to open source.'
url = vcs_url
scm {
connection = 'scm:git:https://github.com/exactpro/sailfish-gradle-plugin.git'
developerConnection = 'scm:git:https://github.com/exactpro/sailfish-gradle-plugin.git'
url = vcs_url
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'Nikita-Smirnov-Exactpro'
name = 'Nikita Smirnov'
email = '[email protected]'
}
}
}
} else {
// Remove any invalid maven-metadata.xml files that may have been created
// for SNAPSHOT versions that are *not* uniquely versioned.
pom {
if (version.endsWith('-SNAPSHOT')) {
final File artifactDir = new File(rootProject.ext.sharedDir,
groupId.replace('.', '/')
+ '/' + artifactId
+ '/' + version)
delete fileTree(dir: artifactDir, include: 'maven-metadata.xml*')
}
}
}
}
}
repositories {
maven {
url = "file://${sharedDir}"
}
}
}
tasks.register('sourcesJar', Jar) {
dependsOn classes
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
tasks.register('javadocJar', Jar) {
dependsOn classes
archiveClassifier = 'javadoc'
from javadoc
}
artifacts {
archives sourcesJar, javadocJar, zipFixTypes
}
gradlePlugin {
website = 'https://github.com/exactpro/sailfish-gradle-plugin'
vcsUrl = 'https://github.com/exactpro/sailfish-gradle-plugin.git'
plugins {
sailfish {
id = 'com.exactpro.sailfish-gradle-plugin'
displayName = 'Gradle plugin for Sailfish'
description = 'Gradle toolset for Sailfish build. Sailfish is Test automation solution we\'re releasing to open source.'
tags.set(['Exactpro', 'Sailfish'])
implementationClass = 'com.exactpro.sf.Sailfish'
}
}
}
if (gradle_publish) {
tasks.withType(Sign).configureEach {
onlyIf {
project.hasProperty('signing.keyId') && project.hasProperty('signing.password')
}
}
signing {
sign publishing.publications.MavenJava
}
}