forked from Kotlin/kotlin-jupyter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
88 lines (73 loc) · 2.7 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
buildscript {
ext.shadowJarVersion = "1.2.3"
ext.kotlinVersion = '1.1-M04'
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' }
// 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.2.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 "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-script-util:$kotlinVersion"
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.zeromq:jeromq:0.3.5'
compile 'com.beust:klaxon:0.24'
compile 'com.jcabi:jcabi-aether:0.10.1'
runtime 'org.sonatype.aether:aether-api:1.13.1'
runtime 'org.apache.maven:maven-core:3.0.3'
runtime 'org.slf4j:slf4j-simple:1.7.21'
deploy "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
jar.manifest.attributes(
'Main-class': 'org.jetbrains.kotlin.jupyter.IkotlinKt',
'Implementation-Version': version
)
shadowJar {
baseName = 'kotlin-jupyter-kernel'
classifier = ''
mergeServiceFiles()
}
task installKernel(type: Copy, dependsOn: shadowJar) {
from shadowJar.outputs
into installPath
}
task installLibs(type: Copy) {
from configurations.deploy
into "$installPath/lib"
}
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/lib/${it.name}" } .join(File.pathSeparator)
spec = spec.replace("\${RUNTIME_CLASSPATH}", libsCp)
new File( "$installPath/kernel.json" ).write( spec, 'UTF-8' )
}
task install(dependsOn: [installKernel, installLibs, createSpecs])