forked from atrujillofalcon/mjml-rest-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
204 lines (173 loc) · 5.69 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
import net.researchgate.release.GitAdapter
buildscript {
ext.kotlin_version = '1.3.61'
ext.spring_version = '5.1.9.RELEASE'
ext.jackson_version = '2.10.1'
ext.thymeleaf_version = '3.0.11.RELEASE'
ext.junit5_version = '5.5.1'
ext.dokka_version = '0.9.17'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
}
}
plugins {
id 'net.researchgate.release' version '2.7.0'
id "com.jfrog.bintray" version "1.8.4"
}
group 'es.atrujillo.mjml'
version project.property('version')
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'jacoco'
apply plugin: 'org.jetbrains.dokka'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
//Spring dependencies
implementation "org.springframework:spring-web:$spring_version"
//Jackson dependencies
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version"
implementation "org.apache.httpcomponents:httpclient:4.5.9"
// implementation "javax.validation:validation-api:2.0.1.Final"
//Template with thymeleaf
api "org.thymeleaf:thymeleaf:$thymeleaf_version"
//Logging API
api "org.slf4j:slf4j-api:1.7.28"
testImplementation 'org.slf4j:slf4j-simple:1.7.28'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation "org.junit.jupiter:junit-jupiter:$junit5_version"
testImplementation 'org.mockito:mockito-junit-jupiter:2.23.4'
testImplementation 'org.jeasy:easy-random-core:4.1.0'
testImplementation 'org.jeasy:easy-random-randomizers:4.0.0'
testImplementation 'org.jeasy:easy-random-bean-validation:4.0.0'
testImplementation 'io.github.glytching:junit-extensions:2.3.0'
testImplementation 'pl.pojo:pojo-tester:0.7.6'
}
dokka {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
includeNonPublic = true
}
test {
useJUnitPlatform()
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled false
}
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
//Script to generate valid Maven Central pom.xml
def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers {
developer {
id "atrujillo"
name "Arnaldo Trujillo"
email "[email protected]"
}
}
scm {
url "https://github.com/atrujillofalcon/mjml-rest-client"
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: dokka) {
classifier = 'javadoc'
from dokka
}
publishing {
publications {
MavenCentral(MavenPublication) {
from components.java
groupId 'es.atrujillo.mjml'
artifactId 'mjml-rest-client'
artifact sourcesJar
artifact javadocJar
version project.property('version')
pom.withXml {
def root = asNode()
root.appendNode('description', 'Java library that use the mjml API')
root.appendNode('name', 'Mjml Rest Client')
root.appendNode('url', 'https://github.com/atrujillofalcon/mjml-rest-client')
root.children().last() + pomConfig
}
}
}
}
//End of script to generate valid Maven Central pom.xml
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
configurations = ['archives']
publications = ['MavenCentral']
pkg {
repo = 'mjml-rest-client'
name = 'mjml-rest-client-release'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/atrujillofalcon/mjml-rest-client.git'
}
}
release {
failOnCommitNeeded = true
failOnPublishNeeded = true
failOnSnapshotDependencies = true
failOnUnversionedFiles = false
failOnUpdateNeeded = true
revertOnFail = true
preCommitText = ''
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
tagTemplate = '${version}'
versionPropertyFile = 'gradle.properties'
scmAdapters = [
GitAdapter,
]
git {
requireBranch = 'develop'
pushToRemote = 'origin'
pushToBranchPrefix = ''
commitVersionFileOnly = false
}
}
afterReleaseBuild.dependsOn bintrayUpload
preTagCommit.doFirst {
// Maven
ant.replaceregexp(match: '<version>(\\d)+.(\\d)+.(\\d)+(-SNAPSHOT)?<\\/version>', replace: "<version>${version}</version>", flags: 'g', byline: true) {
fileset(dir: '.', includes: 'README.md')
}
// Gradle
ant.replaceregexp(match: 'es\\.atrujillo\\.mjml\\:mjml-rest-client\\:(\\d)+.(\\d)+.(\\d)+(-SNAPSHOT)?', replace: "es.atrujillo.mjml:mjml-rest-client:${version}", flags: 'g', byline: true) {
fileset(dir: '.', includes: 'README.md')
}
}
artifacts {
archives sourcesJar
archives javadocJar
}