2015-06-30 12:46:07 +03:00
|
|
|
import org.doomedsociety.gradlecpp.GradleCppUtils
|
|
|
|
import org.apache.commons.io.FilenameUtils
|
|
|
|
|
|
|
|
void _copyFileToDir(String from, String to) {
|
2018-05-22 10:47:02 +03:00
|
|
|
if (!project.file(from).exists()) {
|
|
|
|
println 'WARNING: Could not find: ' + from;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!project.file(to).exists()) {
|
|
|
|
project.file(to).mkdirs();
|
|
|
|
}
|
|
|
|
|
2017-10-12 17:50:56 +03:00
|
|
|
def dst = new File(project.file(to), FilenameUtils.getName(from))
|
2015-12-05 22:40:30 +03:00
|
|
|
GradleCppUtils.copyFile(project.file(from), dst, false)
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void _copyFile(String from, String to) {
|
2018-05-22 10:47:02 +03:00
|
|
|
if (!project.file(from).exists()) {
|
|
|
|
println 'WARNING: Could not find: ' + from;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-12-05 22:40:30 +03:00
|
|
|
GradleCppUtils.copyFile(project.file(from), project.file(to), false)
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
task publishPrepareFiles {
|
2015-12-05 22:40:30 +03:00
|
|
|
doLast {
|
|
|
|
def pubRootDir = project.file('publish/publishRoot')
|
|
|
|
if (pubRootDir.exists()) {
|
|
|
|
if (!pubRootDir.deleteDir()) {
|
|
|
|
throw new RuntimeException("Failed to delete ${pubRootDir}")
|
|
|
|
}
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2015-12-05 22:40:30 +03:00
|
|
|
pubRootDir.mkdirs()
|
2018-05-22 10:47:02 +03:00
|
|
|
project.file('publish/publishRoot/bin/win32/cstrike/dlls').mkdirs()
|
|
|
|
project.file('publish/publishRoot/bin/linux32/cstrike/dlls').mkdirs()
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2017-10-19 20:12:02 +03:00
|
|
|
// bugfixed binaries
|
2018-05-22 10:47:02 +03:00
|
|
|
_copyFile('publish/releaseRegamedllFixes/mp.dll', 'publish/publishRoot/bin/win32/cstrike/dlls/mp.dll')
|
|
|
|
_copyFile('publish/releaseRegamedllFixes/cs.so', 'publish/publishRoot/bin/linux32/cstrike/dlls/cs.so')
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2017-10-19 20:12:02 +03:00
|
|
|
// copy files from folder dist
|
2016-01-21 14:23:56 +03:00
|
|
|
copy {
|
|
|
|
from('dist')
|
2019-06-05 15:46:48 +03:00
|
|
|
into 'publish/publishRoot/bin/win32/cstrike'
|
|
|
|
}
|
|
|
|
|
|
|
|
copy {
|
|
|
|
from('dist')
|
|
|
|
into 'publish/publishRoot/bin/linux32/cstrike'
|
2016-01-21 14:23:56 +03:00
|
|
|
}
|
|
|
|
|
2017-10-19 20:12:02 +03:00
|
|
|
// cssdk
|
2016-04-05 03:12:05 +03:00
|
|
|
project.file('publish/publishRoot/cssdk').mkdirs()
|
|
|
|
copy {
|
|
|
|
from 'regamedll/extra/cssdk'
|
|
|
|
into 'publish/publishRoot/cssdk'
|
|
|
|
}
|
2015-12-05 22:40:30 +03:00
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
|
2015-12-05 22:40:30 +03:00
|
|
|
baseName = "regamedll-dist-${project.version}"
|
|
|
|
destinationDir file('publish')
|
|
|
|
from 'publish/publishRoot'
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
2015-12-05 22:40:30 +03:00
|
|
|
publications {
|
|
|
|
maven(MavenPublication) {
|
|
|
|
version project.version
|
|
|
|
artifact publishPackage
|
2015-06-30 12:46:07 +03:00
|
|
|
|
2015-12-05 22:40:30 +03:00
|
|
|
pom.withXml {
|
|
|
|
asNode().children().last() + {
|
|
|
|
resolveStrategy = DELEGATE_FIRST
|
|
|
|
name project.name
|
|
|
|
description project.description
|
2016-12-09 17:07:34 +03:00
|
|
|
properties {
|
|
|
|
commitDate project.ext.regamedllVersionInfo.commitDate
|
|
|
|
commitSHA project.ext.regamedllVersionInfo.commitSHA
|
|
|
|
}
|
|
|
|
|
2015-12-05 22:40:30 +03:00
|
|
|
//url github
|
|
|
|
//scm {
|
|
|
|
// url "${github}.git"
|
|
|
|
// connection "scm:git:${github}.git"
|
|
|
|
//}
|
|
|
|
/*
|
|
|
|
licenses {
|
2016-12-09 17:07:34 +03:00
|
|
|
license {
|
|
|
|
name 'The Apache Software License, Version 2.0'
|
|
|
|
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
|
|
distribution 'repo'
|
|
|
|
}
|
2015-12-05 22:40:30 +03:00
|
|
|
}
|
|
|
|
developers {
|
2016-12-09 17:07:34 +03:00
|
|
|
developer {
|
|
|
|
id 'dreamstalker'
|
|
|
|
name 'dreamstalker'
|
|
|
|
}
|
2015-12-05 22:40:30 +03:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Properties repoCreds = new Properties()
|
|
|
|
project.ext.repoCreds = repoCreds
|
|
|
|
if (file('repo_creds.properties').exists()) {
|
2015-12-05 22:40:30 +03:00
|
|
|
println 'Loading maven repo credentials'
|
|
|
|
file('repo_creds.properties').withReader('UTF-8', { Reader r ->
|
|
|
|
repoCreds.load(r)
|
|
|
|
})
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
2015-12-05 22:40:30 +03:00
|
|
|
repositories {
|
|
|
|
maven {
|
2016-12-09 17:07:34 +03:00
|
|
|
if (project.version.contains('dev')) {
|
|
|
|
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-dev/"
|
2015-12-05 22:40:30 +03:00
|
|
|
} else {
|
|
|
|
url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/"
|
|
|
|
}
|
|
|
|
credentials {
|
|
|
|
username repoCreds.getProperty('username')
|
|
|
|
password repoCreds.getProperty('password')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
task doPublish {
|
2015-12-05 22:40:30 +03:00
|
|
|
dependsOn 'publishPackage'
|
|
|
|
if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) {
|
|
|
|
dependsOn 'publish'
|
|
|
|
}
|
2015-06-30 12:46:07 +03:00
|
|
|
}
|