-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
95 lines (72 loc) · 2.77 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
import org.jetbrains.kotlin.konan.target.HostManager
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlint_gradle_version"
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
}
}
ext.configuredVersion = project.hasProperty("releaseVersion") ? project.releaseVersion : project.version
ext.globalM2 = "$buildDir/m2"
ext.publishLocal = project.hasProperty("publishLocal")
def platforms = ["common", "jvm", "js", "posix", "darwin"]
def projectNeedsPlatform(project, platform) {
def files = project.projectDir.listFiles()
def hasPosix = files.any { it.name == "posix" }
def hasDarwin = files.any { it.name == "darwin" }
if (hasPosix && hasDarwin) return false
if (hasPosix && platform == "darwin") return false
if (hasDarwin && platform == "posix") return false
if (!hasPosix && !hasDarwin && platform == "darwin") return false
return files.any { it.name == "common" || it.name == platform }
}
allprojects {
group = "com.github.komputing.kbech32"
version = configuredVersion
project.ext.hostManager = new HostManager()
repositories {
jcenter()
}
apply plugin: "kotlin-multiplatform"
apply plugin: "org.jlleitschuh.gradle.ktlint"
apply from: rootProject.file("gradle/utility.gradle")
platforms.each { platform ->
if (projectNeedsPlatform(project, platform)) {
configure([it]) {
apply from: rootProject.file("gradle/${platform}.gradle")
}
}
}
apply from: rootProject.file('gradle/dokka.gradle')
apply from: rootProject.file('gradle/publish.gradle')
configurations { testOutput }
kotlin {
configure(sourceSets) {
def srcDir = name.endsWith("Main") ? "src" : "test"
def resourcesPrefix = name.endsWith("Test") ? "test-" : ""
def platform = name[0..-5]
kotlin.srcDirs = ["$platform/$srcDir"]
resources.srcDirs = ["$platform/${resourcesPrefix}resources"]
languageSettings {
progressiveMode = true
}
}
}
}
afterEvaluate {
def allCompileKotlinTasks = subprojects.collect {
it.hasProperty("compileKotlinJvm") ? [it.compileKotlinJvm] : []
}.flatten()
task dokkaWebsite(type: dokka.getClass()) {
outputFormat = 'kotlin-website'
outputDirectory = "${rootProject.projectDir}/apidoc"
kotlinTasks { allCompileKotlinTasks }
reportUndocumented = false
}
}