-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
173 lines (146 loc) · 5.01 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
ext {
sharedDir = file('shared')
originVersion = '2.3.2.Final'
exactproVersion = '3'
publishVersion = "${originVersion}.${exactproVersion}"
sonatype_publish = project.hasProperty('sonatypePublish') ? true : false
}
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'maven'
if (sonatype_publish) {
apply plugin: 'signing'
}
group = 'com.exactpro.mvel'
version = publishVersion
description = 'mvel'
sourceCompatibility = 1.6
targetCompatibility = 1.6
buildscript {
repositories {
jcenter()
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.4.12')
}
}
repositories {
maven {
name 'MavenLocal' // for local builds only
url 'shared'
}
jcenter()
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.28'
testCompile 'org.slf4j:slf4j-log4j12:1.7.28'
testCompile group: 'junit', name: 'junit', version:'4.8.2'
testCompile group: 'com.thoughtworks.xstream', name: 'xstream', version:'1.3.1'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
manifest {
attributes('Implementation-Version': "${revision}")
attributes('Build_Number': "${build_number}")
attributes('Git_Hash': "${git_hash}")
}
}
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}
uploadArchives {
repositories {
mavenDeployer {
if (sonatype_publish) {
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'Exactpro MVEL'
packaging 'jar'
// optionally artifactId can be defined here
description 'MVEL is one of such libraries we depend on and which was modified by Exactpro.'
url 'https://github.com/Exactpro/mvel'
scm {
connection 'scm:git:https://github.com/Exactpro/mvel'
developerConnection 'scm:git:https://github.com/Exactpro/mvel'
url 'https://github.com/Exactpro/mvel'
}
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]'
}
developer {
id 'ivandruzhinin'
name 'Ivan Druzhinin'
email '[email protected]'
}
}
}
} else {
uniqueVersion = false // publish non unique snapshots to local repository
repository(url: "file://${sharedDir}")
}
doLast {
// Remove any invalid maven-metadata.xml files that may have been created
// for SNAPSHOT versions that are *not* uniquely versioned.
pom*.each { pom ->
if (pom.version.endsWith('-SNAPSHOT')) {
final File artifactDir = new File(rootProject.ext.sharedDir,
pom.groupId.replace('.', '/')
+ '/' + pom.artifactId
+ '/' + pom.version)
delete fileTree(dir: artifactDir, include: 'maven-metadata.xml*')
}
}
}
}
}
doFirst { sharedDir.mkdirs() }
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: classes) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives sourcesJar, javadocJar
}
if (sonatype_publish) {
signing {
sign configurations.archives
}
}
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')
}
}
}
artifactoryPublish {
dependsOn sourcesJar, javadocJar
}