-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
146 lines (111 loc) · 3.17 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
// Common Build file for Generic Table
plugins {
id 'application'
id 'eclipse'
id 'org.openjfx.javafxplugin' version '0.1.0' apply false
//https://github.com/johnrengelman/shadow
// for creating fat jar.
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
apply plugin: 'java'
apply plugin: 'eclipse'
ext.jdkver = 21
ext.jarName = "tableApp"
project.version = '1.3.0.0'
ext.currentOS = org.gradle.internal.os.OperatingSystem.current()
ext.arch = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH)
repositories {
// Use 'mavenCentral' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenLocal()
mavenCentral()
}
sourceSets {
main {
java {
srcDirs= ["src/main/java"]
exclude '**/ignorecompile/**'
if (project.ext.jdkver == 1.8) {
exclude 'module-info.java'
}
destinationDirectory.set(file("${buildDir}/classes"))
}
resources {
srcDirs= ["src/main/java/"]
}
}
}
if (jdkver == 11) {
apply plugin: 'org.openjfx.javafxplugin'
javafx {
modules = [ 'javafx.controls','javafx.fxml' ]
version = "11.0.2"
}
}
if (jdkver == 17) {
apply plugin: 'org.openjfx.javafxplugin'
javafx {
modules = [ 'javafx.controls','javafx.fxml' ]
version = "17.0.2"
}
}
if (jdkver == 21) {
apply plugin: 'org.openjfx.javafxplugin'
javafx {
modules = [ 'javafx.controls','javafx.fxml' ]
// mac os 10.x doesnt support javafx version 21.
// so use 17.0.2 instead
version = (currentOS.isMacOsX() && arch == 'x86_64') ? "17.0.2" : "21.0.5"
}
}
compileJava {
sourceCompatibility = jdkver
targetCompatibility = jdkver
options.fork = true
}
// Dependencies
dependencies {
// controlsfx & jfoenix
if (jdkver == 1.8) {
implementation group: 'org.controlsfx', name: 'controlsfx', version: '8.40.18'
} else if (jdkver >= 11) {
implementation group: 'org.controlsfx', name: 'controlsfx', version: '11.2.0'
}
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
}
mainClassName = 'tableapp.Main'
task copyJars (type: Copy) {
def fromDir = "build/libs/"
def toDir = "./"
include jarName
// copy jars to lib folder:
from fromDir
into toDir
}
tasks.withType(JavaCompile) {
options.warnings = false
}
build.dependsOn copyJars
jar {
manifest {
attributes (
'Main-Class': 'tableapp.Main',
)
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
shadowJar {
archiveBaseName.set(jarName)
archiveClassifier.set('')
archiveVersion.set('')
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA','META-INF/LICENSE*','META-INF/NOTICE*'
}
// copy the final jar file into the root directory
task copyJar(type: Copy) {
dependsOn(shadowJar)
from shadowJar // here it automatically reads jar file produced from jar task
def toDir = project.projectDir
into toDir
}
build.finalizedBy copyJar
assemble.finalizedBy copyJar