-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
138 lines (121 loc) · 3.82 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
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
buildscript {
ext.kotlin_version = '1.3.0-rc-146'
ext.bintray_plugin_version = '1.8.4'
ext.node_version = '8.11.4'
ext.qunit_version = '2.6.2'
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url 'https://cache-redirector.jetbrains.com/maven-central'
}
maven {
url "http://dl.bintray.com/kotlin/kotlin-eap"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/kotlin/kotlin-eap"
}
}
}
apply plugin: 'kotlin-multiplatform'
kotlin {
targets {
fromPreset(presets.macosX64, 'macos')
fromPreset(presets.linuxX64, 'linux')
fromPreset(presets.mingwX64, 'windows')
fromPreset(presets.jvm, 'jvm')
fromPreset(presets.js, 'js') {
compilations.main {
compileKotlinJs.kotlinOptions {
sourceMap = true
metaInfo = true
moduleKind = 'umd'
}
compileTestKotlinJs.kotlinOptions {
moduleKind = 'commonjs'
}
}
}
}
}
dependencies {
commonMainImplementation 'org.jetbrains.kotlin:kotlin-stdlib'
commonTestImplementation 'org.jetbrains.kotlin:kotlin-test-common'
commonTestImplementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
jvmMainImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
jvmTestImplementation 'org.jetbrains.kotlin:kotlin-test'
jvmTestImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
jsMainImplementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
jsTestImplementation 'org.jetbrains.kotlin:kotlin-test-js'
}
// Publishing configuration
apply plugin: 'maven-publish'
apply from: file('publish.gradle')
group 'de.dbaelz.konclik'
version '0.6.0'
publishing {
repositories {
maven {
credentials {
username project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
password project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
}
url 'https://api.bintray.com/maven/dbaelz/Konclik/Konclik/'
}
}
configure(publications) {
generatePom(pom)
}
}
// Javascript test configuration
apply plugin: 'com.moowork.node'
node {
version = node_version
download = true
nodeModulesDir = file("$buildDir/yarn")
}
def jsCompilations = kotlin.targets.js.compilations
task populateNodeModules {
doLast {
copy {
from "$buildDir/yarn/node_modules"
from jsCompilations.main.output.first()
jsCompilations.test.runtimeDependencyFiles.each {
if (it.exists() && !it.isDirectory()) {
from zipTree(it.absolutePath).matching { include '*.js' }
}
}
into "$buildDir/node_modules"
}
}
}
task addYarnDeps(type: YarnTask) {
doFirst {
mkdir "$buildDir/yarn"
}
args = ["add", "qunit@$qunit_version"]
}
task runQunit(type: NodeTask, dependsOn: [jsCompilations.test.compileKotlinTaskName, addYarnDeps, populateNodeModules]) {
script = file("$buildDir/node_modules/qunit/bin/qunit")
args = [relativePath("${jsCompilations.test.output.first()}/konclik_test.js")]
}
jsTest.dependsOn runQunit
// Fix for https://github.com/srs/gradle-node-plugin/issues/301
repositories.whenObjectAdded {
if (it instanceof IvyArtifactRepository) {
metadataSources {
artifact()
}
}
}