2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-29 08:05:36 +03:00
reapi/publish.gradle

66 lines
1.8 KiB
Groovy
Raw Normal View History

2016-04-05 01:21:38 +03:00
import org.doomedsociety.gradlecpp.GradleCppUtils
import org.apache.commons.io.FilenameUtils
import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.Method.POST
2016-04-05 01:21:38 +03:00
void _copyFileToDir(String from, String to) {
2019-09-06 17:49:20 +03:00
if (!project.file(from).exists()) {
println 'WARNING: Could not find: ' + from;
return;
}
if (!project.file(to).exists()) {
project.file(to).mkdirs();
}
2016-04-05 01:21:38 +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) {
2019-09-06 17:49:20 +03:00
if (!project.file(from).exists()) {
println 'WARNING: Could not find: ' + from;
return;
}
2016-04-05 01:21:38 +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()
2019-09-06 17:49:20 +03:00
project.file('publish/publishRoot/addons/amxmodx/modules').mkdirs()
//project.file('publish/publishRoot/addons/amxmodx/scripting/include').mkdirs()
2016-04-05 01:21:38 +03:00
2019-09-06 17:49:20 +03:00
_copyFileToDir('publish/reapi_amxx.dll', 'publish/publishRoot/addons/amxmodx/modules/')
//_copyFileToDir('publish/reapi_amxx.pdb', 'publish/publishRoot/addons/amxmodx/modules/')
_copyFile('publish/reapi_amxx_i386.so', 'publish/publishRoot/addons/amxmodx/modules/reapi_amxx_i386.so')
2016-04-05 01:21:38 +03:00
copy {
from 'reapi/extra'
2019-09-06 17:49:20 +03:00
into 'publish/publishRoot/addons'
2016-04-05 01:21:38 +03:00
}
copy {
2017-01-05 12:27:59 +03:00
from 'reapi/version/reapi_version.inc'
2019-09-06 17:49:20 +03:00
into 'publish/publishRoot/addons/amxmodx/scripting/include'
}
2016-04-05 01:21:38 +03:00
}
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
baseName = "reapi_${project.version}"
destinationDir file('publish')
2019-09-06 17:49:20 +03:00
from 'publish/publishRoot'
2016-04-05 01:21:38 +03:00
}
2019-09-06 17:49:20 +03:00
task doPublish {
2017-01-12 00:24:35 +03:00
dependsOn 'publishPackage'
2016-04-05 01:21:38 +03:00
}