forked from OSRSB/script-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-CI.gradle
More file actions
115 lines (99 loc) · 3.62 KB
/
build-CI.gradle
File metadata and controls
115 lines (99 loc) · 3.62 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
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
plugins {
id 'java'
id 'maven-publish'
}
group = 'com.github.OSRSB'
allprojects {
repositories {
mavenLocal()
maven { url 'https://repo.runelite.net' }
maven { url 'https://jitpack.io' }
mavenCentral()
}
}
sourceSets {
main {
java {
srcDirs= ["src/main/java"]
}
}
}
jar {
configurations.implementation.setCanBeResolved(true)
from {
configurations.implementation.filter {it.name.startsWith('Dax')}.collect {zipTree(it)}
}
exclude 'META-INF/*.RSA'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
def runeLiteVersion = getRuneLiteVersion()
static def getRuneLiteVersion() {
URL url = new URL("http://repo.runelite.net/net/runelite/client/")
URLConnection urlConnection = url.openConnection()
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
urlConnection.getInputStream()))
String latestName = null
String inputLine
while ((inputLine = bufferedReader.readLine()) != null) {
inputLine = inputLine.trim().replaceAll(" +", " ")
if (inputLine.contains("/\">") && inputLine.contains("</a>")) {
String name = inputLine.substring(inputLine.indexOf("/\">") + 3, inputLine.indexOf("</a>") - 1)
String removeName = inputLine.substring(inputLine.indexOf("</a>") + 4)
if (!name.contains("SNAPSHOT") && removeName != "") {
if (compareSemanticVersion(latestName, name)) {
latestName = name
}
}
}
}
bufferedReader.close()
return latestName
}
static def compareSemanticVersion(String s1, String s2) {
if (s1 != null && s2 != null) {
while (true) {
if (s1.indexOf('.') != -1 && s2.indexOf('.') != -1) {
if (s1.substring(0, s1.indexOf('.')) == s2.substring(0, s2.indexOf('.'))) {
s1 = s1.substring(s1.indexOf('.') + 1)
s2 = s2.substring(s2.indexOf('.') + 1)
}
else {
if (s1.indexOf('.') != -1) {
s1 = s1.substring(0, s1.indexOf('.'))
}
if (s2.indexOf('.') != -1) {
s2 = s2.substring(0, s2.indexOf('.'))
}
return Integer.parseInt(s1).intValue() < Integer.parseInt(s2).intValue()
}
}
else {
if (s1.indexOf('.') != -1) {
s1 = s1.substring(0, s1.indexOf('.'))
}
if (s2.indexOf('.') != -1) {
s2 = s2.substring(0, s2.indexOf('.'))
}
return Integer.parseInt(s1).intValue() < Integer.parseInt(s2).intValue()
}
}
}
return s1 == null && s2 != null
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.slf4j:slf4j-simple:1.7.36'
implementation group: 'net.sf.jopt-simple', name:'jopt-simple', version: '5.0.4'
compileOnly group: 'net.runelite', name:'client', version: runeLiteVersion
testImplementation group: 'net.runelite', name:'client', version: runeLiteVersion
testImplementation group: 'net.runelite', name:'jshell', version: runeLiteVersion
implementation 'com.github.OSRSB:OsrsBot:master-SNAPSHOT'
implementation 'com.github.OSRSB:DaxWalkerOSRSBot:master-SNAPSHOT'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}