forked from RLBot/RLBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
120 lines (100 loc) · 3.65 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
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
}
}
plugins {
id "com.jfrog.bintray" version "1.8.4"
}
apply plugin: 'java' // This is the backbone of the gradle build process, we don't just use it for java files.
apply plugin: 'maven-publish' // Needed for publishing to bintray.
repositories {
jcenter()
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
def javaDllDir = 'build/dll'
dependencies {
compile group: 'net.java.dev.jna', name: 'jna', version: '4.5.1' // Allows the java bot manager to communicate with dll
compile group: 'net.java.dev.jna', name: 'jna-platform', version: '4.5.1' // Allows the java bot manager to communicate with dll
compile 'com.github.davidmoten:flatbuffers-java:1.9.0.1' // Temporarily using this guy's flatbuffers package because the official one is behind.
// compile group: 'javax.websocket', name: 'javax.websocket-api', version: '1.1' // Used for RLBot sockets communication instead of dll
// This is handy for running the test without needing to supply jna.library.path.
testRuntime files(javaDllDir)
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}
project.setGroup('org.rlbot.commons')
project.setVersion('2.1.0')
sourceSets {
main {
java {
// This is the default location where java protobuf classes are generated
srcDirs = ['src/main/java', 'src/generated/java/flatbuffers']
}
}
}
def flatbufDir = "./src/main/flatbuffers/"
task generateFlatbuffersJava(type: Exec) {
commandLine flatbufDir + "flatc.exe", "--java", "-o", "./src/generated/java/flatbuffers", flatbufDir + "rlbot.fbs"
}
// You can use the clean task to remove build output.
clean {
// In addition to the normal clean behavior, also remove the generated flatbuffer file(s).
delete 'src/generated/java'
}
// Establish some task dependencies so that some tasks always run before others.
compileJava.dependsOn generateFlatbuffersJava
task createJavaDllFolder {
mkdir javaDllDir
}
task javaSetup {
dependsOn 'generateFlatbuffersJava'
dependsOn 'createJavaDllFolder'
}
// This task creates a jar file which contains the java source files.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
// This is associated with the maven-publish plugin. It's needed for bintrayUpload to work properly.
publishing {
publications {
Main(MavenPublication) {
from components.java
artifact sourcesJar
groupId project.getGroup()
artifactId 'framework'
version project.getVersion()
}
}
}
// In order to run the bintrayUpload task successfully, create a file called local.properties
// and add a line like bintray.apikey=...
// To get the API key, go here and log in: https://bintray.com/profile/edit/organizations
// You'll also need to increment the project.setVersion(...) number in this file to push successfully.
Properties localProperties = new Properties()
File propsFile = new File('local.properties')
if (propsFile.exists()) {
localProperties.load(new FileInputStream(propsFile))
}
bintray {
user = 'rlbotofficial'
key = localProperties.getProperty("bintray.apikey")
publications = ['Main']
pkg {
repo = 'RLBotMaven'
name = 'rlbot-framework'
licenses = ['MIT']
vcsUrl = 'https://github.com/RLBot/RLBot.git'
version {
name = project.getVersion()
released = new Date()
}
}
}