This repository was archived by the owner on Mar 21, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
187 lines (163 loc) · 5.75 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
/*
* This file belongs to the source code of: kLib
*
* Copyright© 2015-2022 Thomas Obernosterer, ATVG-Studios
* Copyright© 2019-2022 all kLib Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
plugins {
id 'com.github.johnrengelman.shadow' version "$shadow_version"
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version"
id 'org.jetbrains.dokka' version "$dokka_version"
id "org.jmailen.kotlinter" version "$kotlinter_version"
id "io.gitlab.arturbosch.detekt" version "$detekt_version"
id 'org.barfuin.gradle.jacocolog' version "$jacocolog_version"
id 'maven-publish'
id 'signing'
id 'jacoco'
}
group 'klib'
version "$klib_version"
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
dokkaHtmlPlugin "org.jetbrains.dokka:kotlin-as-java-plugin:$dokka_version"
implementation "net.jemzart:jsonkraken:$jsonkraken_version"
implementation "joda-time:joda-time:$jodatime_version"
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
}
tasks.detekt.jvmTarget = "1.8"
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
wrapper {
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip"
}
detekt {
failFast = false // disable fast failing so it continues till the end
ignoreFailures = true // ignore all failures, just do the scan and dont break the build
buildUponDefaultConfig = true // use default configuration
// Enable HTML and TEXT outputs; Disable XML
reports {
html.enabled = true
xml.enabled = false
txt.enabled = true
}
}
jar {
manifest {
attributes 'Specification-Title': "kLib"
attributes 'Specification-Version': "20"
attributes 'Specification-Vendor': "ATVG-Studios"
attributes 'Implementation-Title': "kLib"
attributes 'Implementation-Version': "$klib_version"
attributes 'Implementation-Vendor': "ATVG-Studios"
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn", "-Xuse-experimental=kotlin.Experimental"]
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
test {
finalizedBy jacocoTestReport
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
html.enabled true
}
}
check.dependsOn jacocoTestReport
def buildEnvironment = System.getenv("BUILD_ENVIRONMENT")
def buildEnvGitlab = "Gitlab-CI"
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenKotlin(MavenPublication) {
groupId = 'com.atvgstudios'
artifactId = 'klib'
version = "$klib_version"
from components.java
pom {
name = 'kLib'
description = 'kLib is a Generic Kotlin Library to simplify development'
url = 'https://gitlab.atvg-studios.atvg.cloud/atvg-studios/kLib'
licenses {
license {
name = 'OSPL20'
url = 'https://gitlab.atvg-studios.atvg.cloud/atvg-studios/kLib/blob/master/LICENSE'
}
}
developers {
developer {
id = 'atjontv'
name = 'Thomas Obernosterer'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://gitlab.atvg-studios.atvg.cloud/atvg-studios/kLib.git'
developerConnection = 'scm:git:ssh://gitlab.atvg-studios.atvg.cloud/atvg-studios/kLib.git'
url = 'https://gitlab.atvg-studios.atvg.cloud/atvg-studios/kLib.git'
}
}
}
}
repositories {
if(buildEnvironment == buildEnvGitlab) {
maven {
url "https://gitlab.atvg-studios.atvg.cloud/api/v4/projects/123/packages/maven"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header HttpHeaderAuthentication
}
}
maven {
url "https://gitlab.atvg-studios.atvg.cloud/api/v4/projects/121/packages/maven"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header HttpHeaderAuthentication
}
}
} else {
maven {
def releaseUrl = '/data/atjontv/git/maven-repo'
def snapshotUrl = '/data/atjontv/git/maven-repo/snapshots'
url = (version.contains('dev') || version.contains('rc')) ? snapshotUrl : releaseUrl
}
}
}
}
if(buildEnvironment != buildEnvGitlab) {
signing {
useGpgCmd()
sign publishing.publications.mavenKotlin
}
}