-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
129 lines (106 loc) · 3.22 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
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.0'
id 'io.spring.dependency-management' version '1.1.6'
id 'com.diffplug.spotless' version '7.0.2'
}
// JAR
group = 'tools.sctrade'
version = '1.1.0'
java {
sourceCompatibility = '21'
}
// Depedencies
repositories {
mavenCentral()
}
dependencies {
// Spring boot
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
// Keybinds
implementation 'com.1stleg:jnativehook:2.1.0'
// GUI look and feel
implementation 'com.formdev:flatlaf:3.5.2'
implementation 'com.formdev:flatlaf-intellij-themes:3.5.2'
// OCR
implementation 'net.sourceforge.tess4j:tess4j:5.13.0'
implementation 'org.openpnp:opencv:4.9.0-0'
// Utils
implementation 'org.imgscalr:imgscalr-lib:4.2'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'commons-io:commons-io:2.18.0'
implementation 'com.opencsv:opencsv:5.9'
// Tests
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
configurations.all {
exclude group: "commons-logging", module: "commons-logging"
}
// Misc
tasks.named('test') {
useJUnitPlatform()
}
springBoot {
buildInfo()
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
// Code formatting
spotless {
java {
// Import order
importOrderFile('contributing/companion.importorder')
removeUnusedImports()
// Code style
eclipse().configFile('contributing/GoogleStyle.xml')
formatAnnotations()
}
}
// Distribution-specific tasks
def dependenciesDir = "$buildDir/dependencies"
def distributionDir = "$buildDir/SC Trade Companion"
def binariesDir = "$distributionDir/bin"
task copyDependencies(type: Copy, dependsOn: 'build') {
from configurations.runtimeClasspath
into dependenciesDir
}
task jdeps(dependsOn: 'copyDependencies') {
doLast {
exec {
def jdeps = new ByteArrayOutputStream()
commandLine 'jdeps', '--class-path', '"build/dependencies/*"', '--multi-release', 'base', '--ignore-missing-deps', '-recursive', '--print-module-deps', "$buildDir/libs/${rootProject.name}-${version}.jar" // TODO append jdk.crypto.ec
standardOutput = jdeps
ext.jdeps = jdeps
}
}
}
task jlink(dependsOn: 'jdeps') {
doLast {
exec {
workingDir = projectDir
commandLine 'jlink', '--output', "$binariesDir/jre", '--add-modules', 'java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.net.http,java.prefs,java.scripting,java.sql,jdk.jfr,jdk.unsupported,jdk.crypto.ec' // TODO use "${tasks.jdeps.jdeps}"
}
}
}
task copyJar(type: Copy, dependsOn: 'build') {
from "$buildDir/libs"
into binariesDir
include "${rootProject.name}-${version}.jar"
rename "${rootProject.name}-${version}.jar", "${rootProject.name}.jar"
}
task copyTessdata(type: Copy) {
from "./bin/tessdata"
into "$binariesDir/tessdata"
}
task copyStartScript(type: Copy) {
from "./scripts"
into distributionDir
include "${rootProject.name}.bat"
include "${rootProject.name}-admin.bat"
}
task dist(dependsOn: ['copyJar', 'copyTessdata', 'copyStartScript', 'jlink']) {
}