forked from SpencerPark/IJava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
152 lines (127 loc) · 4.15 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
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.InventoryHtmlReportRenderer
import com.github.jk1.license.render.JsonReportRenderer
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java-library'
// id 'maven-publish' // use johnrengelman.shadow instead
id 'com.github.hierynomus.license' version '0.16.1'
id "com.github.jk1.dependency-license-report" version "2.1"
id 'com.github.johnrengelman.shadow' version '7.1.2'
// id 'io.github.spencerpark.jupyter-kernel-installer' version '2.1.0'
}
group = 'io.github.spencerpark'
version = '1.4.4'
repositories {
mavenLocal()
mavenCentral()
maven {
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
implementation('io.github.spencerpark:jupyter-jvm-basekernel:2.3.0') {
exclude group: 'com.google.code.gson', module: 'gson'
}
implementation 'com.google.code.gson:gson:2.10'
// ------ for maven resolve and download ------
// implementation 'org.apache.maven:maven-resolver-provider:4.0.0-alpha-2'
implementation('org.apache.maven:maven-resolver-provider:3.8.6') {
exclude group: 'org.apache.maven.resolver' // manual include 1.8.2
}
implementation 'org.apache.maven.resolver:maven-resolver-impl:1.8.2'
implementation 'org.apache.maven.resolver:maven-resolver-connector-basic:1.8.2'
implementation 'org.apache.maven.resolver:maven-resolver-transport-file:1.8.2'
implementation 'org.apache.maven.resolver:maven-resolver-transport-http:1.8.2'
implementation 'org.apache.maven.resolver:maven-resolver-transport-classpath:1.8.2'
// ------ for maven resolve and download ------
implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
}
// Add the license header to source files
license {
header = file('LICENSE')
include "**/*.java"
exclude "**/Test*.java"
mapping java: 'SLASHSTAR_STYLE'
ext.year = Calendar.getInstance().get(Calendar.YEAR)
}
licenseMain.dependsOn 'licenseFormat'
// replace @symbol@ in properties
processResources {
def tokens = [
'version': project.version,
'project': project.name
]
inputs.properties(tokens)
filter tokens: tokens, ReplaceTokens
}
//java {
// withJavadocJar()
// withSourcesJar()
//}
compileJava {
options.compilerArgs << '-parameters'
// ignore deprecation for jupyter-jvm-basekernel gson JsonParser api
// options.compilerArgs << '-Xlint:all' << '-Xlint:-deprecation' << '-Xlint:-rawtypes' << '-Xlint:-serial'
}
jar {
manifest {
attributes 'Main-class': 'io.github.spencerpark.ijava.IJava'
}
}
// shadow Jar config
shadowJar {
// inherit from the manifest of the standard jar task
// manifest {
// attributes 'Main-class': 'io.github.spencerpark.ijava.IJava'
// }
// copy build.gradle to shadowed jar
from("./") {
include 'build.gradle'
}
}
build.dependsOn 'shadowJar'
// publish
//publishing {
// publications {
// shadow(MavenPublication) { publication ->
// project.shadow.component(publication)
// }
// }
// repositories {
// maven {
// url "http://repo.myorg.com"
// }
// }
//}
// create license report
licenseReport {
renderers = [
new InventoryHtmlReportRenderer('license-report.html'),
new JsonReportRenderer('license-report.json')
]
filters = [new LicenseBundleNormalizer()]
}
// pack up
tasks.register('packDist', Zip) {
archiveFileName = project.name + "-latest.zip"
from(layout.buildDirectory.dir("resources/main")) {
include "install.py"
}
from(layout.buildDirectory.dir("libs")) {
include "*-all.jar"
into "java"
}
from(layout.buildDirectory.dir("resources/main")) {
include "kernel.json"
into "java"
}
from(layout.buildDirectory.dir("reports/dependency-license")) {
into "java/dependency-license"
}
dependsOn generateLicenseReport
dependsOn build
}
// execute task after build
//build.finalizedBy(packDist)