-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (145 loc) · 5.06 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
buildscript {
def config = new Properties()
file('build.properties').withInputStream(config.&load)
project.ext.config = config
project.ext.buildDate = new Date()
project.ext.docsDir = System.properties['publishDocs.root']
repositories {
mavenCentral()
google()
}
dependencies {
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: config.kotlin_version
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven-publish'
archivesBaseName = config.project_id
group = config.project_group
version = "${config.project_version}.${(System.getenv("CI_PIPELINE_IID") ?: 0)}"
sourceCompatibility = config.java_version
targetCompatibility = config.java_version
sourceSets {
main {
java { srcDirs = ['src/main/java'] }
kotlin { srcDirs = ['src/main/java', 'src/main/kotlin'] }
}
test {
java { srcDirs = ['src/test/java'] }
kotlin { srcDirs = ['src/test/java', 'src/test/kotlin'] }
}
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation group: 'org.jetbrains', name: 'annotations', version: config.annotations_version
implementation group: 'org.apiguardian', name: 'apiguardian-api', version: config.apiguard_version
implementation group: 'org.jetbrains', name: 'annotations', version: config.annotations_version
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: config.kotlin_version
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: config.kotlin_version
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: config.junit_version
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: config.junit_version
}
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
sourceCompatibility = config.java_version
targetCompatibility = config.java_version
}
jar {
manifest {
attributes([
"Specification-Title" : config.project_id,
"Specification-Vendor" : "Karma Krafts",
"Specification-Version" : project.version,
"Implementation-Title" : config.project_id,
"Implementation-Version" : project.version,
"Implementation-Vendor" : "Karma Krafts",
"Implementation-Timestamp": buildDate.format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
if(docsDir != null) {
task publishDocs(type: Copy) {
dependsOn javadocJar
mustRunAfter javadocJar
from zipTree(file("${buildDir}/libs/${archivesBaseName}-${version}-javadoc.jar"))
into file(docsDir)
}
}
tasks.withType(Jar) {
from 'LICENSE'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType(Javadoc) {
options {
addStringOption('-no-frames')
}
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
publishing {
repositories {
if (System.getenv('MAVEN_PASSWORD')) {
maven {
url "https://nexus.covers1624.net/repository/karmakrafts-releases/"
credentials {
username 'kitsunealex'
password System.getenv('MAVEN_PASSWORD')
}
}
}
}
publications {
sliced(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
artifact jar
artifact sourcesJar
artifact javadocJar
pom {
name = archivesBaseName
description = archivesBaseName
//The publish plugin doesnt like GString's here apparently..
url = "https://git.karmakrafts.dev/kk/${config.project_id}".toString()
scm {
url = "https://git.karmakrafts.dev/kk/${config.project_id}".toString()
}
issueManagement {
system = 'gitlab'
url = "https://git.karmakrafts.dev/kk/${config.project_id}/issues".toString()
}
licenses {
license {
name = "The MIT License"
url = "https://git.karmakrafts.dev/kk/${config.project_id}/-/blob/master/LICENSE"
distribution = 'repo'
}
}
developers {
developer {
id = 'kitsunealex'
name = 'KitsuneAlex'
}
}
}
}
}
}