-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.gradle
136 lines (116 loc) · 3.48 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
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jmailen.gradle:kotlinter-gradle:$kotlinLinterVer"
}
}
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm' version "$kotlinVer"
id 'org.jmailen.kotlinter' version "$kotlinLinterVer"
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'org.sonarqube' version "5.1.0.4882"
id 'jacoco'
}
allprojects {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jmailen.kotlinter'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'jacoco'
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "iroha2-java-soramitsu"
url = "https://nexus.iroha.tech/repository/maven-soramitsu/"
credentials {
username = System.getenv("NEXUS_USER")
password = System.getenv("NEXUS_PASS")
}
}
}
}
group = 'jp.co.soramitsu.iroha2-java'
version = 'git rev-parse --short HEAD'.execute().text.trim()
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
withJavadocJar()
withSourcesJar()
}
artifacts {
archives javadocJar
archives sourcesJar
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
}
}
kotlinter {
ignoreFailures = false
reporters = ['checkstyle', 'plain']
}
shadowJar {
zip64 = true
archiveFileName = "${archiveBaseName.get()}-${archiveVersion.get()}.jar"
}
// uncomment to produce shadowJar build by default
// it is disabled by default to publish original version by CI, not a fat jar
tasks.shadowJar.enabled = false
test {
useJUnitPlatform()
}
jacocoTestReport {
reports {
xml.required = true
}
}
plugins.withType(JacocoPlugin) {
tasks["test"].finalizedBy 'jacocoTestReport'
}
sonar {
properties {
property "sonar.projectKey", "iroha-java"
property "sonar.host.url", "https://sonar.katana.soramitsu.co.jp"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.projectName", "${project.group}:${rootProject.name}.${project.name}"
property "sonar.sources", "${project.projectDir}/src/main/kotlin"
// exclude projects with no tests
if (project.name != "codegen" && project.name != "model" && project.name != "tutorial") {
property "sonar.tests", "${project.projectDir}/src/test"
}
property "sonar.java.test.binaries", "${project.projectDir}/build/test-results/test/binary"
property "sonar.junit.reportPaths", "${project.projectDir}/build/test-results/test/"
}
}
}
task allShadowJars {
subprojects { pr -> allShadowJars.dependsOn("${pr.path}:shadowJar") }
}
check {
dependsOn "installKotlinterPrePushHook"
}