-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
75 lines (64 loc) · 1.87 KB
/
build.gradle
File metadata and controls
75 lines (64 loc) · 1.87 KB
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
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
group = 'io.github.pmctools.umbj'
version = '0.1'
java {
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
withSourcesJar()
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.apache.commons:commons-compress:1.26.1'
implementation 'it.unimi.dsi:fastutil:8.5.13'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.tukaani:xz:1.10'
}
// Demo code
sourceSets {
demo {
java.srcDir 'src/demo/java'
compileClasspath += sourceSets.main.output + configurations.compileClasspath
runtimeClasspath += sourceSets.main.output + configurations.runtimeClasspath
}
}
// This allows you to add dependencies JUST for the demo
configurations {
demoImplementation.extendsFrom implementation
demoRuntimeOnly.extendsFrom runtimeOnly
}
// gradle packageLibrary packages both umbj and dependency jars
tasks.register('packageLibrary', Copy) {
dependsOn build
// Get external dependencies
from configurations.runtimeClasspath
// Get library and source jar
from layout.buildDirectory.dir('libs')
into 'dist'
}
// gradle fatJar builds a fat JAR
tasks.register('fatJar', Jar) {
// Call the file umbj-x.y-all.jar
archiveClassifier = 'all'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Main-Class': 'your.package.Main'
}
from sourceSets.main.output
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
// Run the demo code
task runDemo(type: JavaExec) {
mainClass = 'Demo'
classpath = sourceSets.demo.runtimeClasspath
}
tasks.withType(Javadoc) {
options.addBooleanOption('html5', true) // Modern HTML5 output
options.addStringOption('Xdoclint:none', '-quiet') // Suppress minor lint warnings
}