-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
152 lines (137 loc) · 4.13 KB
/
build.gradle.kts
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
/*******************************************************************************
* Copyright (c) 2020 ArSysOp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
plugins {
java
jacoco
`maven-publish`
//id("ru.arsysop.liho.liho-gradle-plugin") version "0.1"
}
group = "ru.arsysop.liho"
version = "0.1"
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation("ru.arsysop.lang:lang:0.1")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.0")
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
java {
withJavadocJar()
withSourcesJar()
}
/*
liho {
root.set(project.file("src/main"))
strict.set(true)
report.set(project.file("$buildDir/liho/report.txt"))
}
*/
tasks.withType(Test::class) {
useJUnitPlatform()
finalizedBy("jacocoTestReport")
}
jacoco {
toolVersion = "0.8.5"
}
tasks.jacocoTestReport {
reports {
csv.isEnabled = false
html.isEnabled = false
xml.isEnabled = true
xml.destination = file("${buildDir}/test-coverage.xml")
}
}
tasks.jar {
extendManifest(manifest)
}
tasks.withType(Jar::class) {
extendManifestShort(manifest)
from("README.md", "LICENSE")
}
tasks.getByName("sourcesJar") {
(this as Jar).from(sourceSets["test"].allSource)
}
fun extendManifest(mf: Manifest) {
val bundle: String by project
val copyright: String by project
mf.attributes(
"Bundle-Vendor" to "ArSysOp",
"Bundle-Name" to bundle,
"Bundle-SymbolicName" to "ru.arsysop.liho",
"Bundle-Version" to project.version,
"Automatic-Module-Name" to "ru.arsysop.liho",
"Bundle-ManifestVersion" to "2",
"Bundle-RequiredExecutionEnvironment" to "JavaSE-1.8",
"Bundle-Copyright" to copyright,
"Export-Package" to
listOf("ru.arsysop.liho.report", "ru.arsysop.liho.bulk")
.map { it + ";version=${project.version}" }
.joinToString(", ")
)
}
fun extendManifestShort(mf: Manifest) {
mf.attributes(
"Group" to project.group,
"Artifact" to project.name,
"Version" to project.version
)
}
publishing {
publications {
repositories {
maven {
url = uri("$buildDir/local-repo")
}
}
register<MavenPublication>("gpr") {
from(components["java"])
pom {
name.set(project.name)
val explanation: String by project
description.set(explanation)
url.set("https://github.com/ArSysOp/liho")
licenses {
license {
name.set("Apache 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0")
}
}
developers {
developer {
id.set("eparovyhsnaya")
name.set("Elena Parovyshnaia")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/arsysop/liho.git")
developerConnection.set("scm:git:ssh://github.com/arsysop/liho.git")
url.set("https://github.com/arsysop/liho")
}
}
}
}
}