forked from Kotlin/kotlin-jupyter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
111 lines (91 loc) · 3.23 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
buildscript {
ext.shadowJarVersion = "1.2.3"
ext.kotlinVersion = '1.1.0-beta-38'
ext.keplinVersion = '1.0.0-ALPHA-40'
repositories {
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
// only when using Kotlin DEV releases ...
// maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.github.jengelman.gradle.plugins:shadow:$shadowJarVersion"
}
}
allprojects {
apply plugin: 'kotlin'
repositories {
jcenter()
mavenCentral()
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' }
maven { url 'http://dl.bintray.com/jaysonminard/kohesive' }
// only when using Kotlin DEV releases ...
// maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
testCompile 'junit:junit:4.12'
}
version = '0.4.0'
ext.installPath = project.hasProperty('installPath') ? project.getProperty('installPath') : "${System.properties['user.home']}/.ipython/kernels/kotlin"
}
apply plugin: 'com.github.johnrengelman.shadow'
configurations {
deploy
}
dependencies {
compile project(":jupyter-lib")
compile "uy.kohesive.keplin:keplin-core:$keplinVersion"
compile "uy.kohesive.keplin:keplin-maven-resolver:$keplinVersion"
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.zeromq:jeromq:0.3.5'
compile 'com.beust:klaxon:0.24'
runtime 'org.slf4j:slf4j-simple:1.7.21'
shadow "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
shadow "org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion"
shadow project(":jupyter-lib")
deploy "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
deploy project(":jupyter-lib")
}
jar.manifest.attributes(
'Main-class': 'org.jetbrains.kotlin.jupyter.IkotlinKt',
'Implementation-Version': version
)
tasks.withType(AbstractCompile) {
classpath += configurations.shadow
}
shadowJar {
baseName = 'kotlin-jupyter-kernel'
classifier = ''
mergeServiceFiles()
dependencies {
exclude(dependency("org.jetbrains.kotlin:.*:.*"))
}
}
task installKernel(type: Copy, dependsOn: shadowJar) {
from shadowJar.outputs
into installPath
}
task installDeployLibs(type: Copy) {
from configurations.deploy
into "$installPath"
}
task installLibs(type: Copy) {
from configurations.shadow
into "$installPath"
}
task createSpecs(dependsOn: [installKernel, installLibs]) {
String spec = new File('kernelspec/kernel.json.template').getText('UTF-8')
File kernelFile = files { shadowJar }.singleFile
spec = spec.replace("\${KERNEL_JAR_PATH}", "$installPath/${kernelFile.name}")
String libsCp = files { configurations.deploy }.files.collect { "$installPath/${it.name}" } .join(File.pathSeparator)
spec = spec.replace("\${RUNTIME_CLASSPATH}", libsCp)
File installDir = new File("$installPath")
if(!installDir.exists()) {
installDir.mkdirs();
}
new File( "$installPath/kernel.json" ).write( spec, 'UTF-8' )
}
task install(dependsOn: [installKernel, installLibs, createSpecs])