2015-12-14 23:02:31 +03:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2017-07-07 16:01:43 +03:00
|
|
|
task publishPrepareFiles {
|
|
|
|
doLast {
|
|
|
|
def pubRootDir = project.file('publish/publishRoot')
|
|
|
|
if (pubRootDir.exists()) {
|
|
|
|
if (!pubRootDir.deleteDir()) {
|
|
|
|
throw new RuntimeException("Failed to delete ${pubRootDir}")
|
|
|
|
}
|
2015-12-14 23:02:31 +03:00
|
|
|
}
|
|
|
|
|
2017-07-07 16:01:43 +03:00
|
|
|
pubRootDir.mkdirs()
|
2015-12-14 23:02:31 +03:00
|
|
|
|
2017-07-07 16:01:43 +03:00
|
|
|
project.file('publish/publishRoot/revoice/bin/win32').mkdirs()
|
|
|
|
project.file('publish/publishRoot/revoice/bin/linux32').mkdirs()
|
2015-12-14 23:02:31 +03:00
|
|
|
|
2017-07-07 16:01:43 +03:00
|
|
|
_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')
|
|
|
|
}
|
2015-12-14 23:02:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
|
|
|
|
baseName = "revoice_${project.version}"
|
|
|
|
destinationDir file('publish')
|
|
|
|
from 'publish/publishRoot/revoice'
|
|
|
|
}
|
|
|
|
|
|
|
|
task doPackage {
|
|
|
|
dependsOn 'publishPackage'
|
|
|
|
}
|