forked from rehlds/ReHLDS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
186 lines (162 loc) · 5.44 KB
/
publish.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import org.doomedsociety.gradlecpp.GradleCppUtils
import org.apache.commons.io.FilenameUtils
void _copyFileToDir(String from, String to) {
if (!project.file(from).exists()) {
println 'WARNING: Could not find: ' + from;
return;
}
if (!project.file(to).exists()) {
project.file(to).mkdirs();
}
def dst = new File(project.file(to), FilenameUtils.getName(from))
GradleCppUtils.copyFile(project.file(from), dst, false)
}
void _copyFile(String from, String to) {
if (!project.file(from).exists()) {
println 'WARNING: Could not find: ' + from;
return;
}
GradleCppUtils.copyFile(project.file(from), project.file(to), false)
}
task publishPrepareFiles {
dependsOn ':flightrec/decoder:uberjar'
doLast {
def pubRootDir = project.file('publish/publishRoot')
if (pubRootDir.exists()) {
if (!pubRootDir.deleteDir()) {
throw new RuntimeException("Failed to delete ${pubRootDir}")
}
}
pubRootDir.mkdirs()
project.file('publish/publishRoot/bin/win32/valve/dlls').mkdirs()
project.file('publish/publishRoot/bin/linux32/valve/dlls').mkdirs()
// bugfixed binaries
_copyFile('publish/releaseRehldsFixes/swds.dll', 'publish/publishRoot/bin/win32/swds.dll')
_copyFile('publish/releaseRehldsFixes/engine_i486.so', 'publish/publishRoot/bin/linux32/engine_i486.so')
// dedicated binaries
_copyFile('publish/hlds.exe', 'publish/publishRoot/bin/win32/hlds.exe')
_copyFile('publish/hlds_linux', 'publish/publishRoot/bin/linux32/hlds_linux')
// HLTV binaries
_copyFile('publish/hltv.exe', 'publish/publishRoot/bin/win32/hltv.exe')
_copyFile('publish/hltv', 'publish/publishRoot/bin/linux32/hltv')
_copyFile('publish/core.dll', 'publish/publishRoot/bin/win32/core.dll')
_copyFile('publish/core.so', 'publish/publishRoot/bin/linux32/core.so')
_copyFile('publish/proxy.dll', 'publish/publishRoot/bin/win32/proxy.dll')
_copyFile('publish/proxy.so', 'publish/publishRoot/bin/linux32/proxy.so')
_copyFile('publish/demoplayer.dll', 'publish/publishRoot/bin/win32/demoplayer.dll')
_copyFile('publish/demoplayer.so', 'publish/publishRoot/bin/linux32/demoplayer.so')
_copyFile('publish/director.dll', 'publish/publishRoot/bin/win32/valve/dlls/director.dll')
_copyFile('publish/director.so', 'publish/publishRoot/bin/linux32/valve/dlls/director.so')
// FileSystem binaries
_copyFile('publish/filesystem_stdio.dll', 'publish/publishRoot/bin/win32/filesystem_stdio.dll')
_copyFile('publish/filesystem_stdio.so', 'publish/publishRoot/bin/linux32/filesystem_stdio.so')
// hlsdk
project.file('publish/publishRoot/hlsdk').mkdirs()
copy {
from 'rehlds/common'
into 'publish/publishRoot/hlsdk/common'
}
copy {
from 'rehlds/dlls'
into 'publish/publishRoot/hlsdk/dlls'
}
copy {
from 'rehlds/pm_shared'
into 'publish/publishRoot/hlsdk/pm_shared'
}
copy {
from 'rehlds/public'
into 'publish/publishRoot/hlsdk/public'
exclude '**/rehlds/*', '**/tier0/*'
}
copy {
from 'rehlds/public/rehlds'
into 'publish/publishRoot/hlsdk/engine'
}
// flightrecorder
def flightRecJarTask = project(':flightrec/decoder').tasks.getByName('uberjar')
println flightRecJarTask
println flightRecJarTask.class.name
File flightRecJarFile = flightRecJarTask.archivePath
project.file('publish/publishRoot/flighrec').mkdirs()
GradleCppUtils.copyFile(flightRecJarFile, project.file('publish/publishRoot/flighrec/decoder.jar'), false)
copy {
from new File(project(':flightrec/decoder').projectDir, 'pub')
into 'publish/publishRoot/flighrec'
}
}
}
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
baseName = "rehlds-dist-${project.version}"
destinationDir file('publish')
from 'publish/publishRoot'
}
publishing {
publications {
maven(MavenPublication) {
version project.version
artifact publishPackage
pom.withXml {
asNode().children().last() + {
resolveStrategy = DELEGATE_FIRST
name project.name
description project.description
properties {
commitDate project.ext.rehldsVersionInfo.commitDate
commitSHA project.ext.rehldsVersionInfo.commitSHA
}
//url github
//scm {
// url "${github}.git"
// connection "scm:git:${github}.git"
//}
/*
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'dreamstalker'
name 'dreamstalker'
}
}
*/
}
}
}
}
}
Properties repoCreds = new Properties()
project.ext.repoCreds = repoCreds
if (file('repo_creds.properties').exists()) {
println 'Loading maven repo credentials'
file('repo_creds.properties').withReader('UTF-8', { Reader r ->
repoCreds.load(r)
})
}
publishing {
repositories {
maven {
if (project.version.contains('dev')) {
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/"
} else {
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/"
}
credentials {
username repoCreds.getProperty('username')
password repoCreds.getProperty('password')
}
}
}
}
task doPublish {
dependsOn 'publishPackage'
if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) {
dependsOn 'publish'
dependsOn ':flightrec/decoder_api:publish'
}
}