-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
80 lines (66 loc) · 1.82 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
plugins {
id "com.palantir.git-version" version "0.13.0"
}
def versionLabel(gitInfo) {
def branch = gitInfo.branchName // all branches are snapshots, only tags get released
def tag = gitInfo.lastTag
// tag is returned as is. Branch may need cleanup
return branch == null ? tag : branch.replace("/","-") + "-SNAPSHOT"
}
subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
version = versionLabel(versionDetails())
group = "mil.army.usace.hec"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
repositories {
mavenCentral()
maven {
url = uri('https://repo.maven.apache.org/maven2')
}
maven {
url = uri('https://www.hec.usace.army.mil/nexus/repository/maven-public')
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
checkstyle {
toolVersion '9.0.1'
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
dependsOn test
reports {
csv.required = true
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}
build {
finalizedBy publishToMavenLocal
}
publishing {
repositories {
maven {
def repositoryUrl = System.getenv("DEPLOY_URL")
url = version.endsWith("SNAPSHOT") ? repositoryUrl + "/github-snapshots" : repositoryUrl + "/github-releases"
credentials {
username System.getenv("DEPLOY_USER")
password System.getenv("DEPLOY_PASSWORD")
}
}
}
}
}