diff --git a/.gitattributes b/.gitattributes index b5c177f24..dbc771118 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,14 +16,10 @@ # Scripts *.sh text eol=lf -gradlew text eol=lf *.bat text eol=crlf -*.gradle text eol=crlf -*.groovy text eol=crlf *.def text eol=crlf *.fgd text eol=crlf *.cfg text eol=crlf -*.properties text eol=crlf *.vm text eol=crlf # Compiled Object files diff --git a/.gitignore b/.gitignore index b836d5b5e..dc6d161e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ **/build -**/.gradle -.idea -*.iml *.bat *.log *.lnk @@ -15,12 +12,11 @@ **/msvc/*.db **/msvc/*.opendb **/msvc/*.txt +**/msvc/*.aps **/msvc/*.amplxeproj **/msvc/.vs **/msvc/ipch regamedll/version/appversion.h regamedll/msvc/PublishPath*.txt -regamedll/_regamedllTestImg -regamedll/_dev publish diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index cdf4960a1..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "regamedll/extra/cssdk"] - path = regamedll/extra/cssdk - url = https://github.com/s1lentq/CSSDK.git diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 0fe367244..000000000 --- a/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -import versioning.GitVersioner -import versioning.RegamedllVersionInfo -import org.joda.time.DateTime - -apply plugin: 'maven-publish' -apply from: 'shared.gradle' -group = 'regamedll' - -apply plugin: 'idea' - -idea { - project { - languageLevel = 'JDK_1_7' - } -} - -def gitInfo = GitVersioner.versionForDir(project.rootDir) -RegamedllVersionInfo versionInfo -if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') { - def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/ - if (!m.find()) { - throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}") - } - - versionInfo = new RegamedllVersionInfo( - majorVersion: m.group(1) as int, - minorVersion: m.group(2) as int, - maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, - localChanges: gitInfo.localChanges, - commitDate: gitInfo.commitDate, - commitSHA: gitInfo.commitSHA, - commitURL: gitInfo.commitURL - ) -} else { - - if (!gitInfo) { - System.err.println "WARNING! couldn't get gitInfo"; - } - - versionInfo = new RegamedllVersionInfo( - majorVersion: project.majorVersion as int, - minorVersion: project.minorVersion as int, - maintenanceVersion: project.maintenanceVersion as int, - suffix: 'dev', - localChanges: gitInfo ? gitInfo.localChanges : true, - commitDate: gitInfo ? gitInfo.commitDate : new DateTime(), - commitSHA: gitInfo ? gitInfo.commitSHA : "", - commitURL: gitInfo ? gitInfo.commitURL : "", - commitCount: gitInfo ? (gitInfo.commitCount as int) : null - ) -} - -project.ext.regamedllVersionInfo = versionInfo -project.version = versionInfo.asMavenVersion() - -apply from: 'publish.gradle' - -task wrapper(type: Wrapper) { - gradleVersion = '2.4' -} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index f842a1d21..000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -apply plugin: 'groovy' - -repositories { - //mavenLocal() - mavenCentral() - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/' - } - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/' - } - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-dev/' - } - -} - -dependencies { - compile gradleApi() - compile localGroovy() - compile 'commons-io:commons-io:2.4' - compile 'commons-lang:commons-lang:2.6' - compile 'joda-time:joda-time:2.7' - - compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2' - compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r' - - compile 'org.apache.commons:commons-compress:1.9' - compile 'org.apache.ant:ant-compress:1.2' - compile 'org.apache.ant:ant:1.9.6' - - compile 'org.apache.velocity:velocity:1.7' -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/FileSystemTreeBuilder.groovy b/buildSrc/src/main/groovy/dirsync/builder/FileSystemTreeBuilder.groovy deleted file mode 100644 index af2180c24..000000000 --- a/buildSrc/src/main/groovy/dirsync/builder/FileSystemTreeBuilder.groovy +++ /dev/null @@ -1,58 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import groovy.transform.CompileStatic - -class FileSystemTreeBuilder { - - @CompileStatic - private static FileNode buildNodeForFile(File file, DirectoryNode parent) { - if (parent.getChildren(file.name)) { - throw new RuntimeException("Parent dir ${parent.name} already contains child node ${file.name}"); - } - - return new FileNode( - name: file.name, - lastModifiedDate: file.lastModified(), - data: file, - parent: parent, - size: file.size() - ); - } - - @CompileStatic - private static DirectoryNode buildNodeForDirectoryRecursive(File dir, DirectoryNode parent) { - if (!dir.isDirectory()) { - throw new RuntimeException("File ${dir.absolutePath} is not a directory") - } - - if (parent != null && parent.getChildren(dir.name)) { - throw new RuntimeException("Parent dir ${parent.name} already contains child node ${dir.name}"); - } - - DirectoryNode thisNode = new DirectoryNode( - name: dir.name, - lastModifiedDate: dir.lastModified(), - data: dir, - parent: parent - ); - - dir.eachFile { File f -> - if (f.isDirectory()) { - thisNode.childNodes[f.name] = buildNodeForDirectoryRecursive(f, thisNode) - } else { - thisNode.childNodes[f.name] = buildNodeForFile(f, thisNode) - } - } - - return thisNode; - } - - static DirectoryNode buildFileSystemTree(File rootDir) { - def root = buildNodeForDirectoryRecursive(rootDir, null); - PostBuildPass.doPostBuild(root) - - return root - } -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/FileTreeMerger.groovy b/buildSrc/src/main/groovy/dirsync/builder/FileTreeMerger.groovy deleted file mode 100644 index df92119a3..000000000 --- a/buildSrc/src/main/groovy/dirsync/builder/FileTreeMerger.groovy +++ /dev/null @@ -1,60 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode - -class FileTreeMerger { - - private static void mergeContentsRecursive(DirectoryNode newParent, DirectoryNode toMerge) { - toMerge.childNodes.each { cn -> - def node = cn.value - def existingNode = newParent.childNodes[node.name] - if (existingNode) { - if (!(existingNode instanceof DirectoryNode) || !(node instanceof DirectoryNode)) - throw new RuntimeException("Failed to merge non-directory nodes ${node.fullPath}") - - def existingDirNode = existingNode as DirectoryNode - def dirNode = node as DirectoryNode - - existingDirNode.lastModifiedDate = Math.max(existingDirNode.lastModifiedDate, dirNode.lastModifiedDate) - mergeContentsRecursive(existingDirNode, dirNode) - } else { - if (node instanceof DirectoryNode) { - def dirNode = node as DirectoryNode - def newNode = new DirectoryNode( - name: dirNode.name, - data: dirNode.data, - parent: newParent, - lastModifiedDate: dirNode.lastModifiedDate - ) - newParent.childNodes[node.name] = newNode - - mergeContentsRecursive(newNode, dirNode) - } else { - FileNode fileNode = node as FileNode - FileNode newNode = new FileNode( - name: fileNode.name, - data: fileNode.data, - parent: newParent, - lastModifiedDate: fileNode.lastModifiedDate, - size: fileNode.size - ) - - newParent.childNodes[node.name] = newNode - } - } - } - } - - public static DirectoryNode mergeTrees(DirectoryNode tree1, DirectoryNode tree2) { - DirectoryNode newRoot = new DirectoryNode( - name: tree1.name ?: tree2.name - ) - - mergeContentsRecursive(newRoot, tree1) - mergeContentsRecursive(newRoot, tree2) - PostBuildPass.doPostBuild(newRoot) - - return newRoot - } -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/PostBuildPass.groovy b/buildSrc/src/main/groovy/dirsync/builder/PostBuildPass.groovy deleted file mode 100644 index 87782dd7d..000000000 --- a/buildSrc/src/main/groovy/dirsync/builder/PostBuildPass.groovy +++ /dev/null @@ -1,22 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode - -class PostBuildPass { - - private static void postProcessRecursive(DirectoryNode dir) { - dir.childNodes.each { cne -> - def childNode = cne.value - childNode.fullPath = dir.fullPath ? dir.fullPath + '/' + childNode.name : childNode.name - if (childNode instanceof DirectoryNode) { - def childDirNode = childNode as DirectoryNode - postProcessRecursive(childDirNode) - } - } - } - - static void doPostBuild(DirectoryNode root) { - root.fullPath = '' - postProcessRecursive(root) - } -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/ZipTreeBuilder.groovy b/buildSrc/src/main/groovy/dirsync/builder/ZipTreeBuilder.groovy deleted file mode 100644 index c14092d58..000000000 --- a/buildSrc/src/main/groovy/dirsync/builder/ZipTreeBuilder.groovy +++ /dev/null @@ -1,53 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import dirsync.model.tree.ZipData - -import java.util.zip.ZipFile - -class ZipTreeBuilder { - static DirectoryNode buildForZipArchive(String zipArchive, ZipFile zf) { - DirectoryNode root = new DirectoryNode<>() - - zf.entries().each { ze -> - def path = ze.name.replace('\\', '/') - if (path.endsWith('/')) - path = path.substring(0, path.length() - 1) - - def parentPath = path.contains('/') ? path.substring(0, path.lastIndexOf('/')) : '' - def childPath = path.contains('/') ? path.substring(path.lastIndexOf('/') + 1) : path - - def parentNode = (DirectoryNode) root.getByPath(parentPath) - if (parentNode == null) - throw new RuntimeException("Error reading ${zipArchive}: could not find parent path ${parentPath} for path ${path}") - - def childNode = parentNode.getChildren(childPath) - if (childNode) - throw new RuntimeException("Error reading ${zipArchive}: duplicate path ${path}") - - if (ze.directory) { - childNode = new DirectoryNode( - name: childPath, - lastModifiedDate: ze.time, - data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive), - parent: parentNode - ); - } else { - childNode = new FileNode( - name: childPath, - lastModifiedDate: ze.time, - data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive), - parent: parentNode, - size: ze.size - ); - } - parentNode.childNodes[childPath] = childNode - - //println '' + ze.directory + ' ' + ze.name + ' ' + parentPath + ' ' + childPath - } - - PostBuildPass.doPostBuild(root) - return root - } -} diff --git a/buildSrc/src/main/groovy/dirsync/merger/FileTreeComparator.groovy b/buildSrc/src/main/groovy/dirsync/merger/FileTreeComparator.groovy deleted file mode 100644 index e018a2c7b..000000000 --- a/buildSrc/src/main/groovy/dirsync/merger/FileTreeComparator.groovy +++ /dev/null @@ -1,97 +0,0 @@ -package dirsync.merger - -import dirsync.model.synccmd.AbstractSyncCmd -import dirsync.model.synccmd.CopyDirCmd -import dirsync.model.synccmd.CopyFileCmd -import dirsync.model.synccmd.DeleteDirCmd -import dirsync.model.synccmd.DeleteFileCmd -import dirsync.model.synccmd.ReplaceFileCmd -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import groovy.transform.TypeChecked - -@TypeChecked -class FileTreeComparator { - - private static void mergeDirsRecursive(DirectoryNode left, DirectoryNode right, List> diffs) { - - // left => right - left.childNodes.each { le -> - def leftNode = le.value - def rightNode = right.childNodes[leftNode.name] - - if (rightNode == null) { - switch (leftNode) { - case DirectoryNode: - def leftDirNode = leftNode as DirectoryNode - diffs << new CopyDirCmd<>(src: leftDirNode, dstParentDir: right) - break - - case FileNode: - def leftFileNode = leftNode as FileNode - diffs << new CopyFileCmd<>(src: leftFileNode, dstDir: right) - break - - default: - throw new RuntimeException("Invalid node class ${leftNode.class.name}") - } - - return - } - - if (rightNode.class != leftNode.class) { - throw new RuntimeException("node classes mismatch: ${leftNode.class.name} != ${rightNode.class.name}") - } - - switch (rightNode) { - case DirectoryNode: - def leftDirNode = leftNode as DirectoryNode - def rightDirNode = rightNode as DirectoryNode - mergeDirsRecursive(leftDirNode, rightDirNode, diffs) - break - - case FileNode: - def leftFileNode = leftNode as FileNode - def rightFileNode = rightNode as FileNode - if (leftFileNode.size != rightFileNode.size || leftFileNode.lastModifiedDate != rightFileNode.lastModifiedDate) { - diffs << new ReplaceFileCmd<>(src: leftFileNode, dst: rightFileNode) - } - break - - default: - throw new RuntimeException("Invalid node class ${rightNode.class.name}") - } - } // ~left => right - - //right => left - right.childNodes.each { re -> - def rightNode = re.value - def leftNode = left.childNodes[rightNode.name] - - if (leftNode != null) { - return //already processed in left => right - } - - switch (rightNode) { - case DirectoryNode: - def rightDirNode = rightNode as DirectoryNode - diffs << new DeleteDirCmd<>(dirNode: rightDirNode) - break - - case FileNode: - def rightFileNode = rightNode as FileNode - diffs << new DeleteFileCmd<>(node: rightFileNode) - break - - default: - throw new RuntimeException("Invalid node class ${rightNode.class.name}") - } - } // ~right => left - } - - static List> mergeTrees(DirectoryNode leftRoot, DirectoryNode rightRoot) { - List> res = [] - mergeDirsRecursive(leftRoot, rightRoot, res) - return res - } -} diff --git a/buildSrc/src/main/groovy/dirsync/merger/FileTreeDiffApplier.groovy b/buildSrc/src/main/groovy/dirsync/merger/FileTreeDiffApplier.groovy deleted file mode 100644 index 1c1404e48..000000000 --- a/buildSrc/src/main/groovy/dirsync/merger/FileTreeDiffApplier.groovy +++ /dev/null @@ -1,103 +0,0 @@ -package dirsync.merger - -import dirsync.model.synccmd.AbstractSyncCmd -import dirsync.model.synccmd.CopyDirCmd -import dirsync.model.synccmd.CopyFileCmd -import dirsync.model.synccmd.DeleteDirCmd -import dirsync.model.synccmd.DeleteFileCmd -import dirsync.model.synccmd.ReplaceFileCmd -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import dirsync.model.tree.TreePhysMapper -import groovy.transform.TypeChecked -import org.apache.commons.io.IOUtils - -@TypeChecked -public class FileTreeDiffApplier { - - static void copyDirRecursive(DirectoryNode src, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.createDirectory(src.fullPath) - src.childNodes.each { ce -> - def childNode = ce.value - def childPath = childNode.fullPath - switch (childNode) { - case FileNode: - srcMapper.fileContent(childNode.data).withStream { InputStream inStream -> - dstMapper.createFile(childPath).withStream { OutputStream outStream -> - IOUtils.copy(inStream, outStream) - } - - dstMapper.setFileLastUpdatedDate(childPath, childNode.lastModifiedDate) - } - break; - - case DirectoryNode: - copyDirRecursive(childNode as DirectoryNode, srcMapper, dstMapper) - break; - - default: - throw new RuntimeException("Invalid node class: ${childNode.class.name}") - } - } - } - - static void handleCopyFile(CopyFileCmd fileCopy, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - def dstPath = fileCopy.dstDir.fullPath ? fileCopy.dstDir.fullPath + '/' + fileCopy.src.name : fileCopy.src.name - srcMapper.fileContent(fileCopy.src.data).withStream { InputStream inStream -> - dstMapper.createFile(dstPath).withStream { OutputStream outStream -> - IOUtils.copy(inStream, outStream) - } - - dstMapper.setFileLastUpdatedDate(dstPath, fileCopy.src.lastModifiedDate) - } - } - - static void handleDeleteDir(DeleteDirCmd delDir, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.removeDirectory(delDir.dirNode.fullPath) - } - - static void handleDeleteFile(DeleteFileCmd delFile, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.removeFile(delFile.node.fullPath) - } - - static void handleReplaceFile(ReplaceFileCmd replaceFile, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.removeFile(replaceFile.dst.fullPath) - srcMapper.fileContent(replaceFile.src.data).withStream { InputStream inStream -> - dstMapper.createFile(replaceFile.dst.fullPath).withStream { OutputStream outStream -> - IOUtils.copy(inStream, outStream) - } - - dstMapper.setFileLastUpdatedDate(replaceFile.dst.fullPath, replaceFile.src.lastModifiedDate) - } - } - - static void applyDiffs(List> diffs, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - diffs.each { diff -> - switch (diff) { - case CopyDirCmd: - def copyDir = diff as CopyDirCmd - copyDirRecursive(copyDir.src, srcMapper, dstMapper) - break - - case CopyFileCmd: - handleCopyFile(diff as CopyFileCmd, srcMapper, dstMapper) - break - - case DeleteDirCmd: - handleDeleteDir(diff as DeleteDirCmd, srcMapper, dstMapper) - break - - case DeleteFileCmd: - handleDeleteFile(diff as DeleteFileCmd, srcMapper, dstMapper) - break - - case ReplaceFileCmd: - handleReplaceFile(diff as ReplaceFileCmd, srcMapper, dstMapper) - break - - default: - throw new RuntimeException("Invalid diff command ${diff.class.name}") - } - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/AbstractSyncCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/AbstractSyncCmd.groovy deleted file mode 100644 index 20e0a1b61..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/AbstractSyncCmd.groovy +++ /dev/null @@ -1,4 +0,0 @@ -package dirsync.model.synccmd - -class AbstractSyncCmd { -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyDirCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyDirCmd.groovy deleted file mode 100644 index 8a03abed2..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyDirCmd.groovy +++ /dev/null @@ -1,8 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.DirectoryNode - -class CopyDirCmd extends AbstractSyncCmd { - DirectoryNode src - DirectoryNode dstParentDir -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyFileCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyFileCmd.groovy deleted file mode 100644 index 8511dc376..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyFileCmd.groovy +++ /dev/null @@ -1,9 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode - -class CopyFileCmd extends AbstractSyncCmd { - FileNode src - DirectoryNode dstDir -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteDirCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteDirCmd.groovy deleted file mode 100644 index f5a8d2abd..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteDirCmd.groovy +++ /dev/null @@ -1,7 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.DirectoryNode - -class DeleteDirCmd extends AbstractSyncCmd { - DirectoryNode dirNode -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteFileCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteFileCmd.groovy deleted file mode 100644 index 0cd429d3a..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteFileCmd.groovy +++ /dev/null @@ -1,7 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.FileNode - -class DeleteFileCmd extends AbstractSyncCmd { - FileNode node -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/ReplaceFileCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/ReplaceFileCmd.groovy deleted file mode 100644 index 3153b1e4b..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/ReplaceFileCmd.groovy +++ /dev/null @@ -1,8 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.FileNode - -class ReplaceFileCmd extends AbstractSyncCmd { - FileNode src - FileNode dst -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/AbstractFileTreeNode.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/AbstractFileTreeNode.groovy deleted file mode 100644 index 12d0a141d..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/AbstractFileTreeNode.groovy +++ /dev/null @@ -1,27 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -abstract class AbstractFileTreeNode { - DirectoryNode parent - String name - String fullPath - long lastModifiedDate - T data - - boolean equals(o) { - if (this.is(o)) return true - if (getClass() != o.class) return false - - AbstractFileTreeNode that = (AbstractFileTreeNode) o - - if (name != that.name) return false - - return true - } - - int hashCode() { - return (name != null ? name.hashCode() : 0) - } -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/DirectoryNode.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/DirectoryNode.groovy deleted file mode 100644 index 3e4687752..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/DirectoryNode.groovy +++ /dev/null @@ -1,42 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -class DirectoryNode extends AbstractFileTreeNode { - Map> childNodes = new HashMap<>() - - AbstractFileTreeNode getChildren(String name) { - return childNodes[name]; - } - - AbstractFileTreeNode getChildren(String[] names, int idx) { - if (idx == names.length) - return this - - AbstractFileTreeNode c = childNodes[names[idx]] - if (c == null) - return null - - if (c instanceof DirectoryNode) { - def d = (DirectoryNode) c; - return d.getChildren(names, idx + 1) - } - - return null; - } - - AbstractFileTreeNode getByPath(String path) { - path = path.replace('\\', '/') - if (path.endsWith('/')) - path = path.substring(0, path.length() - 1) - - if (path.empty) { - return this - } - - String[] components = path.split('/') - return getChildren(components, 0) - } - -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/FSMapper.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/FSMapper.groovy deleted file mode 100644 index 9c187c4f7..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/FSMapper.groovy +++ /dev/null @@ -1,50 +0,0 @@ -package dirsync.model.tree - -class FSMapper extends TreePhysMapper { - final File root - - FSMapper(File root) { - this.root = root - } - - @Override - InputStream fileContent(File file) { - return file.newDataInputStream() - } - - @Override - void createDirectory(String dir) { - def target = new File(root, dir) - if (!target.mkdirs()) { - throw new RuntimeException("Failed to create directory ${target.absolutePath}") - } - } - - @Override - void removeDirectory(String dir) { - def target = new File(root, dir) - if (!target.deleteDir()) { - throw new RuntimeException("Failed to delete directory ${target.absolutePath}") - } - } - - @Override - void removeFile(String path) { - def target = new File(root, path) - if (!target.delete()) { - throw new RuntimeException("Failed to delete file ${target.absolutePath}") - } - } - - @Override - OutputStream createFile(String path) { - def target = new File(root, path) - return target.newOutputStream() - } - - @Override - void setFileLastUpdatedDate(String path, long date) { - def target = new File(root, path) - target.setLastModified(date) - } -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/FileNode.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/FileNode.groovy deleted file mode 100644 index e17c28491..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/FileNode.groovy +++ /dev/null @@ -1,8 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -class FileNode extends AbstractFileTreeNode { - long size -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/TreePhysMapper.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/TreePhysMapper.groovy deleted file mode 100644 index 34ebce048..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/TreePhysMapper.groovy +++ /dev/null @@ -1,11 +0,0 @@ -package dirsync.model.tree - -abstract class TreePhysMapper { - abstract InputStream fileContent(T file) - abstract void createDirectory(String dir) - abstract void removeDirectory(String dir) - abstract void removeFile(String path) - abstract OutputStream createFile(String path) - - abstract void setFileLastUpdatedDate(String path, long date) -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/ZipData.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/ZipData.groovy deleted file mode 100644 index 12114e570..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/ZipData.groovy +++ /dev/null @@ -1,9 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -class ZipData { - String zipEntryName - String zipArchiveName -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/ZipTreeMapper.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/ZipTreeMapper.groovy deleted file mode 100644 index 3adb50f28..000000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/ZipTreeMapper.groovy +++ /dev/null @@ -1,72 +0,0 @@ -package dirsync.model.tree - -import dirsync.builder.FileTreeMerger -import dirsync.builder.ZipTreeBuilder -import sun.reflect.generics.reflectiveObjects.NotImplementedException - -import java.util.zip.ZipFile - -public class ZipTreeMapper extends TreePhysMapper implements Closeable { - Map zipArchives = [:] - - void addZipArchive(String zipArchive) { - zipArchives[zipArchive] = new ZipFile(zipArchive) - } - - DirectoryNode buildFileTree() { - def root = new DirectoryNode() - zipArchives.each { ze -> - def zipTree = ZipTreeBuilder.buildForZipArchive(ze.key, ze.value) - root = FileTreeMerger.mergeTrees(root, zipTree) - } - - return root - } - - @Override - void close() throws IOException { - zipArchives.each { ze -> - try { ze.value.close() } catch (Exception ignored) { } - } - } - - @Override - InputStream fileContent(ZipData file) { - def archive = zipArchives[file.zipArchiveName] - if (!archive) { - throw new RuntimeException("Archive ${file.zipArchiveName} is not loaded"); - } - - def zipEntry = archive.getEntry(file.zipEntryName) - if (!zipEntry) { - throw new RuntimeException("File ${file.zipEntryName} not found in archive ${file.zipArchiveName}"); - } - - return archive.getInputStream(zipEntry) - } - - @Override - void createDirectory(String dir) { - throw new NotImplementedException() - } - - @Override - void removeDirectory(String dir) { - throw new NotImplementedException() - } - - @Override - void removeFile(String path) { - throw new NotImplementedException() - } - - @Override - OutputStream createFile(String path) { - throw new NotImplementedException() - } - - @Override - void setFileLastUpdatedDate(String path, long date) { - throw new NotImplementedException() - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestExtension.groovy b/buildSrc/src/main/groovy/gradlecpp/CppUnitTestExtension.groovy deleted file mode 100644 index 26ea726e5..000000000 --- a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestExtension.groovy +++ /dev/null @@ -1,19 +0,0 @@ -package gradlecpp - -import org.gradle.api.Project -import org.gradle.nativeplatform.NativeBinarySpec - -class CppUnitTestExtension { - Project _project - - CppUnitTestExtension(Project p) { - _project = p - } - - void eachTestExecutable(Closure action) { - _project.binaries.each { NativeBinarySpec bin -> - if (!bin.hasProperty('cppUnitTestsExecutable')) return - action(bin) - } - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestPlugin.groovy b/buildSrc/src/main/groovy/gradlecpp/CppUnitTestPlugin.groovy deleted file mode 100644 index 986eb472d..000000000 --- a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestPlugin.groovy +++ /dev/null @@ -1,242 +0,0 @@ -package gradlecpp - -import gradlecpp.teamcity.TeamCityIntegration -import org.gradle.api.Action -import org.gradle.api.GradleException -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.internal.project.AbstractProject -import org.gradle.model.internal.core.DirectNodeModelAction -import org.gradle.model.internal.core.ModelActionRole -import org.gradle.model.internal.core.ModelPath -import org.gradle.model.internal.core.ModelReference -import org.gradle.model.internal.core.MutableModelNode -import org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor -import org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor -import org.gradle.model.internal.registry.ModelRegistry -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.internal.AbstractNativeBinarySpec - -import org.doomedsociety.gradlecpp.GradleCppUtils - -class CppUnitTestPlugin implements Plugin { - - private static class TestExecStatus { - boolean successful - int exitCode - String output - long durationMsec - String cmdLine - String execDir - } - - static void onBinariesCreated(Project p, String desc, Closure action) { - ModelRegistry mr = (p as AbstractProject).getModelRegistry() - def modelPath = ModelPath.path("binaries") - ModelRuleDescriptor ruleDescriptor = new SimpleModelRuleDescriptor(desc); - - mr.configure(ModelActionRole.Finalize, DirectNodeModelAction.of(ModelReference.of(modelPath), ruleDescriptor, new Action() { - @Override - void execute(MutableModelNode node) { - action() - } - })) - } - - @Override - void apply(Project project) { - project.extensions.create('cppUnitTest', CppUnitTestExtension, project) - onBinariesCreated(project, 'CppUnitTestPlugin::AttachUnitTest', { - processCppUnitTests(project) - }) - } - - - - /** - * Attaches test tasks to C/C++ libraries build tasks - */ - static void processCppUnitTests(Project p) { - //println "processCppUnitTests::afterEvaluate on ${p.name}: project type is ${p.projectType}" - - p.binaries.all { NativeBinarySpec bin -> - if (!(bin.component instanceof NativeLibrarySpec)) { - return - } - - def testComponentName = bin.component.name + '_tests' - Collection testCandidates = p.binaries.matching { it.component.name == testComponentName && bin.buildType == it.buildType && bin.flavor == it.flavor } - if (testCandidates.size() > 1) { - throw new GradleException("Found >1 test candidates for library ${bin.component.name} in project ${p}: ${testCandidates}") - } else if (!testCandidates.empty) { - def testBinary = testCandidates.first() - GradleCppUtils.onTasksCreated(p, 'CppUnitTestPlugin::AttachUnitTestTask', { - attachTestTaskToCppLibrary(bin, testBinary) - }) - String testTaskName = bin.namingScheme.getTaskName('unitTest') - bin.ext.cppUnitTestTask = testTaskName - } else { - throw new GradleException("No tests found for library ${bin.component.name} in project ${p}") - } - } - - } - - static TestExecStatus runTestExecutable(NativeBinarySpec testSubject, String executable, List params, String phase, int timeout) { - def execFile = new File(executable) - def outDir = new File(testSubject.buildTask.project.buildDir, "tests/${testSubject.name}/run") - outDir.mkdirs() - - def outPath = new File(outDir, "${phase}.log") - - def cmdParams = []; - cmdParams << execFile.absolutePath - cmdParams.addAll(params) - - def execDir = execFile.parentFile - def pb = new ProcessBuilder(cmdParams).redirectErrorStream(true).directory(execDir) - if (!GradleCppUtils.windows) { - pb.environment().put('LD_LIBRARY_PATH', '.') - } - - - def sout = new StringBuffer() - - long startTime = System.currentTimeMillis() - def p = pb.start() - p.consumeProcessOutput(sout, sout) - - p.waitForOrKill(timeout * 1000) - long endTime = System.currentTimeMillis() - - int exitVal = p.exitValue() - - outPath.withWriter('UTF-8') { writer -> - writer.write(sout.toString()) - } - - return new TestExecStatus( - exitCode: exitVal, - successful: (exitVal == 0), - output: sout.toString(), - durationMsec: endTime - startTime, - cmdLine: cmdParams.join(' '), - execDir: execDir.absolutePath - ) - } - - static void dumpTestExecStatus(TestExecStatus stat) { - if (!stat) { - println "Execution of test executable failed" - } - - println "Test executable command: ${stat.cmdLine}" - println "Test executable run directury: ${stat.execDir}" - println "Test executable exit code: ${stat.exitCode}" - println "Test executable output BEGIN" - println stat.output - println "Test executable output END" - } - - static void attachTestTaskToCppLibrary(NativeBinarySpec libBin, NativeBinarySpec testExecBin) { - Project p = libBin.buildTask.project - - def libBinImpl = libBin as AbstractNativeBinarySpec - def libLinkTask = GradleCppUtils.getLinkTask(libBin) - def testExecLinkTask = GradleCppUtils.getLinkTask(testExecBin) - - // collect all output files from library and test executable - def depFiles = [] - depFiles.addAll(libLinkTask.outputs.files.files) - depFiles.addAll(testExecLinkTask.outputs.files.files) - - //create 'tests' task - def testTaskName = libBinImpl.namingScheme.getTaskName('unitTest') - def testTask = p.task(testTaskName, { Task testTask -> - - //output dir - def testResDir = new File(p.buildDir, "tests/${libBin.name}") - - //inputs/outputs for up-to-date check - testTask.outputs.dir testResDir - testTask.inputs.files depFiles - - //dependencies on library and test executable - testTask.dependsOn libLinkTask - testTask.dependsOn testExecLinkTask - - // binary build depends on unit test - libBin.buildTask.dependsOn testTask - - // extra project-specific dependencies - def testDepsTask = p.tasks.findByName('testDeps') - if (testDepsTask != null) { - testTask.dependsOn testDepsTask - } - - // task actions - testTask.doLast { - - //temporary file that store info about all tests (XML) - File allTests = File.createTempFile('j4s-testinfo', 'data') - allTests.deleteOnExit() - - //fill file with test info - print "Fetching test info..." - def getTestsStatus = runTestExecutable(libBin, testExecBin.executableFile.absolutePath, ['-writeTestInfo', allTests.absolutePath], '__getTests', 5000) - if (!getTestsStatus.successful) { - println " Failed" - dumpTestExecStatus(getTestsStatus) - throw new GradleException("Unable to fetch test names") - } - println " OK" - getTestsStatus = null // allow GC to collect it - - // parse the test info file - def root = new XmlSlurper().parse(allTests) - - // run all tests - println "Running ${root.test.size()} tests..." - TeamCityIntegration.suiteStarted("unitTests.${libBin.name}") - int failCount = 0; - root.test.list().each { testInfo -> - def testName = '' + testInfo.@name.text() - def testGroup = '' + testInfo.@group.text() - def testTimeout = ('' + testInfo.@timeout.text()) as int - - if (!TeamCityIntegration.writeOutput) { - print " ${testGroup}-${testName}..." - System.out.flush() - } - - TeamCityIntegration.testStarted("${testGroup}-${testName}") - def testExecStatus = runTestExecutable(libBin, testExecBin.executableFile.absolutePath, ['-runTest', testGroup, testName], "${testGroup}-${testName}", testTimeout) - if (!testExecStatus.successful) { - if (!TeamCityIntegration.writeOutput) { - println " Failed" - } - - TeamCityIntegration.testFailed("${testGroup}-${testName}", "test executable return code is ${testExecStatus.exitCode}", "test executable return code is ${testExecStatus.exitCode}") - dumpTestExecStatus(testExecStatus) - failCount++ - } else { - if (!TeamCityIntegration.writeOutput) { - println " OK" - } - } - - TeamCityIntegration.testStdOut("${testGroup}-${testName}", testExecStatus.output) - TeamCityIntegration.testFinished("${testGroup}-${testName}", testExecStatus.durationMsec) - - } - TeamCityIntegration.suiteFinished("unitTests.${libBin.name}") - - if (failCount) { - throw new GradleException("CPP unit tests: ${failCount} tests failed"); - } - } - }) - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/RegameDLLPlayTestPlugin.groovy b/buildSrc/src/main/groovy/gradlecpp/RegameDLLPlayTestPlugin.groovy deleted file mode 100644 index 639cb22e8..000000000 --- a/buildSrc/src/main/groovy/gradlecpp/RegameDLLPlayTestPlugin.groovy +++ /dev/null @@ -1,17 +0,0 @@ -package gradlecpp - -import org.gradle.api.Plugin -import org.gradle.api.Project - -class RegamedllPlayTestPlugin implements Plugin { - @Override - void apply(Project project) { - project.configurations { - regamedll_playtest_image - } - - project.dependencies { - regamedll_playtest_image 'regamedll.testimg:testimg:2.0' - } - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/RegameDLLPlayTestTask.groovy b/buildSrc/src/main/groovy/gradlecpp/RegameDLLPlayTestTask.groovy deleted file mode 100644 index 0fe4947d6..000000000 --- a/buildSrc/src/main/groovy/gradlecpp/RegameDLLPlayTestTask.groovy +++ /dev/null @@ -1,86 +0,0 @@ -package gradlecpp - -import gradlecpp.teamcity.TeamCityIntegration -import org.apache.commons.lang.SystemUtils -import org.gradle.api.DefaultTask -import org.gradle.api.file.FileCollection -import org.gradle.api.tasks.TaskAction -import org.gradle.nativeplatform.NativeBinarySpec -import regamedll.testdemo.RegamedllDemoRunner -import regamedll.testdemo.RegamedllTestParser - -class RegamedllPlayTestTask extends DefaultTask { - - def FileCollection testDemos - def Closure postExtractAction - def File regamedllImageRoot - def File regamedllTestLogs - def NativeBinarySpec testFor - - @TaskAction - def doPlay() { - if (!SystemUtils.IS_OS_WINDOWS) { - return - } - - if (!testDemos) { - println 'RegamedllPlayTestTask: no demos attached to the testDemos property' - } - - regamedllImageRoot.mkdirs() - regamedllTestLogs.mkdirs() - - def demoRunner = new RegamedllDemoRunner(this.project.configurations.regamedll_playtest_image.getFiles(), regamedllImageRoot, postExtractAction) - - println "Preparing engine..." - demoRunner.prepareEngine() - - println "Running ${testDemos.getFiles().size()} ReGameDLL_CS test demos..." - - TeamCityIntegration.suiteStarted("regamedllDemo.${testFor.name}") - int failCount = 0; - testDemos.getFiles().each { f -> - - demoRunner.prepareEngine(); - def testInfo = RegamedllTestParser.parseTestInfo(f) - - TeamCityIntegration.testStarted(testInfo.testName) - - if (!TeamCityIntegration.writeOutput) { - println "Running ReGameDLL_CS test demo ${testInfo.testName} " - System.out.flush() - } - - println "Preparing files for test demo ${testInfo.testName} " - - demoRunner.prepareDemo(f) - - def testRes = demoRunner.runTest(testInfo, regamedllTestLogs) - - if (testRes.success) { - if (!TeamCityIntegration.writeOutput) { - println ' OK' - } - } else { - - TeamCityIntegration.testFailed(testInfo.testName, "Exit code: ${testRes.returnCode}", "Exit code: ${testRes.returnCode}") - if (!TeamCityIntegration.writeOutput) { - println ' Failed' - println "ReGameDLL_CS testdemo ${testInfo.testName} playback failed. Exit status is ${testRes.returnCode}." - println "Dumping console output:" - println testRes.hldsConsoleOutput - } - - failCount++ - } - - TeamCityIntegration.testStdOut(testInfo.testName, testRes.hldsConsoleOutput) - TeamCityIntegration.testFinished(testInfo.testName, testRes.duration) - } - TeamCityIntegration.suiteFinished("regamedllDemo.${testFor.name}") - - if (failCount) { - throw new RuntimeException("ReGameDLL_CS testdemos: failed ${failCount} tests") - } - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy b/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy deleted file mode 100644 index b318714df..000000000 --- a/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy +++ /dev/null @@ -1,38 +0,0 @@ -package gradlecpp - -import org.apache.velocity.Template -import org.apache.velocity.VelocityContext -import org.apache.velocity.app.Velocity -import org.joda.time.format.DateTimeFormat - -class VelocityUtils { - - static { - Properties p = new Properties(); - - p.setProperty("resource.loader", "class"); - p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); - p.setProperty("class.resource.loader.path", ""); - - p.setProperty("input.encoding", "UTF-8"); - p.setProperty("output.encoding", "UTF-8"); - - Velocity.init(p); - } - - static String renderTemplate(File tplFile, Map ctx) { - Template tpl = Velocity.getTemplate(tplFile.absolutePath) - if (!tpl) { - throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found") - } - - - def velocityContext = new VelocityContext(ctx) - velocityContext.put("_DateTimeFormat", DateTimeFormat) - - def sw = new StringWriter() - tpl.merge(velocityContext, sw) - - return sw.toString() - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/teamcity/TeamCityIntegration.groovy b/buildSrc/src/main/groovy/gradlecpp/teamcity/TeamCityIntegration.groovy deleted file mode 100644 index 9832a8518..000000000 --- a/buildSrc/src/main/groovy/gradlecpp/teamcity/TeamCityIntegration.groovy +++ /dev/null @@ -1,84 +0,0 @@ -package gradlecpp.teamcity - -import groovy.transform.CompileStatic - - -class TeamCityIntegration { - - static final String flowId = System.getenv('TEAMCITY_PROCESS_FLOW_ID') - static final boolean underTeamcity = System.getenv('TEAMCITY_PROJECT_NAME') - static boolean writeOutput = underTeamcity - - @CompileStatic - private static String escape(String s) { - StringBuilder sb = new StringBuilder((int)(s.length() * 1.2)); - for (char c in s.chars) { - switch (c) { - case '\n': sb.append('|n'); break; - case '\r': sb.append('|r'); break; - case '\'': sb.append('|\''); break; - case '|': sb.append('||'); break; - case ']': sb.append('|]'); break; - default: sb.append(c); - } - } - - return sb.toString() - } - - @CompileStatic - static void writeMessage(String name, Map params) { - if (!writeOutput) return - StringBuilder sb = new StringBuilder() - sb.append('##teamcity[').append(name) - params.each { e -> - if (e.value != null) { - sb.append(' ').append('' + e.key).append('=\'').append(escape('' + e.value)).append('\'') - } - } - sb.append(']') - - println sb.toString() - } - - static void suiteStarted(String suiteName) { - writeMessage('testSuiteStarted', [name: suiteName, flowId: flowId ?: null]) - } - - static void suiteFinished(String suiteName) { - writeMessage('testSuiteFinished', [name: suiteName, flowId: flowId ?: null]) - } - - static void testStarted(String testName) { - writeMessage('testStarted', [name: testName, flowId: flowId ?: null]) - } - - static void testStdOut(String testName, String output) { - writeMessage('testStdOut', [name: testName, out: output, flowId: flowId ?: null]) - } - - static void testFinished(String testName, long durationMs) { - writeMessage('testFinished', [ - name: testName, - flowId: flowId ?: null, - duration: (durationMs >= 0) ? durationMs : null - ]) - } - - static void testFailed(String testName, String message, String details) { - writeMessage('testFailed', [ - name: testName, - flowId: flowId ?: null, - message: message, - details: details - ]) - } - - static void testIgnored(String testName, String message) { - writeMessage('testIgnored', [ - name: testName, - flowId: flowId ?: null, - message: message, - ]) - } -} diff --git a/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLDemoRunner.groovy b/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLDemoRunner.groovy deleted file mode 100644 index 6f78a4c86..000000000 --- a/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLDemoRunner.groovy +++ /dev/null @@ -1,106 +0,0 @@ -package regamedll.testdemo - -import dirsync.builder.FileSystemTreeBuilder -import dirsync.merger.FileTreeComparator -import dirsync.merger.FileTreeDiffApplier -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FSMapper -import dirsync.model.tree.ZipData -import dirsync.model.tree.ZipTreeMapper -import org.apache.ant.compress.taskdefs.Unzip -import org.apache.tools.ant.types.PatternSet; - -class RegamedllDemoRunner { - ZipTreeMapper regamedllImage = new ZipTreeMapper() - File rootDir - DirectoryNode engineImageTree - Closure postExtract - - static class TestResult { - boolean success - int returnCode - String hldsConsoleOutput - long duration - } - - RegamedllDemoRunner(Collection engineImageZips, File rootDir, Closure postExtract) { - this.rootDir = rootDir - engineImageZips.each { f -> - regamedllImage.addZipArchive(f.absolutePath) - } - engineImageTree = regamedllImage.buildFileTree() - this.postExtract = postExtract - } - - void prepareDemo(File demoArchive) { - - if (demoArchive == null) { - throw new RuntimeException("ReGameDLL_CS testdemos: file is null") - } - - PatternSet patt = new PatternSet(); - - patt.setExcludes("**/*.bin"); - patt.setExcludes("**/*.xml"); - - //patt.setIncludes("**/cstrike/*"); - //patt.setIncludes("**/czero/*"); - //patt.setIncludes("**/valve/*"); - - Unzip unzipper = new Unzip(); - - unzipper.setDest( rootDir ); // directory unzipped - unzipper.setSrc( demoArchive ); // zip file - unzipper.addPatternset( patt ); - unzipper.execute(); - } - - void prepareEngine() { - def existingTree = FileSystemTreeBuilder.buildFileSystemTree(rootDir) - def cmds = FileTreeComparator.mergeTrees(engineImageTree, existingTree) - - FSMapper fsMapper = new FSMapper(rootDir) - FileTreeDiffApplier.applyDiffs(cmds, regamedllImage, fsMapper) - if (postExtract != null) { - postExtract.run() - } - } - - TestResult runTest(RegamedllTestInfo info, File testLogDir) { - long startTime = System.currentTimeMillis() - - //prepareEngine() - - def outPath = new File(testLogDir, "${info.testName}_run.log") - - def cmdParams = [] - cmdParams << new File(rootDir, 'hlds.exe').absolutePath - cmdParams.addAll(info.hldsArgs) - if (info.regamedllExtraArgs) { - cmdParams.addAll(info.regamedllExtraArgs) - } - cmdParams << '--rehlds-test-play' << info.testBinFile.absolutePath - - def pb = new ProcessBuilder(cmdParams).redirectErrorStream(true).directory(rootDir) - def sout = new StringBuffer() - - def p = pb.start() - p.consumeProcessOutput(sout, sout) - - p.waitForOrKill(info.timeoutSeconds * 1000) - int exitVal = p.exitValue() - - outPath.withWriter('UTF-8') { writer -> - writer.write(sout.toString()) - } - - long endTime = System.currentTimeMillis() - - return new TestResult( - success: (exitVal == 777), - returnCode: exitVal, - hldsConsoleOutput: sout.toString(), - duration: endTime - startTime - ) - } -} diff --git a/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLTestInfo.groovy b/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLTestInfo.groovy deleted file mode 100644 index 560e00389..000000000 --- a/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLTestInfo.groovy +++ /dev/null @@ -1,9 +0,0 @@ -package regamedll.testdemo - -class RegamedllTestInfo { - String testName - List hldsArgs - String regamedllExtraArgs - int timeoutSeconds - File testBinFile -} diff --git a/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLTestParser.groovy b/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLTestParser.groovy deleted file mode 100644 index bf54f159f..000000000 --- a/buildSrc/src/main/groovy/regamedll/testdemo/RegameDLLTestParser.groovy +++ /dev/null @@ -1,63 +0,0 @@ -package regamedll.testdemo - -import groovy.util.slurpersupport.GPathResult -import org.apache.commons.io.IOUtils - -import java.util.zip.ZipFile - -class RegamedllTestParser { - static final String REGAMEDLL_TEST_METAINFO_FILE = 'regamedll_test_metainfo.xml' - - static RegamedllTestInfo parseTestInfo(File testArchive) { - def zf = new ZipFile(testArchive); - try { - def metaInfoEntry = zf.getEntry(REGAMEDLL_TEST_METAINFO_FILE) - if (metaInfoEntry == null) { - throw new RuntimeException("Unable to open ${REGAMEDLL_TEST_METAINFO_FILE} in ${testArchive.absolutePath}") - } - - GPathResult metaInfo = null - zf.getInputStream(metaInfoEntry).withStream { InputStream ins -> - metaInfo = new XmlSlurper().parse(ins) - } - - RegamedllTestInfo testInfo = new RegamedllTestInfo( - testName: metaInfo.name.text(), - hldsArgs: metaInfo.runArgs.arg.list().collect { it.text().trim() }, - timeoutSeconds: metaInfo.timeout.text() as int - ) - - //validate testInfo - if (!testInfo.testName) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: test name is not specified") - } - - if (!testInfo.hldsArgs) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: run arguments are not specified") - } - - if (testInfo.timeoutSeconds <= 0) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: bad timeout") - } - - def testBinName = testInfo.testName + '.bin' - def testBinEntry = zf.getEntry(testBinName) - if (testBinEntry == null) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: test binary ${testBinName} not found inside archive") - } - - testInfo.testBinFile = File.createTempFile(testBinName, 'regamedll') - testInfo.testBinFile.deleteOnExit() - zf.getInputStream(testBinEntry).withStream { InputStream ins -> - testInfo.testBinFile.withOutputStream { OutputStream os -> - IOUtils.copy(ins, os) - } - } - - return testInfo - } finally { - try { zf.close() } catch (Exception ignored) { } - } - - } -} diff --git a/buildSrc/src/main/groovy/versioning/GitInfo.groovy b/buildSrc/src/main/groovy/versioning/GitInfo.groovy deleted file mode 100644 index e0ad38f87..000000000 --- a/buildSrc/src/main/groovy/versioning/GitInfo.groovy +++ /dev/null @@ -1,16 +0,0 @@ -package versioning - -import groovy.transform.CompileStatic -import groovy.transform.TypeChecked -import org.joda.time.DateTime - -@CompileStatic @TypeChecked -class GitInfo { - boolean localChanges - DateTime commitDate - String branch - String tag - String commitSHA - String commitURL - Integer commitCount -} diff --git a/buildSrc/src/main/groovy/versioning/GitVersioner.groovy b/buildSrc/src/main/groovy/versioning/GitVersioner.groovy deleted file mode 100644 index e60f91460..000000000 --- a/buildSrc/src/main/groovy/versioning/GitVersioner.groovy +++ /dev/null @@ -1,140 +0,0 @@ -package versioning - -import java.util.Set; - -import groovy.transform.CompileStatic -import groovy.transform.TypeChecked -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.api.Status; -import org.eclipse.jgit.lib.ObjectId -import org.eclipse.jgit.lib.Repository -import org.eclipse.jgit.lib.StoredConfig -import org.eclipse.jgit.submodule.SubmoduleWalk; -import org.eclipse.jgit.revwalk.RevCommit -import org.eclipse.jgit.revwalk.RevWalk -import org.eclipse.jgit.storage.file.FileRepositoryBuilder -import org.joda.time.DateTime -import org.joda.time.DateTimeZone - -@CompileStatic @TypeChecked -class GitVersioner { - - static GitInfo versionForDir(String dir) { - versionForDir(new File(dir)) - } - static int getCountCommit(Repository repo) { - Iterable commits = Git.wrap(repo).log().call() - int count = 0; - commits.each { - count++; - } - - return count; - } - static String prepareUrlToCommits(String url) { - if (url == null) { - // default remote url - return "https://github.com/s1lentq/ReGameDLL_CS/commit/"; - } - - StringBuilder sb = new StringBuilder(); - String childPath; - int pos = url.indexOf('@'); - if (pos != -1) { - childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/'); - sb.append('https://'); - } else { - pos = url.lastIndexOf('.git'); - childPath = (pos == -1) ? url : url.substring(0, pos); - } - - // support for different links to history of commits - if (url.indexOf('bitbucket.org') != -1) { - sb.append(childPath).append('/commits/'); - } else { - sb.append(childPath).append('/commit/'); - } - return sb.toString(); - } - // check uncommited changes - static boolean getUncommittedChanges(Repository repo) { - Git git = new Git(repo); - Status status = git.status().setIgnoreSubmodules(SubmoduleWalk.IgnoreSubmoduleMode.ALL).call(); - Set uncommittedChanges = status.getUncommittedChanges(); - System.err.println ' UncommittedChanges: ' + uncommittedChanges - - if (!uncommittedChanges.isEmpty()) { - System.err.println 'getUncommittedChanges details' - System.err.println ' Added: ' + status.getAdded() - System.err.println ' Changed: ' + status.getChanged() - System.err.println ' Removed: ' + status.getRemoved() - System.err.println ' Missing: ' + status.getMissing() - System.err.println ' Modified: ' + status.getModified() - System.err.println ' Conflicting: ' + status.getConflicting() - - System.err.println ' ConflictingStageState: ' + status.getConflictingStageState() - System.err.println ' IgnoredNotInIndex: ' + status.getIgnoredNotInIndex() - System.err.println ' Untracked: ' + status.getUntracked() - System.err.println ' UntrackedFolders: ' + status.getUntrackedFolders() - - return true; - } - - return false; - } - static GitInfo versionForDir(File dir) { - FileRepositoryBuilder builder = new FileRepositoryBuilder(); - Repository repo = builder.setWorkTree(dir) - .findGitDir() - .build() - - ObjectId head = repo.resolve('HEAD'); - if (!head) { - return null - } - - final StoredConfig cfg = repo.getConfig(); - def commit = new RevWalk(repo).parseCommit(head); - if (!commit) { - throw new RuntimeException("Can't find last commit."); - } - - def localChanges = getUncommittedChanges(repo); - def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC); - if (localChanges) { - commitDate = new DateTime(); - } - - def branch = repo.getBranch(); - - String url = null; - String remote_name = cfg.getString("branch", branch, "remote"); - - if (remote_name == null) { - for (String remotes : cfg.getSubsections("remote")) { - if (url != null) { - println 'Found a second remote: (' + remotes + '), url: (' + cfg.getString("remote", remotes, "url") + ')' - continue; - } - - url = cfg.getString("remote", remotes, "url"); - } - } else { - url = cfg.getString("remote", remote_name, "url"); - } - - String commitURL = prepareUrlToCommits(url); - String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key - String commitSHA = commit.getId().abbreviate(7).name(); - - return new GitInfo( - localChanges: localChanges, - commitDate: commitDate, - branch: branch, - tag: tag, - commitSHA: commitSHA, - commitURL: commitURL, - commitCount: getCountCommit(repo) - ) - } -} diff --git a/buildSrc/src/main/groovy/versioning/RegamedllVersionInfo.groovy b/buildSrc/src/main/groovy/versioning/RegamedllVersionInfo.groovy deleted file mode 100644 index 8151e6364..000000000 --- a/buildSrc/src/main/groovy/versioning/RegamedllVersionInfo.groovy +++ /dev/null @@ -1,58 +0,0 @@ -package versioning - -import groovy.transform.CompileStatic -import groovy.transform.ToString -import groovy.transform.TypeChecked -import org.joda.time.format.DateTimeFormat -import org.joda.time.DateTime - -@CompileStatic @TypeChecked -@ToString(includeNames = true) -class RegamedllVersionInfo { - Integer majorVersion - Integer minorVersion - Integer maintenanceVersion - String suffix - - boolean localChanges - DateTime commitDate - String commitSHA - String commitURL - Integer commitCount - - String asMavenVersion(boolean extra = true) { - StringBuilder sb = new StringBuilder() - sb.append(majorVersion).append('.' + minorVersion); - if (maintenanceVersion != null) { - sb.append('.' + maintenanceVersion); - } - - if (commitCount != null) { - sb.append('.' + commitCount) - } - - if (extra && suffix) { - sb.append('-' + suffix) - } - - // do mark for this build like a modified version - if (extra && localChanges) { - sb.append('+m'); - } - - return sb.toString() - } - String asCommitDate(String pattern = null) { - if (pattern == null) { - pattern = "MMM d yyyy"; - if (commitDate.getDayOfMonth() >= 10) { - pattern = "MMM d yyyy"; - } - } - - return DateTimeFormat.forPattern(pattern).withLocale(Locale.ENGLISH).print(commitDate); - } - String asCommitTime() { - return DateTimeFormat.forPattern('HH:mm:ss').withLocale(Locale.ENGLISH).print(commitDate); - } -} diff --git a/buildSrc/src/test/groovy/dirsync/builder/ZipTreeBuilderTest.groovy b/buildSrc/src/test/groovy/dirsync/builder/ZipTreeBuilderTest.groovy deleted file mode 100644 index 38a2eabb2..000000000 --- a/buildSrc/src/test/groovy/dirsync/builder/ZipTreeBuilderTest.groovy +++ /dev/null @@ -1,44 +0,0 @@ -package dirsync.builder - -import org.junit.Test - -import java.io.File - -import dirsync.builder.ZipTreeBuilder - -import java.util.zip.ZipEntry -import java.util.zip.ZipFile -import java.util.zip.ZipOutputStream; - -import static org.junit.Assert.*; - -class ZipTreeBuilderTest { - - @Test - void test1() { - File zipFile = File.createTempFile('ZipTreeBuilderTest', 'zip') - zipFile.deleteOnExit() - - new ZipOutputStream(zipFile.newDataOutputStream()).withStream { ZipOutputStream zos -> - zos.putNextEntry(new ZipEntry('aRootFile1.txt')) - zos.write(65) //'A' - - zos.putNextEntry(new ZipEntry('dir1/')) - zos.putNextEntry(new ZipEntry('dir1/dir2/')) - - zos.putNextEntry(new ZipEntry('dir1/dir2/d1d2f1.txt')) - zos.write(65); zos.write(66) //'AB' - - zos.putNextEntry(new ZipEntry('dir1/d1f1.txt')) - zos.write(65); zos.write(66); zos.write(67) //'ABC' - - zos.putNextEntry(new ZipEntry('zRootFile2.txt')) - zos.write(65); zos.write(66); zos.write(67); zos.write(68) //'ABCD' - } - - ZipFile zf = new ZipFile(zipFile.absolutePath) - def tree = ZipTreeBuilder.buildForZipArchive(zipFile.absolutePath, zf) - - assert tree.childNodes.size() == 3 - } -} \ No newline at end of file diff --git a/dep/cppunitlite/build.gradle b/dep/cppunitlite/build.gradle deleted file mode 100644 index fd0196b94..000000000 --- a/dep/cppunitlite/build.gradle +++ /dev/null @@ -1,62 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -void setupToolchain(NativeBinarySpec b) { - def cfg = rootProject.createToolchainConfig(b) - - ToolchainConfigUtils.apply(project, cfg, b) -} - -model { - buildTypes { - debug - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - cppunitlite(NativeLibrarySpec) { - targetPlatform 'x86' - - sources { - cppul_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - } - - exportedHeaders { - srcDir "include" - } - } - } - - binaries.all { NativeBinarySpec b -> - project.setupToolchain(b) - } - } - } -} diff --git a/dep/cppunitlite/include/cppunitlite/Assertions.h b/dep/cppunitlite/include/cppunitlite/Assertions.h index 380012110..58da03a40 100644 --- a/dep/cppunitlite/include/cppunitlite/Assertions.h +++ b/dep/cppunitlite/include/cppunitlite/Assertions.h @@ -7,8 +7,8 @@ class Assertions { static void StringEquals(std::string message, std::string expected, std::string actual, const char* fileName, long lineNumber); static void StringEquals(std::string message, const char* expected, const char* actual, const char* fileName, long lineNumber); - - static void ConditionFailed(std::string message, std::string condition, const char* fileName, long lineNumber); + + static void ConditionFailed(std::string message, std::string condition, const char* fileName, long lineNumber, bool onlyWarning = false); static void LongEquals(std::string message, long expected, long actual, const char* fileName, long lineNumber); diff --git a/dep/cppunitlite/include/cppunitlite/Failure.h b/dep/cppunitlite/include/cppunitlite/Failure.h index 447c3de9b..8be49ec9e 100644 --- a/dep/cppunitlite/include/cppunitlite/Failure.h +++ b/dep/cppunitlite/include/cppunitlite/Failure.h @@ -6,12 +6,13 @@ class TestFailException : public std::exception { public: - TestFailException(std::string message, std::string fileName, long lineNumber) { + TestFailException(std::string message, std::string fileName, long lineNumber, bool onlyWarning = false) { std::stringstream ss; ss << message << " at " << fileName << " line " << lineNumber; this->message = ss.str(); this->fileName = fileName; this->lineNumber = lineNumber; + this->warning = onlyWarning; } virtual ~TestFailException() throw() { @@ -21,6 +22,7 @@ class TestFailException : public std::exception { std::string message; std::string fileName; long lineNumber; + bool warning; virtual const char * what() const throw() { return message.c_str(); @@ -35,6 +37,7 @@ class Failure { this->message = e.message; this->fileName = e.fileName; this->lineNumber = e.lineNumber; + this->warning = e.warning; } Failure (std::string message, std::string testName) { @@ -48,6 +51,7 @@ class Failure { std::string message; std::string fileName; long lineNumber; + bool warning; }; diff --git a/dep/cppunitlite/include/cppunitlite/GradleAdapter.h b/dep/cppunitlite/include/cppunitlite/MainAdapter.h similarity index 91% rename from dep/cppunitlite/include/cppunitlite/GradleAdapter.h rename to dep/cppunitlite/include/cppunitlite/MainAdapter.h index 8319d8639..bdf2488bd 100644 --- a/dep/cppunitlite/include/cppunitlite/GradleAdapter.h +++ b/dep/cppunitlite/include/cppunitlite/MainAdapter.h @@ -1,6 +1,6 @@ #pragma once -class GradleAdapter { +class MainAdapter { public: int writeAllTestsInfoToFile(const char* fname); int runTest(const char* groupName, const char* testName); diff --git a/dep/cppunitlite/include/cppunitlite/Test.h b/dep/cppunitlite/include/cppunitlite/Test.h index bd7acf051..6f1cefa37 100644 --- a/dep/cppunitlite/include/cppunitlite/Test.h +++ b/dep/cppunitlite/include/cppunitlite/Test.h @@ -20,7 +20,7 @@ class Test void setNext(Test *test); Test *getNext () const; void run(TestResult& result); - + const char* getName() { return name_.c_str(); } @@ -28,7 +28,7 @@ class Test const char* getGroup() { return group_.c_str(); } - + int getTimeout() { return timeout_; } @@ -47,7 +47,7 @@ class Test { public: testGroup##testName##Test () : Test (#testName , #testGroup , testTimeout) {} \ void runInternal (); } \ testGroup##testName##Instance; \ - void testGroup##testName##Test::runInternal() + void testGroup##testName##Test::runInternal() @@ -55,6 +55,9 @@ class Test } \ } +#define CHECK_WARNING_OUT(msg, condition) { if (!(condition)) { Assertions::ConditionFailed(msg,#condition, __FILE__, __LINE__, true); return; \ + } \ +} #define ZSTR_EQUAL(msg,expected,actual) { \ Assertions::StringEquals((msg), (expected), (actual), __FILE__, __LINE__); \ diff --git a/dep/cppunitlite/include/cppunitlite/TestResult.h b/dep/cppunitlite/include/cppunitlite/TestResult.h index a59c9aebe..f67bfa936 100644 --- a/dep/cppunitlite/include/cppunitlite/TestResult.h +++ b/dep/cppunitlite/include/cppunitlite/TestResult.h @@ -13,6 +13,10 @@ class TestResult int getFailureCount() { return failureCount; } + int getWarningCount() { + return warningCount; + } private: int failureCount; + int warningCount; }; diff --git a/dep/cppunitlite/msvc/cppunitlite.vcxproj b/dep/cppunitlite/msvc/cppunitlite.vcxproj index 01c982efe..e3cb49a66 100644 --- a/dep/cppunitlite/msvc/cppunitlite.vcxproj +++ b/dep/cppunitlite/msvc/cppunitlite.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -30,7 +30,7 @@ {CEB94F7C-E459-4673-AABB-36E2074396C0} Win32Proj cppunitlite - 12.0 + 12.0 @@ -42,15 +42,6 @@ v142 MultiByte - - StaticLibrary - true - v120 - v140 - v141 - v142 - MultiByte - StaticLibrary false @@ -78,7 +69,7 @@ Level3 Disabled - WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions) MultiThreadedDebug $(ProjectDir)..\include\ CompileAsCpp diff --git a/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters b/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters index 54af26d70..2a8d9160f 100644 --- a/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters +++ b/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters @@ -27,7 +27,7 @@ include - + include @@ -44,7 +44,7 @@ src - + src diff --git a/dep/cppunitlite/src/Assertions.cpp b/dep/cppunitlite/src/Assertions.cpp index 1d79fc0c3..4eb90e1b3 100644 --- a/dep/cppunitlite/src/Assertions.cpp +++ b/dep/cppunitlite/src/Assertions.cpp @@ -27,13 +27,13 @@ void Assertions::StringEquals(std::string message, const char *expected, const c } } -void Assertions::ConditionFailed(std::string message, std::string condition, const char *fileName, long lineNumber) { +void Assertions::ConditionFailed(std::string message, std::string condition, const char *fileName, long lineNumber, bool onlyWarning) { std::stringstream ss; ss << message << " (condition failed: " << condition << ")"; - throw TestFailException(ss.str(), std::string(fileName), lineNumber); + throw TestFailException(ss.str(), std::string(fileName), lineNumber, onlyWarning); } -void Assertions::LongEquals(std::string message, long expected, long actual, const char *fileName, long lineNumber) { +void Assertions::LongEquals(std::string message, long expected, long actual, const char* fileName, long lineNumber) { if (expected != actual) { std::stringstream ss; ss << message << " (expected '" << expected << "', got '" << actual << "')"; @@ -41,7 +41,7 @@ void Assertions::LongEquals(std::string message, long expected, long actual, con } } -void Assertions::UInt32Equals(std::string message, unsigned int expected, unsigned int actual, const char *fileName, long lineNumber) { +void Assertions::UInt32Equals(std::string message, unsigned int expected, unsigned int actual, const char* fileName, long lineNumber) { if (expected != actual) { std::stringstream ss; ss << message << " (expected '" << expected << "', got '" << actual << "')"; @@ -49,7 +49,7 @@ void Assertions::UInt32Equals(std::string message, unsigned int expected, unsign } } -void Assertions::CharEquals(std::string message, char expected, char actual, const char *fileName, long lineNumber) { +void Assertions::CharEquals(std::string message, char expected, char actual, const char* fileName, long lineNumber) { if (expected != actual) { std::stringstream ss; ss << message << " (expected '" << expected << "', got '" << actual << "')"; @@ -57,15 +57,15 @@ void Assertions::CharEquals(std::string message, char expected, char actual, con } } -void Assertions::DoubleEquals(std::string message, double expected, double actual, double epsilon, const char *fileName, long lineNumber) { - if (std::abs(expected - actual) > epsilon) { +void Assertions::DoubleEquals(std::string message, double expected, double actual, double epsilon, const char* fileName, long lineNumber) { + if (std::fabs(expected - actual) > epsilon) { std::stringstream ss; ss << message << " (expected '" << expected << "', got '" << actual << "')"; throw TestFailException(ss.str(), std::string(fileName), lineNumber); } } -void Assertions::MemoryEquals(std::string message, void *expected, void *actual, int size, const char *fileName, long lineNumber) { +void Assertions::MemoryEquals(std::string message, void* expected, void* actual, int size, const char* fileName, long lineNumber) { if (memcmp(expected, actual, size)) { std::stringstream ss; ss << message << " (expected '"; diff --git a/dep/cppunitlite/src/GradleAdapter.cpp b/dep/cppunitlite/src/MainAdapter.cpp similarity index 76% rename from dep/cppunitlite/src/GradleAdapter.cpp rename to dep/cppunitlite/src/MainAdapter.cpp index 47dbd24c0..6c446a62e 100644 --- a/dep/cppunitlite/src/GradleAdapter.cpp +++ b/dep/cppunitlite/src/MainAdapter.cpp @@ -2,11 +2,11 @@ #include #include -#include "cppunitlite/GradleAdapter.h" +#include "cppunitlite/MainAdapter.h" #include "cppunitlite/Test.h" #include "cppunitlite/TestRegistry.h" -int GradleAdapter::writeAllTestsInfoToFile(const char *fname) { +int MainAdapter::writeAllTestsInfoToFile(const char *fname) { FILE *outFile = fopen(fname, "w"); if (!outFile) { return 1; @@ -32,7 +32,7 @@ int GradleAdapter::writeAllTestsInfoToFile(const char *fname) { return 0; } -int GradleAdapter::runTest(const char *groupName, const char *testName) { +int MainAdapter::runTest(const char *groupName, const char *testName) { Test *curTest = TestRegistry::getFirstTest(); while (curTest) { if (!strcmp(groupName, curTest->getGroup()) && !strcmp(testName, curTest->getName())) { @@ -52,14 +52,18 @@ int GradleAdapter::runTest(const char *groupName, const char *testName) { if (result.getFailureCount()) { return 1; } + else if (result.getWarningCount()) { + return 3; + } else { return 0; } } -int GradleAdapter::runGroup(const char *groupName) { +int MainAdapter::runGroup(const char *groupName) { Test *curTest = TestRegistry::getFirstTest(); int ranTests = 0; + int warnTest = 0; while (curTest) { if (strcmp(groupName, curTest->getGroup())) { curTest = curTest->getNext(); @@ -74,6 +78,10 @@ int GradleAdapter::runGroup(const char *groupName) { return 1; } + if (result.getWarningCount()) { + warnTest++; + } + curTest = curTest->getNext(); } @@ -82,13 +90,19 @@ int GradleAdapter::runGroup(const char *groupName) { return 2; } + if (warnTest > 0) { + printf("There were no test failures, but with warnings: %d; Tests executed: %d\n", warnTest, ranTests); + return 3; + } + printf("There were no test failures; Tests executed: %d\n", ranTests); return 0; } -int GradleAdapter::runAllTests() { +int MainAdapter::runAllTests() { Test *curTest = TestRegistry::getFirstTest(); int ranTests = 0; + int warnTest = 0; while (curTest) { TestResult result; curTest->run(result); @@ -98,14 +112,23 @@ int GradleAdapter::runAllTests() { return 1; } + if (result.getWarningCount()) { + warnTest++; + } + curTest = curTest->getNext(); } + if (warnTest > 0) { + printf("There were no test failures, but with warnings: %d; Tests executed: %d\n", warnTest, ranTests); + return 3; + } + printf("There were no test failures; Tests executed: %d\n", ranTests); return 0; } -int GradleAdapter::testsEntryPoint(int argc, char *argv[]) { +int MainAdapter::testsEntryPoint(int argc, char *argv[]) { if (argc < 2 || !strcmp(argv[1], "-all")) { return runAllTests(); } diff --git a/dep/cppunitlite/src/Test.cpp b/dep/cppunitlite/src/Test.cpp index 14eb5f073..3246868ca 100644 --- a/dep/cppunitlite/src/Test.cpp +++ b/dep/cppunitlite/src/Test.cpp @@ -3,9 +3,10 @@ #include "cppunitlite/Failure.h" #include +#include #include -Test::Test (const char* testName, const char* testGroup, int timeout) +Test::Test(const char *testName, const char *testGroup, int timeout) : name_ (testName), group_ (testGroup), timeout_(timeout) { next_ = nullptr; @@ -18,15 +19,17 @@ Test *Test::getNext() const } void Test::setNext(Test *test) -{ +{ next_ = test; } -void Test::run(TestResult &result) { +void Test::run(TestResult &result) +{ try { runInternal(); - } catch (TestFailException *e) { - result.addFailure(Failure(*e, name_)); + std::cout << "Test::run() > " << group_ << "::" << name_ << " Passed" << std::endl; + } catch (TestFailException &e) { + result.addFailure(Failure(e, name_)); } catch (std::exception &e) { std::stringstream ss; ss << "unexpected exception " << e.what(); diff --git a/dep/cppunitlite/src/TestRegistry.cpp b/dep/cppunitlite/src/TestRegistry.cpp index ce7c7b928..6f1f9ae4a 100644 --- a/dep/cppunitlite/src/TestRegistry.cpp +++ b/dep/cppunitlite/src/TestRegistry.cpp @@ -1,50 +1,44 @@ - - #include "cppunitlite/Test.h" #include "cppunitlite/TestResult.h" #include "cppunitlite/TestRegistry.h" - -void TestRegistry::addTest (Test *test) +void TestRegistry::addTest(Test *test) { - instance ().add (test); + instance().add(test); } - -void TestRegistry::runAllTests (TestResult& result) +void TestRegistry::runAllTests(TestResult &result) { - instance ().run (result); + instance().run(result); } -Test* TestRegistry::getFirstTest() { +Test *TestRegistry::getFirstTest() { return instance().tests; } - -TestRegistry& TestRegistry::instance () + +TestRegistry& TestRegistry::instance() { static TestRegistry registry; return registry; } - -void TestRegistry::add (Test *test) +void TestRegistry::add(Test *test) { if (tests == 0) { tests = test; return; } - - test->setNext (tests); + + test->setNext(tests); tests = test; } - -void TestRegistry::run (TestResult& result) +void TestRegistry::run(TestResult &result) { - result.testsStarted (); + result.testsStarted(); - for (Test *test = tests; test != 0; test = test->getNext ()) - test->run (result); - result.testsEnded (); -} + for (Test *test = tests; test; test = test->getNext()) + test->run(result); + result.testsEnded(); +} diff --git a/dep/cppunitlite/src/TestResult.cpp b/dep/cppunitlite/src/TestResult.cpp index a5aff8005..aebc9b19d 100644 --- a/dep/cppunitlite/src/TestResult.cpp +++ b/dep/cppunitlite/src/TestResult.cpp @@ -1,38 +1,48 @@ - #include "cppunitlite/TestResult.h" #include "cppunitlite/Failure.h" #include #include - -TestResult::TestResult () - : failureCount (0) +TestResult::TestResult() + : failureCount(0), warningCount(0) { } - -void TestResult::testsStarted () +void TestResult::testsStarted() { } - -void TestResult::addFailure (const Failure& failure) { +void TestResult::addFailure(const Failure& failure) +{ std::stringstream ss; - ss << "Failure in test '" << failure.testName << "' :" << failure.message; + ss << (failure.warning ? "Warning in test '" : "Failure in test '") << failure.testName << "' :" << failure.message; std::cout << ss.str() << std::endl; std::cout.flush(); - failureCount++; -} + if (failure.warning) { + warningCount++; + } + else + failureCount++; +} -void TestResult::testsEnded () { +void TestResult::testsEnded() +{ std::stringstream ss; if (failureCount > 0) { ss << "There were " << failureCount << " failures"; - } else { + if (warningCount > 0) { + ss << ", and " << warningCount << " warnings"; + } + } + else if (warningCount > 0) { + ss << "There were " << warningCount << " warnings"; + } + else { ss << "There were no test failures"; } + std::cout << ss.str() << std::endl; std::cout.flush(); } diff --git a/getucrtinfo.bat b/getucrtinfo.bat deleted file mode 100644 index 29f5bb163..000000000 --- a/getucrtinfo.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off - -if defined VS150COMNTOOLS ( - if not exist "%VS150COMNTOOLS%vcvarsqueryregistry.bat" goto NoVS - call "%VS150COMNTOOLS%vcvarsqueryregistry.bat" - goto :run -) else if defined VS140COMNTOOLS ( - if not exist "%VS140COMNTOOLS%vcvarsqueryregistry.bat" goto NoVS - call "%VS140COMNTOOLS%vcvarsqueryregistry.bat" - goto :run -) - -:NoVS -echo Error: Visual Studio 2015 or 2017 required. -exit /b 1 - -:run -echo %UniversalCRTSdkDir% -echo %UCRTVersion% diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index b58725dd8..000000000 --- a/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -majorVersion=5 -minorVersion=20 -maintenanceVersion=0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 175c642d9..000000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index c6638f3f9..000000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Sat Jun 06 16:31:05 BRT 2015 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/gradlew b/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index 8a0b282aa..000000000 --- a/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/msvc/ReGameDLL.sln b/msvc/ReGameDLL.sln index 4b77eda3c..bd8d6aced 100644 --- a/msvc/ReGameDLL.sln +++ b/msvc/ReGameDLL.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31025.194 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReGameDLL", "..\regamedll\msvc\ReGameDLL.vcxproj", "{70A2B904-B7DB-4C48-8DE0-AF567360D572}" ProjectSection(ProjectDependencies) = postProject @@ -10,14 +10,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReGameDLL", "..\regamedll\m EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppunitlite", "..\dep\cppunitlite\msvc\cppunitlite.vcxproj", "{CEB94F7C-E459-4673-AABB-36E2074396C0}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gradle", "gradle", "{DB570330-2FEE-4C39-971B-340019B6E661}" - ProjectSection(SolutionItems) = preProject - ..\build.gradle = ..\build.gradle - ..\gradle.properties = ..\gradle.properties - ..\settings.gradle = ..\settings.gradle - ..\shared.gradle = ..\shared.gradle - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug Play|Win32 = Debug Play|Win32 @@ -51,4 +43,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E442B676-1D5A-48D0-BFCC-D5D3BAD32ECF} + EndGlobalSection EndGlobal diff --git a/publish.gradle b/publish.gradle deleted file mode 100644 index a0c1fc03f..000000000 --- a/publish.gradle +++ /dev/null @@ -1,142 +0,0 @@ -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.apache.commons.io.FilenameUtils - -void _copyFileToDir(String from, String to) { - if (!project.file(from).exists()) { - println 'WARNING: Could not find: ' + from; - return; - } - - if (!project.file(to).exists()) { - project.file(to).mkdirs(); - } - - def dst = new File(project.file(to), FilenameUtils.getName(from)) - GradleCppUtils.copyFile(project.file(from), dst, false) -} - -void _copyFile(String from, String to) { - if (!project.file(from).exists()) { - println 'WARNING: Could not find: ' + from; - return; - } - - GradleCppUtils.copyFile(project.file(from), project.file(to), false) -} - -task publishPrepareFiles { - doLast { - 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/bin/win32/cstrike/dlls').mkdirs() - project.file('publish/publishRoot/bin/linux32/cstrike/dlls').mkdirs() - - // bugfixed binaries - _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') - - // copy files from folder dist - copy { - from('dist') - into 'publish/publishRoot/bin/win32/cstrike' - } - - copy { - from('dist') - into 'publish/publishRoot/bin/linux32/cstrike' - } - - // cssdk - project.file('publish/publishRoot/cssdk').mkdirs() - copy { - from 'regamedll/extra/cssdk' - into 'publish/publishRoot/cssdk' - } - } -} - -task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') { - baseName = "regamedll-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 - properties { - commitDate project.ext.regamedllVersionInfo.commitDate - commitSHA project.ext.regamedllVersionInfo.commitSHA - } - - //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() -project.ext.repoCreds = repoCreds -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('dev')) { - url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-dev/" - } else { - url "http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/" - } - credentials { - username repoCreds.getProperty('username') - password repoCreds.getProperty('password') - } - } - } -} - -task doPublish { - dependsOn 'publishPackage' - if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) { - dependsOn 'publish' - } -} diff --git a/regamedll/build.gradle b/regamedll/build.gradle deleted file mode 100644 index 848bb01ed..000000000 --- a/regamedll/build.gradle +++ /dev/null @@ -1,444 +0,0 @@ -import gradlecpp.RegamedllPlayTestPlugin -import gradlecpp.RegamedllPlayTestTask -import gradlecpp.VelocityUtils - -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.doomedsociety.gradlecpp.LazyNativeDepSet -import org.doomedsociety.gradlecpp.cfg.ToolchainConfig -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.msvc.EnhancedInstructionsSet -import org.doomedsociety.gradlecpp.msvc.FloatingPointModel -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.gradle.language.cpp.CppSourceSet -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeExecutableSpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.SharedLibraryBinarySpec -import regamedll.testdemo.RegamedllDemoRunner -import versioning.RegamedllVersionInfo -import org.apache.commons.io.FilenameUtils -import org.apache.commons.compress.archivers.ArchiveInputStream - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin -apply plugin: RegamedllPlayTestPlugin -apply plugin: gradlecpp.CppUnitTestPlugin - -repositories { - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/' - } -} - -configurations { - regamedll_tests -} - -dependencies { - regamedll_tests 'regamedll.testdemos:cstrike-basic:1.0' -} - -project.ext.dep_cppunitlite = project(':dep/cppunitlite') - -void createIntergrationTestTask(NativeBinarySpec b) { - boolean regamedllFixes = b.flavor.name.contains('regamedllFixes') - - if (!(b instanceof SharedLibraryBinarySpec)) return - if (!GradleCppUtils.windows) return - if (regamedllFixes) return - - String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null - - def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RegamedllPlayTestTask) - demoItgTestTask.with { - regamedllImageRoot = new File(project.projectDir, '_regamedllTestImg') - regamedllTestLogs = new File(this.project.buildDir, "_regamedllTestLogs/${b.name}") - testDemos = project.configurations.regamedll_tests - testFor = b - - // inputs/outputs for up-to-date check - inputs.files testDemos.files - outputs.dir regamedllTestLogs - - // dependencies on test executable - if (unitTestTask) { - dependsOn unitTestTask - } - - postExtractAction { - def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b) - def binaryOutDir = new File(project.projectDir, '/_regamedllTestImg/cstrike/dlls') - GradleCppUtils.copyFile(binaryOutFile, new File(binaryOutDir, binaryOutFile.name), true) - } - } - - b.buildTask.dependsOn demoItgTestTask -} - -void postEvaluate(NativeBinarySpec b) { - - // attach generateAppVersion task to all 'compile source' tasks - GradleCppUtils.getCompileTasks(b).each { Task t -> - t.dependsOn project.generateAppVersion - } - - createIntergrationTestTask(b) -} - -void setupToolchain(NativeBinarySpec b) -{ - boolean useGcc = project.hasProperty("useGcc") - boolean useClang = project.hasProperty("useClang") - boolean unitTestExecutable = b.component.name.endsWith('_tests') - boolean regamedllFixes = b.flavor.name.contains('regamedllFixes') - - ToolchainConfig cfg = rootProject.createToolchainConfig(b) - cfg.projectInclude(project, '', '/engine', '/common', '/dlls', '/game_shared', '/pm_shared', '/regamedll', '/public', '/public/regamedll') - - if (unitTestExecutable) - { - cfg.projectInclude(dep_cppunitlite, '/include') - b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true) - } - - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'REGAMEDLL_SELF', 'REGAMEDLL_API', 'CLIENT_WEAPONS', 'USE_QSTRING' - - if (cfg instanceof MsvcToolchainConfig) - { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'regamedll_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - if (!regamedllFixes) - { - cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE - cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED - } - else { - cfg.compilerOptions.args '/Oi', '/GF', '/GS', '/GR' - } - - cfg.projectLibpath(project, '/lib') - cfg.extraLibs 'libacof32.lib' - } - else if (cfg instanceof GccToolchainConfig) - { - if (!useGcc && !useClang) - { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'regamedll_pch' - ); - } - - cfg.compilerOptions.languageStandard = 'c++14' - cfg.defines([ - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_strdup': 'strdup', - '_unlink': 'unlink', - '_vsnprintf': 'vsnprintf', - '_write' : 'write', - '_close' : 'close', - '_vsnwprintf' : 'vswprintf', - '_access' : 'access' - ]) - - if (useGcc || useClang) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-msse3', '-Wno-write-strings', '-Wno-invalid-offsetof', '-fpermissive', '-Wno-switch', '-Wno-unused-value', '-Wno-enum-compare' - - if (useGcc) { - cfg.compilerOptions.args '-fno-devirtualize' - } - else { - cfg.compilerOptions.args '-fno-strict-vtable-pointers', '-Wno-overloaded-virtual' - } - - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - - // Not use c++ class hierarchy for analyze and resolve C++ virtual function calls at compile time. - // - // Example issue: - // Expected: FF .. call dword ptr + offset, pEntity->Spawn(); - // Got: E8 .. call CBaseEntity::Spawn(); - cfg.linkerOptions.args '-qno-opt-class-analysis' - } - - if (cfg.linkerOptions.staticLibStdCpp) { - cfg.singleDefines 'BUILD_STATIC_LIBSTDC' - } - - cfg.compilerOptions.args '-g0', '-fno-exceptions' - cfg.projectLibpath(project, '/lib/linux32') - cfg.extraLibs 'dl', 'm', 'aelf32' - } - - if (GradleCppUtils.windows && !unitTestExecutable) { - cfg.linkerOptions.definitionFile = "${projectDir}\\msvc\\mp.def"; - } - - if (unitTestExecutable) { - cfg.singleDefines 'REGAMEDLL_UNIT_TESTS' - } - - if (regamedllFixes) { - cfg.singleDefines 'REGAMEDLL_FIXES', 'BUILD_LATEST', 'BUILD_LATEST_FIXES', 'REGAMEDLL_CHECKS', 'REGAMEDLL_ADD', 'UNICODE_FIXES', 'NDEBUG' - } else { - cfg.singleDefines 'PLAY_GAMEDLL' - } - - ToolchainConfigUtils.apply(project, cfg, b) - GradleCppUtils.onTasksCreated(project, 'postEvaluate', { - postEvaluate(b) - }) -} - -class RegamedllSrc { - static void regamedll_src(def h) { - h.engine_src(CppSourceSet) { - source { - srcDir "engine" - include "unicode_strtools.cpp" - } - } - - h.shared_src(CppSourceSet) { - source { - srcDirs "game_shared", "pm_shared", "regamedll", "public", "version" - - include "**/*.cpp" - - exclude "precompiled.cpp" - exclude "tier0/dbg.cpp", "utlsymbol.cpp", "utlbuffer.cpp" - - if (GradleCppUtils.windows) - { - exclude "tier0/platform_linux.cpp" - } - else - { - exclude "tier0/platform_win32.cpp" - exclude "classes_dummy.cpp" - } - } - } - - h.gamedll_src(CppSourceSet) { - source { - srcDirs "dlls", "dlls/API", "dlls/addons" - include "**/*.cpp" - } - } - } - - static void regamedll_pch(def h) { - h.regamedll_pch(CppSourceSet) { - source { - srcDir "regamedll" - include "precompiled.cpp" - } - } - } - - static void regamedll_tests_gcc_src(def h) { - h.regamedll_tests_gcc_src(CppSourceSet) { - source { - srcDir "unittests" - include "**/*.cpp" - exclude "mathfun_tests.cpp" - } - } - } - - static void regamedll_tests_src(def h) { - h.regamedll_tests_src(CppSourceSet) { - source { - srcDir "unittests" - include "**/*.cpp" - } - } - } -} - -model { - buildTypes { - debug - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) { - } - if (project.hasProperty("useClang")) { - clang(Clang) - } - else if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - flavors { - regamedllNofixes - regamedllFixes - } - - components { - - regamedll_mp_gamedll(NativeLibrarySpec) { - targetPlatform 'x86' - baseName GradleCppUtils.windows ? 'mp' : 'cs' - sources { - RegamedllSrc.regamedll_pch(it) - RegamedllSrc.regamedll_src(it) - } - binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } - } - - regamedll_mp_gamedll_tests(NativeExecutableSpec) { - targetPlatform 'x86' - sources { - RegamedllSrc.regamedll_pch(it) - RegamedllSrc.regamedll_src(it) - - if (project.hasProperty("useGcc")) { - RegamedllSrc.regamedll_tests_gcc_src(it) - } else { - RegamedllSrc.regamedll_tests_src(it) - } - } - - binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } - } - } -} - -task buildFinalize << { - if (GradleCppUtils.windows) { - return; - } - - binaries.withType(SharedLibraryBinarySpec) { - def sharedBinary = it.getSharedLibraryFile(); - if (sharedBinary.exists()) { - sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", ""))); - } - } -} - -task buildRelease { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildFixes { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { - SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'regamedllFixes' && blib.component.name == 'regamedll_mp_gamedll' - } -} - -task buildDebug { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { - SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'debug' && blib.flavor.name == 'regamedllFixes' && blib.component.name == 'regamedll_mp_gamedll' - } -} - -buildFixes.finalizedBy(buildFinalize); -buildDebug.finalizedBy(buildFinalize); -buildRelease.finalizedBy(buildFinalize); - -gradle.taskGraph.whenReady { graph -> - if (!graph.hasTask(buildFixes) && !graph.hasTask(buildDebug)) { - return; - } - - // skip all tasks with the matched substrings in the name like "test" - def tasks = graph.getAllTasks(); - tasks.findAll { it.name.toLowerCase().contains("test") }.each { task -> - task.enabled = false; - } -} - -task prepareDevEnvTests { - def regamedllTests = new File(project.projectDir, '_dev/testDemos') - - inputs.files configurations.regamedll_tests.files - outputs.dir regamedllTests - - doLast { - regamedllTests.mkdirs() - configurations.regamedll_tests.files.each { File f -> - def t = zipTree(f) - copy { - into new File(regamedllTests, FilenameUtils.getBaseName(f.absolutePath)) - from t - } - } - } -} - -task prepareDevEnvGamedll << { - ['_dev/regamedll', '_dev/regamedll_mp'].each { gamedllDir -> - def regamedllImage = new File(project.projectDir, gamedllDir) - regamedllImage.mkdirs() - def demoRunner = new RegamedllDemoRunner(project.configurations.regamedll_playtest_image.getFiles(), regamedllImage, null) - demoRunner.prepareEngine() - //demoRunner.prepareDemo() - } -} - -task prepareDevEnv { - dependsOn prepareDevEnvGamedll, prepareDevEnvTests -} - -tasks.clean.doLast { - project.file('version/appversion.h').delete() -} - -task generateAppVersion { - - RegamedllVersionInfo verInfo = (RegamedllVersionInfo)rootProject.regamedllVersionInfo - def tplFile = project.file('version/appversion.vm') - def renderedFile = project.file('version/appversion.h') - - // check to up-to-date - inputs.file tplFile - inputs.file project.file('gradle.properties') - outputs.file renderedFile - - // this will ensure that this task is redone when the versions change - inputs.property('version', rootProject.version) - inputs.property('commitDate', verInfo.asCommitDate()) - - println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']"; - - doLast { - def templateCtx = [ - verInfo: verInfo - ] - - def content = VelocityUtils.renderTemplate(tplFile, templateCtx) - renderedFile.delete() - renderedFile.write(content, 'utf-8') - - println 'The current ReGameDLL maven version is ' + rootProject.version + ', url: (' + verInfo.commitURL + '' + verInfo.commitSHA + ')'; - } -} diff --git a/regamedll/dlls/API/CAPI_Impl.h b/regamedll/dlls/API/CAPI_Impl.h index cd69b345c..d967b5161 100644 --- a/regamedll/dlls/API/CAPI_Impl.h +++ b/regamedll/dlls/API/CAPI_Impl.h @@ -100,11 +100,21 @@ g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\ } +#define LINK_HOOK_VOID_CHAIN2(functionName)\ + void functionName() {\ + g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\ + } + #define LINK_HOOK_CHAIN(ret, functionName, args, ...)\ ret functionName args {\ return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc, __VA_ARGS__);\ } +#define LINK_HOOK_CHAIN2(ret, functionName)\ + ret functionName() {\ + return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\ + } + #define LINK_HOOK_GLOB_CLASS_VOID_CHAIN(className, functionName, args, ...)\ void className::functionName args {\ g_ReGameHookchains.m_##functionName.callChain(className::functionName##_OrigFunc, __VA_ARGS__);\ @@ -120,16 +130,7 @@ return g_ReGameHookchains.m_##customFuncName.callChain(functionName##_OrigFunc, __VA_ARGS__);\ } -#define LINK_HOOK_VOID_CHAIN2(functionName)\ - void functionName() {\ - g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\ - } - -#define LINK_HOOK_CHAIN2(ret, functionName)\ - ret functionName() {\ - return g_ReGameHookchains.m_##functionName.callChain(functionName##_OrigFunc);\ - } -#else +#else // REGAMEDLL_API #define __API_HOOK(fname)\ fname @@ -141,14 +142,19 @@ #define LINK_HOOK_CLASS_CHAIN3(...) #define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(...) #define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(...) +#define LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN(...) +#define LINK_HOOK_CLASS_VOID_CUSTOM2_CHAIN2(...) #define LINK_HOOK_CLASS_CUSTOM_CHAIN(...) #define LINK_HOOK_CLASS_CUSTOM_CHAIN2(...) +#define LINK_HOOK_CLASS_CUSTOM2_CHAIN(...) +#define LINK_HOOK_CLASS_CUSTOM2_CHAIN2(...) #define LINK_HOOK_VOID_CHAIN(...) #define LINK_HOOK_VOID_CHAIN2(...) #define LINK_HOOK_CHAIN(...) #define LINK_HOOK_CHAIN2(...) #define LINK_HOOK_GLOB_CLASS_VOID_CHAIN(...) #define LINK_HOOK_GLOB_CLASS_CHAIN(...) +#define LINK_HOOK_CUSTOM2_CHAIN(...) #endif // REGAMEDLL_API diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index f15919269..29cc90c1d 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -10082,13 +10082,13 @@ void EXT_FUNC CBasePlayer::__API_HOOK(SetSpawnProtection)(float flProtectionTime { #ifdef REGAMEDLL_ADD if (respawn_immunity_effects.value > 0) -#endif { pev->rendermode = kRenderTransAdd; pev->renderamt = 100.0f; } CSPlayer()->m_flSpawnProtectionEndTime = gpGlobals->time + flProtectionTime; +#endif } LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, RemoveSpawnProtection) @@ -10097,7 +10097,6 @@ void CBasePlayer::__API_HOOK(RemoveSpawnProtection)() { #ifdef REGAMEDLL_ADD if (respawn_immunity_effects.value > 0) -#endif { if (pev->rendermode == kRenderTransAdd && pev->renderamt == 100.0f) @@ -10108,6 +10107,7 @@ void CBasePlayer::__API_HOOK(RemoveSpawnProtection)() } CSPlayer()->m_flSpawnProtectionEndTime = 0.0f; +#endif } LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, DropIdlePlayer, (const char *reason), reason) diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 1fbdc231c..72c3eeacf 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -834,8 +834,9 @@ void CBasePlayerWeapon::HandleInfiniteAmmo() { m_iClip = iMaxClip(); } - else if ((nInfiniteAmmo == WPNMODE_INFINITE_BPAMMO && + else if ((nInfiniteAmmo == WPNMODE_INFINITE_BPAMMO #ifdef REGAMEDLL_API + && ((m_pPlayer->CSPlayer()->m_iWeaponInfiniteIds & (1 << m_iId)) || (m_pPlayer->CSPlayer()->m_iWeaponInfiniteIds <= 0 && !IsGrenadeWeapon(m_iId))) #endif ) @@ -1136,6 +1137,7 @@ void CBasePlayerItem::AttachToPlayer(CBasePlayer *pPlayer) void CBasePlayerWeapon::Spawn() { +#ifdef REGAMEDLL_API ItemInfo info; Q_memset(&info, 0, sizeof(info)); @@ -1144,6 +1146,7 @@ void CBasePlayerWeapon::Spawn() } CSPlayerWeapon()->m_bHasSecondaryAttack = HasSecondaryAttack(); +#endif } // CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 6efc44f23..82257a64d 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -425,7 +425,7 @@ class CBasePlayerWeapon: public CBasePlayerItem int m_iShellId; float m_fMaxSpeed; bool m_bDelayFire; - int m_iDirection; + BOOL m_iDirection; bool m_bSecondarySilencerOn; float m_flAccuracy; float m_flLastFire; diff --git a/regamedll/msvc/PreBuild.bat b/regamedll/msvc/PreBuild.bat index ebb10a879..38dac0442 100644 --- a/regamedll/msvc/PreBuild.bat +++ b/regamedll/msvc/PreBuild.bat @@ -77,14 +77,6 @@ IF EXIST "%srcdir%\version.h" ( IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k ) ) -) ELSE ( - FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do ( - IF NOT [%%j] == [] ( - IF %%i==majorVersion set version_major=%%j - IF %%i==minorVersion set version_minor=%%j - IF %%i==maintenanceVersion set version_maintenance=%%j - ) - ) ) :: @@ -210,11 +202,5 @@ echo.>>"%srcdir%\appversion.h" echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" echo.>>"%srcdir%\appversion.h" -:: -:: Do update of version.cpp file last modify time to force it recompile -:: -copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp" -endlocal - :_exit exit /B 0 diff --git a/regamedll/msvc/ReGameDLL.vcxproj b/regamedll/msvc/ReGameDLL.vcxproj index 8ff292c80..41eb3d36d 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj +++ b/regamedll/msvc/ReGameDLL.vcxproj @@ -31,10 +31,22 @@ - - - - + + + + + + + + + + + + + + + + @@ -580,7 +592,6 @@ true true - @@ -610,7 +621,10 @@ - + + + + @@ -781,22 +795,6 @@ - - - true - true - true - true - true - - - true - true - true - true - true - - {ceb94f7c-e459-4673-aabb-36e2074396c0} @@ -811,6 +809,7 @@ {70A2B904-B7DB-4C48-8DE0-AF567360D572} ReGameDLL 12.0 + 10.0 @@ -820,7 +819,7 @@ v120 v140 v141 - v142 + v142 DynamicLibrary @@ -829,7 +828,7 @@ v120 v140 v141 - v142 + v142 true @@ -839,7 +838,7 @@ v120 v140 v141 - v142 + v142 true @@ -849,7 +848,7 @@ v120 v140 v141 - v142 + v142 Application @@ -857,7 +856,7 @@ v120_xp v140_xp v141_xp - v142 + v142 MultiByte @@ -906,7 +905,7 @@ - filesystem_stdio + mp AllRules.ruleset @@ -921,7 +920,7 @@ Level3 Disabled true - REGAMEDLL_ADD;REGAMEDLL_API;REGAMEDLL_SSE;REGAMEDLL_FIXES;REGAMEDLL_SELF;BUILD_LATEST;BUILD_LATEST_FIXES;UNICODE_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) + REGAMEDLL_ADD;REGAMEDLL_API;REGAMEDLL_FIXES;REGAMEDLL_SSE;REGAMEDLL_SELF;REGAMEDLL_CHECKS;UNICODE_FIXES;BUILD_LATEST;BUILD_LATEST_FIXES;CLIENT_WEAPONS;USE_QSTRING;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) Fast /arch:IA32 %(AdditionalOptions) MultiThreadedDebug @@ -957,7 +956,7 @@ Level3 Full true - REGAMEDLL_ADD;REGAMEDLL_SSE;REGAMEDLL_API;REGAMEDLL_FIXES;REGAMEDLL_SELF;REGAMEDLL_CHECKS;BUILD_LATEST;BUILD_LATEST_FIXES;UNICODE_FIXES;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + REGAMEDLL_ADD;REGAMEDLL_API;REGAMEDLL_FIXES;REGAMEDLL_SSE;REGAMEDLL_SELF;REGAMEDLL_CHECKS;UNICODE_FIXES;BUILD_LATEST;BUILD_LATEST_FIXES;CLIENT_WEAPONS;USE_QSTRING;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) Fast /arch:IA32 %(AdditionalOptions) MultiThreaded @@ -1002,7 +1001,7 @@ Level3 Full true - PLAY_GAMEDLL;REGAMEDLL_SELF;REGAMEDLL_API;REGAMEDLL_SSE;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + PLAY_GAMEDLL;REGAMEDLL_SELF;REGAMEDLL_CHECKS;REGAMEDLL_API;REGAMEDLL_SSE;CLIENT_WEAPONS;USE_QSTRING;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreaded @@ -1047,7 +1046,7 @@ Level3 Disabled true - PLAY_GAMEDLL;REGAMEDLL_SELF;REGAMEDLL_CHECKS;REGAMEDLL_API;REGAMEDLL_SSE;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;USE_QSTRING;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) + PLAY_GAMEDLL;REGAMEDLL_SSE;REGAMEDLL_SELF;REGAMEDLL_CHECKS;REGAMEDLL_API;CLIENT_WEAPONS;USE_QSTRING;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreadedDebug @@ -1083,7 +1082,7 @@ Level3 Disabled true - REGAMEDLL_FIXES;REGAMEDLL_SELF;UNICODE_FIXES;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;USE_QSTRING;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) + REGAMEDLL_API;REGAMEDLL_FIXES;REGAMEDLL_SELF;REGAMEDLL_SSE;UNICODE_FIXES;USE_QSTRING;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) MultiThreadedDebug Use precompiled.h diff --git a/regamedll/msvc/ReGameDLL.vcxproj.filters b/regamedll/msvc/ReGameDLL.vcxproj.filters index 900ba66cc..d8c27981d 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj.filters +++ b/regamedll/msvc/ReGameDLL.vcxproj.filters @@ -10,10 +10,6 @@ {fe7a8e81-b7d4-4540-ab5b-457ed93672ce} - - {9de0de20-070f-4fae-a9df-3dca942e65a7} - false - {d74cb79e-afd5-4215-af0e-029e38925be0} @@ -76,9 +72,6 @@ - - version - regamedll @@ -1057,12 +1050,4 @@ dlls\addons - - - linux - - - linux - - \ No newline at end of file diff --git a/regamedll/unittests/TestRunner.cpp b/regamedll/unittests/TestRunner.cpp index e02dd5e5c..5964144b9 100644 --- a/regamedll/unittests/TestRunner.cpp +++ b/regamedll/unittests/TestRunner.cpp @@ -1,16 +1,10 @@ #include "precompiled.h" -#include "cppunitlite/GradleAdapter.h" +#include "cppunitlite/MainAdapter.h" int main(int argc, char *argv[]) { printf("TestRunner: main()\n"); - GradleAdapter a; - int res = a.testsEntryPoint(argc, argv); - -#ifdef _BUILD_FROM_IDE - system("PAUSE"); -#endif - - return res; + MainAdapter a; + return a.testsEntryPoint(argc, argv); } diff --git a/regamedll/version/appversion.sh b/regamedll/version/appversion.sh index 553e3311a..68c35862f 100755 --- a/regamedll/version/appversion.sh +++ b/regamedll/version/appversion.sh @@ -3,9 +3,9 @@ init() { SOURCE_DIR="$@" - GIT_DIR="$SOURCE_DIR/.." - VERSION_FILE="$GIT_DIR/gradle.properties" - APPVERSION_FILE="$SOURCE_DIR/version/appversion.h" + GIT_DIR=$SOURCE_DIR + VERSION_FILE=$SOURCE_DIR/regamedll/version/version.h + APPVERSION_FILE=$SOURCE_DIR/regamedll/version/appversion.h if test -z "`git --version`"; then echo "Please install git client" @@ -25,17 +25,17 @@ init() fi # Get major, minor and maintenance information from gradle.properties - MAJOR=$(sed -nr -e '/majorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + MAJOR=$(cat "$VERSION_FILE" | grep -wi 'VERSION_MAJOR' | sed -e 's/.*VERSION_MAJOR.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g') if [ $? -ne 0 -o "$MAJOR" = "" ]; then MAJOR=0 fi - MINOR=$(sed -nr -e '/minorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + MINOR=$(cat "$VERSION_FILE" | grep -wi 'VERSION_MINOR' | sed -e 's/.*VERSION_MINOR.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g') if [ $? -ne 0 -o "$MINOR" = "" ]; then MINOR=0 fi - MAINTENANCE=$(sed -nr -e '/maintenanceVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + MAINTENANCE=$(cat "$VERSION_FILE" | grep -i 'VERSION_MAINTENANCE' | sed -e 's/.*VERSION_MAINTENANCE.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g') if [ $? -ne 0 -o "$MAINTENANCE" = "" ]; then MAINTENANCE=0 fi @@ -66,20 +66,37 @@ init() # Get remote url COMMIT_URL=$(git -C "$GIT_DIR/" config remote.$BRANCH_REMOTE.url) - # Strip prefix 'git@' - COMMIT_URL=${COMMIT_URL#git@} + URL_CONSTRUCT=0 - # Strip postfix '.git' - COMMIT_URL=${COMMIT_URL%.git} + if [[ "$COMMIT_URL" == *"git@"* ]]; then + URL_CONSTRUCT=1 - # Replace ':' to '/' - COMMIT_URL=${COMMIT_URL/:/\/} + # Strip prefix 'git@' + COMMIT_URL=${COMMIT_URL#git@} - # Append extra string - if [ $? -ne 0 -o "$COMMIT_URL" = "${COMMIT_URL/bitbucket.org}" ]; then - COMMIT_URL=$(echo https://$COMMIT_URL/commits/) - else - COMMIT_URL=$(echo https://$COMMIT_URL/commit/) + # Strip postfix '.git' + COMMIT_URL=${COMMIT_URL%.git} + + # Replace ':' to '/' + COMMIT_URL=${COMMIT_URL/:/\/} + + elif [[ "$COMMIT_URL" == *"https://"* ]]; then + URL_CONSTRUCT=1 + + # Strip prefix 'https://' + COMMIT_URL=${COMMIT_URL#https://} + + # Strip postfix '.git' + COMMIT_URL=${COMMIT_URL%.git} + fi + + if test "$URL_CONSTRUCT" -eq 1; then + # Append extra string + if [[ "$COMMIT_URL" == *"bitbucket.org"* ]]; then + COMMIT_URL=$(echo https://$COMMIT_URL/commits/) + else + COMMIT_URL=$(echo https://$COMMIT_URL/commit/) + fi fi # @@ -101,7 +118,7 @@ init() update_appversion() { - day=$(date +%m) + day=$(date +%d) year=$(date +%Y) hours=$(date +%H:%M:%S) month=$(LANG=en_us_88591; date +"%b") diff --git a/regamedll/version/appversion.vm b/regamedll/version/appversion.vm deleted file mode 100644 index 486e5d923..000000000 --- a/regamedll/version/appversion.vm +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __APPVERSION_H__ -\#define __APPVERSION_H__ - -// -// This file is generated automatically. -// Don't edit it. -// - -// Version defines -\#define APP_VERSION "$verInfo.asMavenVersion()" - -\#define APP_COMMIT_DATE "$verInfo.asCommitDate()" -\#define APP_COMMIT_TIME "$verInfo.asCommitTime()" - -\#define APP_COMMIT_SHA "$verInfo.commitSHA" -\#define APP_COMMIT_URL "$verInfo.commitURL" - -#endif //__APPVERSION_H__ diff --git a/regamedll/version/version.cpp b/regamedll/version/version.cpp deleted file mode 100644 index 5089a5f3e..000000000 --- a/regamedll/version/version.cpp +++ /dev/null @@ -1,10 +0,0 @@ -/* -* Version declaration dependency file -* -*/ - -// -// This file needed just to add the dependency and appversion.h -// -#include "precompiled.h" - diff --git a/regamedll/version/version.h b/regamedll/version/version.h new file mode 100644 index 000000000..8d97dcbf4 --- /dev/null +++ b/regamedll/version/version.h @@ -0,0 +1,10 @@ +/* +* Version declaration dependency file +* +*/ + +#pragma once + +#define VERSION_MAJOR 5 +#define VERSION_MINOR 20 +#define VERSION_MAINTENANCE 0 diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 84f53582e..000000000 --- a/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ -rootProject.name = 'regamedll' -include 'dep/cppunitlite' -include 'regamedll' diff --git a/shared.gradle b/shared.gradle deleted file mode 100644 index 47ed31b10..000000000 --- a/shared.gradle +++ /dev/null @@ -1,54 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeExecutableBinarySpec -import org.gradle.nativeplatform.SharedLibraryBinarySpec -import org.gradle.nativeplatform.StaticLibraryBinarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply from: 'shared_msvc.gradle' -apply from: 'shared_icc.gradle' -apply from: 'shared_clang.gradle' -apply from: 'shared_gcc.gradle' - -rootProject.ext.createToolchainConfig = { NativeBinarySpec bin -> - BinaryKind binaryKind - if (bin instanceof NativeExecutableBinarySpec) - { - binaryKind = BinaryKind.EXECUTABLE - } - else if (bin instanceof SharedLibraryBinarySpec) - { - binaryKind = BinaryKind.SHARED_LIBRARY - } - else if (bin instanceof StaticLibraryBinarySpec) - { - binaryKind = BinaryKind.STATIC_LIBRARY - } - else - { - throw new RuntimeException("Unknown executable kind ${bin.class.name}") - } - - boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release' - if (bin.toolChain instanceof VisualCpp) - { - return rootProject.createMsvcConfig(releaseBuild, binaryKind) - } - else if (bin.toolChain instanceof Icc) - { - return rootProject.createIccConfig(releaseBuild, binaryKind) - } - else if (bin.toolChain instanceof Clang) - { - return rootProject.createClangConfig(releaseBuild, binaryKind) - } - else if (bin.toolChain instanceof Gcc) - { - return rootProject.createGccConfig(releaseBuild, binaryKind) - } - else - { - throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") - } -} diff --git a/shared_clang.gradle b/shared_clang.gradle deleted file mode 100644 index 9891ea246..000000000 --- a/shared_clang.gradle +++ /dev/null @@ -1,55 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.gcc.OptimizationLevel - -rootProject.ext.createClangConfig = { boolean release, BinaryKind binKind -> - GccToolchainConfig cfg - if (release) { - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.LEVEL_3, - stackProtector: false, - noBuiltIn: true, - positionIndependentCode: false, - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - stripSymbolTable: false, - staticLibGcc: false, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } else { - // debug - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.DISABLE, - stackProtector: true, - noBuiltIn: true, - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - stripSymbolTable: false, - staticLibGcc: false, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } - - cfg.singleDefines('LINUX', '_LINUX') - return cfg -} diff --git a/shared_gcc.gradle b/shared_gcc.gradle deleted file mode 100644 index 0240e4018..000000000 --- a/shared_gcc.gradle +++ /dev/null @@ -1,55 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.gcc.OptimizationLevel - -rootProject.ext.createGccConfig = { boolean release, BinaryKind binKind -> - GccToolchainConfig cfg - if (release) { - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.LEVEL_3, - stackProtector: false, - noBuiltIn: true, - positionIndependentCode: false, - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - stripSymbolTable: false, - staticLibGcc: false, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } else { - // debug - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.DISABLE, - stackProtector: true, - noBuiltIn: true, - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - stripSymbolTable: false, - staticLibGcc: false, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } - - cfg.singleDefines('LINUX', '_LINUX') - return cfg -} diff --git a/shared_icc.gradle b/shared_icc.gradle deleted file mode 100644 index c1baf3e1a..000000000 --- a/shared_icc.gradle +++ /dev/null @@ -1,66 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.gcc.OptimizationLevel - -rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind -> - GccToolchainConfig cfg - if (release) { - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.LEVEL_3, - stackProtector: false, - interProceduralOptimizations: true, // -ipo - - noBuiltIn: true, - - intelExtensions: false, - asmBlocks: true, - - positionIndependentCode: false, - - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, // don't use specific c++11 features from GCC 5.X for backward compatibility to earlier version ABI libstdc++.so.6 - ] - ), - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: true, // -ipo - stripSymbolTable: true, - staticLibStdCpp: false, - staticLibGcc: false, - staticIntel: true, - ), - librarianOptions: new GccToolchainConfig.LibrarianOptions( - ) - ) - } else { - // debug - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.DISABLE, - stackProtector: true, - interProceduralOptimizations: false, - - noBuiltIn: true, - intelExtensions: false, - asmBlocks: true, - - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, // don't use specific c++11 features from GCC 5.X for backward compatibility to earlier version ABI libstdc++.so.6 - ] - ), - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: false, - stripSymbolTable: false, - staticLibStdCpp: false, - staticLibGcc: false, - staticIntel: true, - ), - librarianOptions: new GccToolchainConfig.LibrarianOptions( - ) - ) - } - - cfg.singleDefines('REGAMEDLL_SSE') - cfg.singleDefines('LINUX', '_LINUX') - return cfg -} diff --git a/shared_msvc.gradle b/shared_msvc.gradle deleted file mode 100644 index b3275bf49..000000000 --- a/shared_msvc.gradle +++ /dev/null @@ -1,135 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.msvc.CallingConvention -import org.doomedsociety.gradlecpp.msvc.CodeGenerationKind -import org.doomedsociety.gradlecpp.msvc.CppExceptions -import org.doomedsociety.gradlecpp.msvc.DebugInfoFormat -import org.doomedsociety.gradlecpp.msvc.EnhancedInstructionsSet -import org.doomedsociety.gradlecpp.msvc.ErrorReporting -import org.doomedsociety.gradlecpp.msvc.FloatingPointModel -import org.doomedsociety.gradlecpp.msvc.LinkTimeCodeGenKind -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.msvc.OptimizationLevel -import org.doomedsociety.gradlecpp.msvc.RuntimeChecks -import org.doomedsociety.gradlecpp.msvc.WarningLevel - -rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind -> - MsvcToolchainConfig cfg - if (release) { - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED, - optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, - - enableMinimalRebuild: false, - omitFramePointers: false, - wholeProgramOptimization: true, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, - - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - 'NDEBUG': null, - ] - ), - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - - enableIncrementalLinking: false, - eliminateUnusedRefs: true, - enableCOMDATFolding: true, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true, - ), - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), - generatePdb: true - ) - } else { - // debug - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, - optimizationLevel: OptimizationLevel.DISABLED, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, - - enableMinimalRebuild: true, - omitFramePointers: false, - wholeProgramOptimization: false, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, - - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - '_DEBUG': null, - ] - ), - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - - enableIncrementalLinking: true, - eliminateUnusedRefs: false, - enableCOMDATFolding: false, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true - ), - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), - generatePdb: true - ) - - if (binKind == BinaryKind.STATIC_LIBRARY) { - cfg.compilerConfig.extraDefines['_LIB'] = null - } - } - - // Detect and setup UCRT paths - def ucrtInfo = "getucrtinfo.bat".execute().text - def m = ucrtInfo =~ /^(.*)\r\n(.*)?$/ - if (!m.find()) { - return cfg - } - - def kitPath = m.group(1) - def ucrtVersion = m.group(2) - def ucrtCheckFile = new File("${kitPath}Include/${ucrtVersion}/ucrt/stdio.h"); - if (!ucrtCheckFile.exists()) { - return cfg - } - - cfg.compilerOptions.args "/FS", "/I${kitPath}Include/${ucrtVersion}/ucrt"; - cfg.linkerOptions.args("/LIBPATH:${kitPath}Lib/${ucrtVersion}/ucrt/x86"); - cfg.singleDefines('REGAMEDLL_SSE') - - return cfg -}