forked from rehlds/ReVoice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
43 lines (34 loc) · 1.21 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
import org.doomedsociety.gradlecpp.GradleCppUtils
import org.apache.commons.io.FilenameUtils
void _copyFileToDir(String from, String to) {
def dst = new File(project.file(to), FilenameUtils.getName(from))
GradleCppUtils.copyFile(project.file(from), dst, false)
}
void _copyFile(String from, String to) {
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/revoice/bin/win32').mkdirs()
project.file('publish/publishRoot/revoice/bin/linux32').mkdirs()
_copyFileToDir('publish/revoice_mm.dll', 'publish/publishRoot/revoice/bin/win32/')
_copyFile('publish/librevoice_mm_i386.so', 'publish/publishRoot/revoice/bin/linux32/revoice_mm_i386.so')
copy {
from 'revoice/dist'
into 'publish/publishRoot/revoice'
}
}
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
baseName = "revoice_${project.version}"
destinationDir file('publish')
from 'publish/publishRoot/revoice'
}
task doPackage {
dependsOn 'publishPackage'
}