-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathbuild.gradle
More file actions
77 lines (65 loc) · 1.97 KB
/
build.gradle
File metadata and controls
77 lines (65 loc) · 1.97 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
76
77
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
project.version = 'v1.2.2'
applicationName = 'RealmShark'
project.ext.lwjglVersion = "3.3.1"
project.ext.jomlVersion = "1.10.5"
switch (org.gradle.internal.os.OperatingSystem.current()) {
case org.gradle.internal.os.OperatingSystem.MAC_OS:
project.ext.lwjglNatives = "natives-macos"
break
case org.gradle.internal.os.OperatingSystem.WINDOWS:
project.ext.lwjglNatives = "natives-windows"
break
}
repositories {
mavenCentral()
maven {url="https://s01.oss.sonatype.org/content/repositories/snapshots/"}
}
dependencies {
implementation 'com.ardikars.pcap:pcap-spi:1.4.2'
implementation 'com.ardikars.pcap:pcap-jdk7:1.4.2'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.google.flatbuffers:flatbuffers-java:23.5.26'
}
mainClassName = applicationName.toLowerCase() + '.' + applicationName
jar {
manifest {
attributes(
'Main-Class': mainClassName
)
}
}
// Ugly solution to get version into source.
task generateSources {
doFirst {
def srcFile = new File(file("$buildDir/../src/main/java/" + applicationName.toLowerCase() + "/version"), "Version.java")
srcFile.parentFile.mkdirs()
srcFile.write("""package """ + applicationName.toLowerCase() + """.version;
/**
* Don't edit this class. It's a gradle class to grab version from the build.gradle
*/
public class Version {
public static final String VERSION = "$project.version";
}
""")
}
}
compileJava.dependsOn generateSources
compileJava.source generateSources.outputs.files, sourceSets.main.java
/**
* add to vm optoins
* "-XstartOnFirstThread"
*/
shadowJar {
manifest {
attributes 'Main-Class': mainClassName
}
archiveFileName = "${applicationName}-${project.version}.jar"
}
apply plugin: 'com.github.johnrengelman.shadow'