blob: b72e76635f7c7869350860c65fd22c39174c01a2 (
plain)
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
|
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.repositories
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
fun Project.repositories() {
repositories {
mavenCentral()
jcenter()
maven { url = uri("https://dl.bintray.com/kotlin/kotlin-eap") }
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
maven { url = uri("https://dl.bintray.com/kotlin/kotlin-js-wrappers") }
maven {
url = uri("https://dl.bintray.com/gbaldeck/kotlin")
metadataSources {
mavenPom()
artifact()
}
}
maven { url = uri("https://dl.bintray.com/rjaros/kotlin") }
mavenLocal()
}
}
fun KotlinJsProjectExtension.kotlinJsTargets() {
target {
val isProductionBuild = project.extra.get("production") as Boolean
kotlinJsTargets(isProductionBuild)
}
}
fun KotlinMultiplatformExtension.kotlinJsTargets() {
js {
val isProductionBuild = project.extra.get("production") as Boolean
kotlinJsTargets(isProductionBuild)
}
}
private fun KotlinJsTarget.kotlinJsTargets(isProductionBuild: Boolean) {
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMap = !isProductionBuild
if (!isProductionBuild) {
sourceMapEmbedSources = "always"
}
}
}
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
}
fun KotlinMultiplatformExtension.kotlinJvmTargets() {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
}
}
fun MavenPom.defaultPom() {
name.set("KVision")
description.set("Object oriented web framework for Kotlin/JS")
url.set("https://github.com/rjaros/kvision")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("rjaros")
name.set("Robert Jaros")
organization.set("Treksoft")
organizationUrl.set("http://www.treksoft.pl")
}
}
scm {
url.set("https://github.com/rjaros/kvision.git")
connection.set("scm:git:git://github.com/rjaros/kvision.git")
developerConnection.set("scm:git:git://github.com/rjaros/kvision.git")
}
}
fun Project.setupPublication() {
plugins.apply("maven-publish")
extensions.getByType<PublishingExtension>().run {
publications.withType<MavenPublication>().all {
pom {
defaultPom()
}
}
repositories {
maven {
url = uri("https://api.bintray.com/maven/rjaros/kotlin/${project.name}/;publish=0;override=1")
credentials {
username = findProperty("buser")?.toString()
password = findProperty("bkey")?.toString()
}
}
}
}
}
|