2015-05-04 21:25:41 +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)
|
|
|
|
}
|
|
|
|
|
2015-06-06 15:24:53 +03:00
|
|
|
task publishPrepareFiles {
|
|
|
|
dependsOn ':flightrec/decoder:uberjar'
|
|
|
|
doLast {
|
|
|
|
def pubRootDir = project.file('publish/publishRoot')
|
|
|
|
if (pubRootDir.exists()) {
|
|
|
|
if (!pubRootDir.deleteDir()) {
|
|
|
|
throw new RuntimeException("Failed to delete ${pubRootDir}")
|
|
|
|
}
|
2015-05-04 21:25:41 +03:00
|
|
|
}
|
|
|
|
|
2015-06-06 15:24:53 +03:00
|
|
|
pubRootDir.mkdirs()
|
2015-05-04 21:25:41 +03:00
|
|
|
|
2015-06-06 15:24:53 +03:00
|
|
|
//bugfixed binaries
|
|
|
|
project.file('publish/publishRoot/bin/bugfixed').mkdirs()
|
|
|
|
_copyFileToDir('publish/releaseRehldsFixes/swds.dll', 'publish/publishRoot/bin/bugfixed/')
|
|
|
|
_copyFileToDir('publish/releaseRehldsFixes/swds.pdb', 'publish/publishRoot/bin/bugfixed/')
|
|
|
|
_copyFile('publish/releaseRehldsFixes/libengine_i486.so', 'publish/publishRoot/bin/bugfixed/engine_i486.so')
|
2015-05-04 21:25:41 +03:00
|
|
|
|
2015-06-06 15:24:53 +03:00
|
|
|
//pure binaries
|
|
|
|
project.file('publish/publishRoot/bin/pure').mkdirs()
|
|
|
|
_copyFileToDir('publish/releaseRehldsNofixes/swds.dll', 'publish/publishRoot/bin/pure/')
|
|
|
|
_copyFileToDir('publish/releaseRehldsNofixes/swds.pdb', 'publish/publishRoot/bin/pure/')
|
|
|
|
_copyFile('publish/releaseRehldsNofixes/libengine_i486.so', 'publish/publishRoot/bin/pure/engine_i486.so')
|
2015-05-04 21:25:41 +03:00
|
|
|
|
2015-06-06 15:24:53 +03:00
|
|
|
//hlsdk
|
|
|
|
project.file('publish/publishRoot/hlsdk').mkdirs()
|
|
|
|
copy {
|
|
|
|
from 'rehlds/common'
|
|
|
|
into 'publish/publishRoot/hlsdk/common'
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from 'rehlds/dlls'
|
|
|
|
into 'publish/publishRoot/hlsdk/dlls'
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from 'rehlds/pm_shared'
|
|
|
|
into 'publish/publishRoot/hlsdk/pm_shared'
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from 'rehlds/public'
|
|
|
|
into 'publish/publishRoot/hlsdk/public'
|
|
|
|
include 'interface.h', 'interface.cpp', 'FileSystem.h'
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from 'rehlds/public/rehlds'
|
|
|
|
into 'publish/publishRoot/hlsdk/engine'
|
|
|
|
}
|
|
|
|
|
|
|
|
//flightrecorder
|
|
|
|
|
|
|
|
def flightRecJarTask = project(':flightrec/decoder').tasks.getByName('uberjar')
|
|
|
|
println flightRecJarTask
|
|
|
|
println flightRecJarTask.class.name
|
|
|
|
File flightRecJarFile = flightRecJarTask.archivePath
|
|
|
|
project.file('publish/publishRoot/flighrec').mkdirs()
|
2015-12-06 18:05:56 +03:00
|
|
|
GradleCppUtils.copyFile(flightRecJarFile, project.file('publish/publishRoot/flighrec/decoder.jar'), false)
|
2015-06-06 15:24:53 +03:00
|
|
|
copy {
|
|
|
|
from new File(project(':flightrec/decoder').projectDir, 'pub')
|
|
|
|
into 'publish/publishRoot/flighrec'
|
|
|
|
}
|
2015-05-04 21:25:41 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
|
|
|
|
baseName = "rehlds-dist-${project.version}"
|
|
|
|
destinationDir file('publish')
|
|
|
|
from 'publish/publishRoot'
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
maven(MavenPublication) {
|
|
|
|
version project.version
|
|
|
|
artifact publishPackage
|
|
|
|
|
|
|
|
pom.withXml {
|
|
|
|
asNode().children().last() + {
|
|
|
|
resolveStrategy = DELEGATE_FIRST
|
|
|
|
name project.name
|
|
|
|
description project.description
|
|
|
|
//url github
|
|
|
|
//scm {
|
|
|
|
// url "${github}.git"
|
|
|
|
// connection "scm:git:${github}.git"
|
|
|
|
//}
|
|
|
|
/*
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name 'The Apache Software License, Version 2.0'
|
|
|
|
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
|
|
distribution 'repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id 'dreamstalker'
|
|
|
|
name 'dreamstalker'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Properties repoCreds = new Properties()
|
2015-06-06 20:50:56 +03:00
|
|
|
project.ext.repoCreds = repoCreds
|
2015-05-04 21:25:41 +03:00
|
|
|
if (file('repo_creds.properties').exists()) {
|
|
|
|
println 'Loading maven repo credentials'
|
|
|
|
file('repo_creds.properties').withReader('UTF-8', { Reader r ->
|
|
|
|
repoCreds.load(r)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
if (project.version.contains('SNAPSHOT')) {
|
|
|
|
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/"
|
|
|
|
} else {
|
|
|
|
url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/"
|
|
|
|
}
|
|
|
|
credentials {
|
|
|
|
username repoCreds.getProperty('username')
|
|
|
|
password repoCreds.getProperty('password')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task doPublish {
|
|
|
|
dependsOn 'publishPackage'
|
|
|
|
if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) {
|
|
|
|
dependsOn 'publish'
|
2015-06-06 20:50:56 +03:00
|
|
|
dependsOn ':flightrec/decoder_api:publish'
|
2015-05-04 21:25:41 +03:00
|
|
|
}
|
|
|
|
}
|