-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
127 lines (112 loc) · 3.33 KB
/
build.gradle.kts
File metadata and controls
127 lines (112 loc) · 3.33 KB
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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.3.70" apply (true)
id("org.jetbrains.dokka") version "0.10.1"
id("com.jfrog.bintray") version "1.8.4"
`maven-publish`
}
group = "org.mechdancer"
version = "0.2.8-snapshot-3"
repositories {
maven("https://maven.aliyun.com/repository/jcenter")
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation("junit", "junit", "+")
testImplementation(kotlin("test-junit"))
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-XXLanguage:+InlineClasses")
}
}
tasks.dokka {
outputFormat = "javadoc"
outputDirectory = "$buildDir/javadoc"
}
val doc = tasks.register<Jar>("javadocJar") {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
from(tasks.dokka)
}
val sources = tasks.register<Jar>("sourcesJar") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "Creates sources jar"
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val fat = tasks.register<Jar>("fatJar") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "Packs binary output with dependencies"
archiveClassifier.set("all")
from(sourceSets.main.get().output)
from({ configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) } })
}
tasks.register("allJars") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "Assembles all jars in one task"
dependsOn(doc, sources, fat, tasks.jar)
}
val rename = tasks.register("renamePomFile") {
dependsOn(tasks.publishToMavenLocal)
doLast {
val path = "${buildDir.absolutePath}/publications/maven/"
val old = File(path + "pom-default.xml")
val f = File("$path${project.name}-$version.pom")
old.renameTo(f)
}
}
tasks.bintrayUpload.configure {
dependsOn(rename)
}
bintray {
user = "berberman"
key = System.getenv("BintrayToken")
setConfigurations("archives")
val v = version.toString()
val url = "https://github.com/MechDancer/linearalgebra"
publish = true
pkg.apply {
name = project.name
desc = "linearalgebra kotlin utilities"
repo = "maven"
userOrg = "mechdancer"
githubRepo = "MechDancer/linearalgebra"
vcsUrl = "$url.git"
issueTrackerUrl = "$url/issues"
publicDownloadNumbers = true
setLicenses("WTFPL")
version.apply {
name = v
vcsTag = v
websiteUrl = "$url/releases/tag/$v"
}
}
}
publishing {
repositories {
maven("$buildDir/repo")
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/MechDancer/linearalgebra")
credentials {
username = "MechDancerProject"
password = System.getenv("GitHubToken")
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
artifacts {
add("archives", tasks.jar)
add("archives", fat)
add("archives", sources)
add("archives", doc)
add("archives", File("${buildDir.absolutePath}/publications/maven/${project.name}-$version.pom"))
}