-
Notifications
You must be signed in to change notification settings - Fork 218
/
Copy pathbuild.gradle
153 lines (127 loc) · 5.09 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
plugins {
id 'java'
id 'maven-publish'
id('com.github.hierynomus.license') version '0.14.0'
id('io.github.spencerpark.jupyter-kernel-installer') version '2.1.0'
id('com.github.jk1.dependency-license-report')
}
import org.apache.tools.ant.filters.ReplaceTokens
import com.github.jk1.license.render.*
import com.github.jk1.license.filter.*
import io.github.spencerpark.gradle.*
group = 'io.github.spencerpark'
version = '1.3.0'
wrapper {
gradleVersion = '4.8.1'
distributionType = Wrapper.DistributionType.ALL
}
// Add the license header to source files
license {
header = file('LICENSE')
exclude '**/*.json'
mapping {
// Use a regular multiline comment rather than a javadoc comment
java = 'SLASHSTAR_STYLE'
}
}
build.dependsOn 'licenseFormat'
// Configures the license report generated for the dependencies.
licenseReport {
excludeGroups = []
renderers = [
// Generate a pretty HTML report that groups dependencies by their license.
new NewInventoryHtmlReportRenderer('dependencies.html'),
// TODO make sure ci verifies that all licenses are know to be allowed to redistribute before publishing
new JsonReportRenderer('dependencies.json')
]
// Group same licenses despite names being slightly different (ex. Apache 2.0 vs Apache version 2)
filters = [new LicenseBundleNormalizer()]
configurations = ['compile']
}
compileJava {
sourceCompatibility = 1.9
targetCompatibility = 1.9
}
configurations {
shade
// transitive true to make sure that the dependencies of shade dependencies also get shaded
// into the jar
shade.transitive = true
compile.extendsFrom(shade)
}
repositories {
mavenCentral()
maven {
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
mavenLocal()
}
dependencies {
shade group: 'io.github.spencerpark', name: 'jupyter-jvm-basekernel', version: '2.3.0'
shade group: 'org.apache.ivy', name: 'ivy', version: '2.5.0-rc1'
//shade group: 'org.apache.maven', name: 'maven-settings-builder', version: '3.6.0'
shade group: 'org.apache.maven', name: 'maven-model-builder', version: '3.6.0'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
jar {
//Include all shaded dependencies in the jar
from configurations.shade
.collect { it.isDirectory() ? it : zipTree(it) }
manifest {
attributes('Main-class': 'io.github.spencerpark.ijava.IJava')
}
}
processResources {
def tokens = [
'version': project.version,
'project': project.name
]
inputs.properties(tokens)
filter ReplaceTokens, tokens: tokens
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
jupyter {
kernelName = 'java'
kernelDisplayName = 'Java'
kernelLanguage = 'java'
kernelInterruptMode = 'message'
kernelParameters {
list('classpath', 'IJAVA_CLASSPATH') {
separator = PATH_SEPARATOR
description = '''A file path separator delimited list of classpath entries that should be available to the user code. **Important:** no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob.'''
}
list('comp-opts', 'IJAVA_COMPILER_OPTS') {
separator = ' '
description = '''A space delimited list of command line options that would be passed to the `javac` command when compiling a project. For example `-parameters` to enable retaining parameter names for reflection.'''
}
list('startup-scripts-path', 'IJAVA_STARTUP_SCRIPTS_PATH') {
separator = PATH_SEPARATOR
description = '''A file path seperator delimited list of `.jshell` scripts to run on startup. This includes ijava-jshell-init.jshell and ijava-display-init.jshell. **Important:** no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob.'''
}
string('startup-script', 'IJAVA_STARTUP_SCRIPT') {
description = '''A block of java code to run when the kernel starts up. This may be something like `import my.utils;` to setup some default imports or even `void sleep(long time) { try {Thread.sleep(time); } catch (InterruptedException e) { throw new RuntimeException(e); }}` to declare a default utility method to use in the notebook.'''
}
string('timeout', 'IJAVA_TIMEOUT') {
aliases NO_TIMEOUT: '-1'
description = '''A duration specifying a timeout (in milliseconds by default) for a _single top level statement_. If less than `1` then there is no timeout. If desired a time may be specified with a `TimeUnit` may be given following the duration number (ex `"30 SECONDS"`).'''
}
}
}
installKernel {
kernelInstallPath = commandLineSpecifiedPath(userInstallPath)
}
zipKernel {
installers {
with 'python'
}
from(generateLicenseReport.outputFolder) {
into 'dependency-licenses'
}
}
zipKernel.dependsOn 'generateLicenseReport'