-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
155 lines (137 loc) · 4.74 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
153
154
155
import java.util.Date
val LIBRARY_VERSION_NAME = "1.0.0"
val GROUP_ID = "com.github.marifeta"
val ARTIFACT_ID = rootProject.name
val BINTRAY_REPOSITORY = "generic"
val BINTRAY_ORGINIZATION = "murphy"
val KOTLINX_SERIALIZATION_CORE = "1.0.0-RC"
val KOTLINX_DATETIME = "0.1.0"
val SHORT_DESC = """
Validator for kotlin json serialization.
""".trimIndent()
val VCS_URL = "https://github.com/marifeta/kvalidator.git"
val WEBSITE_URL = "https://github.com/marifeta/kvalidator"
val ISSUE_TRACKER_URL = "https://github.com/marifeta/kvalidator/issues"
val CONTACT_EMAIL = "[email protected]"
buildscript {
repositories { jcenter() }
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.4.0")
}
}
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Kotlin library project to get you started.
*/
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.4.0"
id("maven-publish")
id("com.jfrog.bintray") version "1.8.4"
}
apply(plugin = "kotlinx-serialization")
group = GROUP_ID
version = LIBRARY_VERSION_NAME
tasks.bintrayUpload {
dependsOn("publishToMavenLocal")
}
tasks.register<Jar>("sourcesAll") {
from(sourceSets.main.get().allSource)
archiveClassifier.set("sources")
}
tasks.withType<GenerateMavenPom>().configureEach {
val matcher = Regex("""generatePomFileFor(\w+)Publication""").matchEntire(name)
val publicationName = matcher?.let { it.groupValues[1] }
destination = file("$buildDir/poms/$publicationName-pom.xml")
}
tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
from("$rootDir/README.md")
}
fun printResults(desc: TestDescriptor, result: TestResult) {
if (desc.parent != null) {
val output = result.run {
"Results: $resultType (" +
"$testCount tests, " +
"$successfulTestCount successes, " +
"$failedTestCount failures, " +
"$skippedTestCount skipped" +
")"
}
val testResultLine = "| $output |"
val repeatLength = testResultLine.length
val seperationLine = "-".repeat(repeatLength)
println(seperationLine)
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks["sourcesAll"])
artifact(tasks["javadocJar"])
pom {
name.set(provider { "$GROUP_ID:$ARTIFACT_ID" })
description.set(provider { project.description ?: SHORT_DESC })
url.set(VCS_URL)
developers {
developer {
name.set(BINTRAY_ORGINIZATION)
email.set(CONTACT_EMAIL)
}
}
scm {
connection.set(VCS_URL)
developerConnection.set(VCS_URL)
url.set(ISSUE_TRACKER_URL)
}
licenses {
license {
name.set("MIT License")
url.set("http://www.opensource.org/licenses/mit-license.php")
}
}
}
}
}
}
bintray {
user = if(project.hasProperty("user_name")) project.property("user_name").toString() else ""
key = if(project.hasProperty("apikey")) project.property("apikey").toString() else ""
publish = true
override = false
setPublications("mavenJava")
pkg.apply {
repo = BINTRAY_REPOSITORY
name = ARTIFACT_ID
userOrg = BINTRAY_ORGINIZATION
desc = SHORT_DESC
setLicenses("MIT")
version.apply {
name = LIBRARY_VERSION_NAME
vcsTag = LIBRARY_VERSION_NAME
released = Date().toString()
}
vcsUrl = VCS_URL
websiteUrl = WEBSITE_URL
issueTrackerUrl = ISSUE_TRACKER_URL
setLabels("kotlin", "kvalidator", "serialization", "jvm", "validator")
}
}
repositories {
jcenter()
maven(url = "https://kotlin.bintray.com/kotlinx/") // soon will be just jcenter()
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
// components
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$KOTLINX_SERIALIZATION_CORE")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:$KOTLINX_DATETIME")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}