forked from rehlds/Metamod-R
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.gradle
81 lines (70 loc) · 2.06 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
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 << {
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/metamod/addons/metamod').mkdirs()
_copyFileToDir('publish/metamod.dll', 'publish/publishRoot/metamod/addons/metamod/')
//_copyFileToDir('publish/metamod.pdb', 'publish/publishRoot/metamod/addons/metamod/')
_copyFile('publish/libmetamod_i386.so', 'publish/publishRoot/metamod/addons/metamod/metamod_i386.so')
project.file('publish/publishRoot/metamod/sdk').mkdirs()
copy {
from 'metamod/src/dllapi.h'
into 'publish/publishRoot/metamod/sdk'
}
copy {
from 'metamod/src/engine_api.h'
into 'publish/publishRoot/metamod/sdk'
}
copy {
from 'metamod/src/enginecallbacks.h'
into 'publish/publishRoot/metamod/sdk'
}
copy {
from 'metamod/src/h_export.h'
into 'publish/publishRoot/metamod/sdk'
}
copy {
from 'metamod/src/meta_api.h'
into 'publish/publishRoot/metamod/sdk'
}
copy {
from 'metamod/src/mutil.h'
into 'publish/publishRoot/metamod/sdk'
}
copy {
from 'metamod/src/plinfo.h'
into 'publish/publishRoot/metamod/sdk'
}
}
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
baseName = "metamod_${project.version}"
destinationDir file('publish')
from 'publish/publishRoot/metamod'
}
task doPackage {
dependsOn 'publishPackage'
}