-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
75 lines (61 loc) · 2.19 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
import javax.naming.ConfigurationException
buildscript {
ext.kotlin_version = '1.2.20'
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
}
}
apply plugin: 'kotlin-platform-common'
apply from: 'dependencies.gradle'
/* Utility function. */
project.ext.fmtMods = { mods -> mods.collect { it.toString().substring(8) }.join(', ') }
project.ext.deriveDependencyNames = {
/* This function takes a subproject and finds the names of the same-platoform projects
* that it depends on, based on MODULE_DEPENDENCIES from `dependencies.gradle`.
* The purpose is to not define dependencies in platform modules. */
Project subProject ->
def tokens = subProject.name.tokenize('-')
def parent
def platform = tokens.last()
if (platform in ['jvm', 'js']) {
parent = project(':' + tokens.subList(0, tokens.size() - 1).join('-'))
} else {
parent = subProject
platform = null
}
if (!MODULE_DEPENDENCIES.containsKey(parent.name)) {
throw new ConfigurationException("`MODULE_DEPENDENCIES` in `dependencies.gradle` should " +
" have an entry for ${parent.name} that lists which modules it depends on")
}
def dependsOn = MODULE_DEPENDENCIES[parent.name]
if (platform == null) {
return [parent, dependsOn.collect { ":${it}" }]
} else {
return [parent, dependsOn.collect { ":${it}:${it}-${platform}" }]
}
}
/* All the projects (including this top-level one). */
allprojects {
group 'demo'
version '1.0.0'
repositories {
mavenCentral()
}
/* Javascript output directory. Actually only needed for the root project and javascript platform ones. */
ext.jsTargetDir = file("${project.buildDir.path}/js")
}
/* Platform and common configuration have their own files. */
apply from: 'platform_common.gradle'
apply from: 'platform_jvm.gradle'
apply from: 'platform_js.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '4.4.1'
}
dependencies {
compile project(":alpha")
}