-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
206 lines (174 loc) · 5.46 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
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id "com.jfrog.bintray" version "1.7"
}
ext {
ARTIFACT_ID = 'dokument-validate'
VERSION_NAME = System.getenv("CURRENT_VERSION")?.replace("v", "") ?: "DEVELOPMENT"
VERSION_CODE = 3 //your version
DESCRIPTION = 'First release on JCenter'
SITE_URL = 'https://github.com/r2a-engineering/dokument-validate'
GIT_URL = 'https://github.com/r2a-engineering/dokument-validate.git'
GROUP_NAME = 'br.eng.r2a.dokument'
MODULE_NAME = 'Dokument Validator'
LICENSE = 'MIT'
DEVELOPER_ID = 'arieldossantos'
DEVELOPER_NAME = 'Ariel Reis'
DEVELOPER_EMAIL = 'reis.ariel@outlook.com'
IS_UPLOADING = project.getGradle().startParameter.taskNames.any{it.contains('bintrayUpload')}
}
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'com.jfrog.bintray'
group 'br.eng.r2a.dokument'
version {VERSION_NAME}
bintray {
user = 'arieldossantos'
key = System.getenv("MAVEN_KEY") ?: "DEVELOPMENT"
publications = ['mavenJava']
dryRun = false
publish = true
override = false
pkg {
repo = 'dokument-validator'
name = 'dokument-validate'
userOrg = 'r2a-engineering'
licenses = ['MIT']
vcsUrl = 'https://github.com/r2a-engineering/dokument-validate.git'
version {
name = VERSION_NAME
desc = DESCRIPTION
vcsTag = VERSION_NAME
}
}
}
sourceCompatibility = 1.8
compileKotlin { kotlinOptions.jvmTarget = "1.8" }
compileTestKotlin { kotlinOptions.jvmTarget = "1.8" }
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
testImplementation "io.mockk:mockk:1.10.2"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.4.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.4.2"
}
test {
useJUnitPlatform()
}
def pomConfig = {
licenses {
license {
name "The MIT License"
url "https://github.com/r2a-engineering/dokument-validate/blob/main/LICENSE"
distribution "repo"
}
}
developers {
developer {
id "arieldossantos"
name "Ariel Reis"
email "reis.ariel@outlook.com"
}
}
scm {
url "https://dokument-validate.r2a.eng.br"
}
}
task('sourcesJar', type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
//javadoc
from javadoc.destinationDir
archiveClassifier.set("javadoc")
}
// Create the publication with the pom configuration:
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId 'br.eng.r2a.dokument'
artifactId 'core'
version VERSION_NAME
pom.withXml {
def root = asNode()
root.appendNode('description', 'Dokument Validate')
root.appendNode('name', 'Dokument Validator')
root.appendNode('url', 'https://dokument-validate.r2a.eng.br')
root.children().last() + pomConfig
}
}
}
}
subprojects {
group = GROUP_NAME
version = VERSION
if (IS_UPLOADING && project.name in [MODULE_NAME]) {
println project.name
apply plugin: 'maven'
gradle.taskGraph.whenReady { taskGraph ->
taskGraph.getAllTasks().find {
it.path == ":$project.name:generatePomFileForMavenPublication"
}.doLast {
file("build/publications/maven/pom-default.xml").delete()
println 'Overriding pom-file to make sure we can sync to maven central!'
pom {
//noinspection GroovyAssignabilityCheck
project {
name "$project.name"
artifactId ARTIFACT_ID
packaging project.name == 'compiler' ? 'jar' : 'aar'
description DESCRIPTION
url SITE_URL
version VERSION_NAME
scm {
url GIT_URL
connection GIT_URL
developerConnection GIT_URL
}
licenses {
license {
name LICENSE
}
}
developers {
developer {
id DEVELOPER_ID
name DEVELOPER_NAME
email DEVELOPER_EMAIL
}
}
}
}.writeTo("build/publications/maven/pom-default.xml")
}
}
}
}
check.dependsOn jacocoTestReport