2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2024-12-27 07:05:34 +03:00
metamod-r/publish.gradle

82 lines
2.1 KiB
Groovy
Raw Normal View History

2016-07-26 03:22:47 +03:00
import org.doomedsociety.gradlecpp.GradleCppUtils
import org.apache.commons.io.FilenameUtils
void _copyFileToDir(String from, String to) {
2017-03-10 00:26:00 +03:00
if (!project.file(from).exists()) {
println 'WARNING: Could not find: ' + from;
return;
}
if (!project.file(to).exists()) {
project.file(to).mkdirs();
}
2016-07-26 03:22:47 +03:00
def dst = new File(project.file(to), FilenameUtils.getName(from))
GradleCppUtils.copyFile(project.file(from), dst, false)
}
void _copyFile(String from, String to) {
2017-03-10 00:26:00 +03:00
if (!project.file(from).exists()) {
println 'WARNING: Could not find: ' + from;
return;
}
2016-07-26 03:22:47 +03:00
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()
2017-01-17 23:51:43 +03:00
_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')
2017-03-10 00:26:00 +03:00
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'
}
2016-07-26 03:22:47 +03:00
}
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
baseName = "metamod_${project.version}"
destinationDir file('publish')
from 'publish/publishRoot/metamod'
}
task doPackage {
dependsOn 'publishPackage'
}