mirror of
https://github.com/rehlds/reapi.git
synced 2025-01-24 04:28:16 +03:00
Remove gradle build system
This commit is contained in:
parent
e808d72075
commit
9f5b521f5e
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,7 +1,4 @@
|
||||
**/build
|
||||
**/.gradle
|
||||
.idea
|
||||
*.iml
|
||||
*.bat
|
||||
**/msvc/Debug*
|
||||
**/msvc/Release*
|
||||
@ -14,7 +11,6 @@
|
||||
**/msvc/*.txt
|
||||
**/msvc/*.aps
|
||||
**/msvc/.vs
|
||||
**/msvc/START*.bat
|
||||
**/msvc/ipch
|
||||
**/PublishPath*.txt
|
||||
**/*.log
|
||||
|
55
build.gradle
55
build.gradle
@ -1,55 +0,0 @@
|
||||
import versioning.GitVersioner
|
||||
import versioning.ReapiVersionInfo
|
||||
import org.joda.time.DateTime
|
||||
|
||||
apply from: 'shared.gradle'
|
||||
group = 'reapi'
|
||||
|
||||
apply plugin: 'idea'
|
||||
|
||||
idea {
|
||||
project {
|
||||
languageLevel = 'JDK_1_7'
|
||||
}
|
||||
}
|
||||
|
||||
def gitInfo = GitVersioner.versionForDir(project.rootDir)
|
||||
ReapiVersionInfo 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 ReapiVersionInfo(
|
||||
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 {
|
||||
|
||||
versionInfo = new ReapiVersionInfo(
|
||||
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.reapiVersionInfo = versionInfo
|
||||
project.version = versionInfo.asMavenVersion()
|
||||
|
||||
apply from: 'publish.gradle'
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '2.4'
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
apply plugin: 'groovy'
|
||||
|
||||
repositories {
|
||||
//mavenLocal()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/'
|
||||
}
|
||||
maven {
|
||||
url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/'
|
||||
}
|
||||
}
|
||||
|
||||
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.velocity:velocity:1.7'
|
||||
compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
|
||||
|
||||
}
|
@ -1,35 +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
|
||||
import versioning.ReapiVersionInfo
|
||||
|
||||
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<String, ? extends Object> 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)
|
||||
def sw = new StringWriter()
|
||||
tpl.merge(velocityContext, sw)
|
||||
|
||||
return sw.toString()
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
package versioning
|
||||
|
||||
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.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<RevCommit> 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/reapi/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().call();
|
||||
|
||||
Set<String> uncommittedChanges = status.getUncommittedChanges();
|
||||
for(String uncommitted : uncommittedChanges) {
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
@ -1,76 +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 ReapiVersionInfo {
|
||||
int majorVersion
|
||||
int minorVersion
|
||||
Integer maintenanceVersion
|
||||
String suffix
|
||||
|
||||
boolean localChanges
|
||||
DateTime commitDate
|
||||
String commitSHA
|
||||
String commitURL
|
||||
Integer commitCount
|
||||
|
||||
String asReapiVersion() {
|
||||
StringBuilder sb = new StringBuilder()
|
||||
sb.append(majorVersion).append(minorVersion).append(commitCount);
|
||||
return sb.toString()
|
||||
}
|
||||
String asMavenVersionC() {
|
||||
StringBuilder sb = new StringBuilder()
|
||||
sb.append(majorVersion).append(',' + minorVersion);
|
||||
if (maintenanceVersion != null) {
|
||||
sb.append(',' + maintenanceVersion);
|
||||
}
|
||||
|
||||
if (commitCount != null) {
|
||||
sb.append(',' + commitCount)
|
||||
}
|
||||
|
||||
return sb.toString()
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
@echo off
|
||||
call "%VS140COMNTOOLS%vcvarsqueryregistry.bat"
|
||||
echo %UniversalCRTSdkDir%
|
||||
echo %UCRTVersion%
|
@ -1,3 +0,0 @@
|
||||
majorVersion=5
|
||||
minorVersion=19
|
||||
maintenanceVersion=0
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +0,0 @@
|
||||
#Sat May 02 13:29:15 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
|
164
gradlew
vendored
164
gradlew
vendored
@ -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 "$@"
|
90
gradlew.bat
vendored
90
gradlew.bat
vendored
@ -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
|
@ -1,65 +0,0 @@
|
||||
import org.doomedsociety.gradlecpp.GradleCppUtils
|
||||
import org.apache.commons.io.FilenameUtils
|
||||
import groovyx.net.http.HTTPBuilder
|
||||
import static groovyx.net.http.Method.POST
|
||||
|
||||
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 << {
|
||||
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/addons/amxmodx/modules').mkdirs()
|
||||
//project.file('publish/publishRoot/addons/amxmodx/scripting/include').mkdirs()
|
||||
|
||||
_copyFileToDir('publish/reapi_amxx.dll', 'publish/publishRoot/addons/amxmodx/modules/')
|
||||
//_copyFileToDir('publish/reapi_amxx.pdb', 'publish/publishRoot/addons/amxmodx/modules/')
|
||||
_copyFile('publish/reapi_amxx_i386.so', 'publish/publishRoot/addons/amxmodx/modules/reapi_amxx_i386.so')
|
||||
|
||||
copy {
|
||||
from 'reapi/extra'
|
||||
into 'publish/publishRoot/addons'
|
||||
}
|
||||
copy {
|
||||
from 'reapi/version/reapi_version.inc'
|
||||
into 'publish/publishRoot/addons/amxmodx/scripting/include'
|
||||
}
|
||||
}
|
||||
|
||||
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {
|
||||
baseName = "reapi_${project.version}"
|
||||
destinationDir file('publish')
|
||||
from 'publish/publishRoot'
|
||||
}
|
||||
|
||||
task doPublish {
|
||||
dependsOn 'publishPackage'
|
||||
|
||||
}
|
@ -1,221 +0,0 @@
|
||||
import org.doomedsociety.gradlecpp.GradleCppUtils
|
||||
import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin
|
||||
import org.doomedsociety.gradlecpp.toolchain.icc.Icc
|
||||
import org.doomedsociety.gradlecpp.cfg.ToolchainConfig
|
||||
import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig
|
||||
import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig
|
||||
import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils
|
||||
import org.gradle.language.cpp.CppSourceSet
|
||||
import org.gradle.language.rc.tasks.WindowsResourceCompile
|
||||
import org.gradle.nativeplatform.NativeBinarySpec
|
||||
import versioning.ReapiVersionInfo
|
||||
import gradlecpp.VelocityUtils
|
||||
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: 'windows-resources'
|
||||
apply plugin: IccCompilerPlugin
|
||||
apply plugin: GccCompilerPlugin
|
||||
|
||||
List<Task> getRcCompileTasks(NativeBinarySpec binary) {
|
||||
def linkTask = GradleCppUtils.getLinkTask(binary)
|
||||
|
||||
def res = linkTask.taskDependencies.getDependencies(linkTask).findAll { Task t -> t instanceof WindowsResourceCompile }
|
||||
return res as List
|
||||
}
|
||||
|
||||
void postEvaluate(NativeBinarySpec b) {
|
||||
if (GradleCppUtils.windows) {
|
||||
getRcCompileTasks(b).each { Task t ->
|
||||
t.dependsOn project.generateAppVersion
|
||||
}
|
||||
} else {
|
||||
// attach generateAppVersion task to all 'compile source' tasks
|
||||
GradleCppUtils.getCompileTasks(b).each { Task t ->
|
||||
t.dependsOn project.generateAppVersion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setupToolchain(NativeBinarySpec b) {
|
||||
boolean useGcc = project.hasProperty("useGcc")
|
||||
ToolchainConfig cfg = rootProject.createToolchainConfig(b)
|
||||
cfg.projectInclude(project, '', '/src', '/common', '/src/mods', '/src/natives', '/include', '/include/metamod', '/include/cssdk/common', '/include/cssdk/dlls', '/include/cssdk/engine', '/include/cssdk/game_shared', '/include/cssdk/pm_shared', '/include/cssdk/public')
|
||||
cfg.singleDefines('HAVE_STRONG_TYPEDEF');
|
||||
|
||||
if (cfg instanceof MsvcToolchainConfig) {
|
||||
cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig(
|
||||
enabled: true,
|
||||
pchHeader: 'precompiled.h',
|
||||
pchSourceSet: 'reapi_pch'
|
||||
)
|
||||
cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GS-'
|
||||
cfg.singleDefines('_CRT_SECURE_NO_WARNINGS')
|
||||
} else if (cfg instanceof GccToolchainConfig) {
|
||||
if (!useGcc) {
|
||||
cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions(
|
||||
enabled: true,
|
||||
pchSourceSet: 'reapi_pch'
|
||||
)
|
||||
}
|
||||
cfg.compilerOptions.languageStandard = 'c++14'
|
||||
cfg.defines([
|
||||
'_stricmp': 'strcasecmp',
|
||||
'_strnicmp': 'strncasecmp',
|
||||
'_vsnprintf': 'vsnprintf',
|
||||
'_snprintf': 'snprintf'
|
||||
])
|
||||
|
||||
if (useGcc) {
|
||||
cfg.compilerOptions.args '-fno-strict-aliasing', '-finline-functions'
|
||||
} else {
|
||||
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-inline-forceinline', '-no-ansi-alias'
|
||||
}
|
||||
|
||||
cfg.linkerOptions.args '-Wl,--version-script=../version_script.lds', '-Wl,--gc-sections'
|
||||
cfg.compilerOptions.args '-ffunction-sections', '-fdata-sections' // Remove unused code and data
|
||||
|
||||
cfg.compilerOptions.args '-Wall', '-Wno-unknown-pragmas', '-msse2', '-fomit-frame-pointer', '-fvisibility=default', '-fvisibility-inlines-hidden', '-g0', '-s', '-fno-exceptions'
|
||||
}
|
||||
|
||||
ToolchainConfigUtils.apply(project, cfg, b)
|
||||
|
||||
GradleCppUtils.onTasksCreated(project, 'postEvaluate', {
|
||||
postEvaluate(b)
|
||||
})
|
||||
}
|
||||
|
||||
model {
|
||||
buildTypes {
|
||||
debug
|
||||
release
|
||||
}
|
||||
|
||||
platforms {
|
||||
x86 {
|
||||
architecture "x86"
|
||||
}
|
||||
}
|
||||
|
||||
toolChains {
|
||||
visualCpp(VisualCpp)
|
||||
if (project.hasProperty("useGcc")) {
|
||||
gcc(Gcc)
|
||||
} else {
|
||||
icc(Icc)
|
||||
}
|
||||
}
|
||||
|
||||
components {
|
||||
reapi(NativeLibrarySpec) {
|
||||
targetPlatform 'x86'
|
||||
baseName GradleCppUtils.windows ? 'reapi_amxx' : 'reapi_amxx_i386'
|
||||
|
||||
sources {
|
||||
reapi_pch(CppSourceSet) {
|
||||
source {
|
||||
srcDirs "src"
|
||||
include "precompiled.cpp"
|
||||
}
|
||||
|
||||
exportedHeaders {
|
||||
srcDirs "include", "version"
|
||||
}
|
||||
}
|
||||
reapi_src(CppSourceSet) {
|
||||
source {
|
||||
srcDirs "src", "common", "include/cssdk/public"
|
||||
include "**/*.cpp"
|
||||
|
||||
exclude "precompiled.cpp"
|
||||
exclude "engine_api.cpp", "tier0/dbg.cpp"
|
||||
}
|
||||
|
||||
exportedHeaders {
|
||||
srcDirs "include", "version"
|
||||
}
|
||||
}
|
||||
rc {
|
||||
source {
|
||||
srcDir "msvc"
|
||||
include "reapi.rc"
|
||||
}
|
||||
exportedHeaders {
|
||||
srcDirs "msvc"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binaries.all {
|
||||
NativeBinarySpec b -> project.setupToolchain(b)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
project.binaries.all {
|
||||
NativeBinarySpec binary ->
|
||||
Tool linker = binary.linker
|
||||
|
||||
if (GradleCppUtils.windows) {
|
||||
linker.args "/DEF:${projectDir}\\msvc\\reapi.def"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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'
|
||||
}
|
||||
finalizedBy buildFinalize
|
||||
}
|
||||
|
||||
tasks.clean.doLast {
|
||||
project.file('version/appversion.h').delete()
|
||||
project.file('version/reapi_version.inc').delete()
|
||||
}
|
||||
|
||||
task generateAppVersion {
|
||||
|
||||
ReapiVersionInfo verInfo = (ReapiVersionInfo) rootProject.reapiVersionInfo
|
||||
def tplversionFileInc = project.file('version/reapi_version.vm')
|
||||
def versionFileInc = project.file('version/reapi_version.inc')
|
||||
|
||||
def tplversionFile = project.file('version/appversion.vm')
|
||||
def versionFile = project.file('version/appversion.h')
|
||||
|
||||
inputs.file tplversionFile
|
||||
inputs.file tplversionFileInc
|
||||
inputs.file project.file('gradle.properties')
|
||||
outputs.file versionFile
|
||||
outputs.file versionFileInc
|
||||
|
||||
println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']";
|
||||
|
||||
doLast {
|
||||
def templateCtx = [
|
||||
verInfo : verInfo
|
||||
]
|
||||
|
||||
def versionContent = VelocityUtils.renderTemplate(tplversionFile, templateCtx)
|
||||
versionFile.delete()
|
||||
versionFile.write(versionContent, 'utf-8')
|
||||
|
||||
def versionContentInc = VelocityUtils.renderTemplate(tplversionFileInc, templateCtx)
|
||||
versionFileInc.delete()
|
||||
versionFileInc.write(versionContentInc, 'utf-8')
|
||||
}
|
||||
}
|
@ -1,272 +0,0 @@
|
||||
@setlocal enableextensions enabledelayedexpansion
|
||||
@echo off
|
||||
::
|
||||
:: Pre-build auto-versioning script
|
||||
::
|
||||
|
||||
set srcdir=%~1
|
||||
set repodir=%~2
|
||||
|
||||
set old_version=
|
||||
set old_version_inc=
|
||||
set version_major=0
|
||||
set version_minor=0
|
||||
set version_maintenance=0
|
||||
set version_modifed=
|
||||
|
||||
set commitSHA=
|
||||
set commitURL=
|
||||
set commitCount=0
|
||||
set branch_name=master
|
||||
|
||||
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
|
||||
set "YYYY=%dt:~0,4%"
|
||||
set "MM=%dt:~4,2%"
|
||||
set "DD=%dt:~6,2%"
|
||||
set "hour=%dt:~8,2%"
|
||||
set "min=%dt:~10,2%"
|
||||
set "sec=%dt:~12,2%"
|
||||
|
||||
::
|
||||
:: Remove leading zero from MM (e.g 09 > 9)
|
||||
for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I
|
||||
::
|
||||
|
||||
::
|
||||
:: Index into array to get month name
|
||||
::
|
||||
for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I"
|
||||
|
||||
::
|
||||
:: Check for git.exe presence
|
||||
::
|
||||
CALL git.exe describe >NUL 2>&1
|
||||
set errlvl="%ERRORLEVEL%"
|
||||
|
||||
::
|
||||
:: Read old appversion.h, if present
|
||||
::
|
||||
IF EXIST "%srcdir%\appversion.h" (
|
||||
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do (
|
||||
IF %%i==#define (
|
||||
IF %%j==APP_VERSION (
|
||||
:: Remove quotes
|
||||
set v=%%k
|
||||
set old_version=!v:"=!
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::
|
||||
:: Read old reapi_version.inc, if present
|
||||
::
|
||||
IF EXIST "%srcdir%\reapi_version.inc" (
|
||||
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\reapi_version.inc") do (
|
||||
IF %%i==#define (
|
||||
IF %%j==REAPI_VERSION (
|
||||
:: Remove quotes
|
||||
set v=%%k
|
||||
set old_version_inc=!v:"=!
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
IF %errlvl% == "1" (
|
||||
echo can't locate git.exe - auto-versioning step won't be performed
|
||||
|
||||
:: if we haven't appversion.h, we need to create it
|
||||
IF NOT "%old_version%" == "" (
|
||||
set commitCount=0
|
||||
)
|
||||
)
|
||||
|
||||
::
|
||||
:: Read major, minor and maintenance version components from Version.h
|
||||
::
|
||||
IF EXIST "%srcdir%\version.h" (
|
||||
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do (
|
||||
IF %%i==#define (
|
||||
IF %%j==VERSION_MAJOR set version_major=%%k
|
||||
IF %%j==VERSION_MINOR set version_minor=%%k
|
||||
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
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::
|
||||
:: Read revision and release date from it
|
||||
::
|
||||
IF NOT %errlvl% == "1" (
|
||||
:: Get current branch
|
||||
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO (
|
||||
set branch_name=%%i
|
||||
)
|
||||
|
||||
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO (
|
||||
IF NOT [%%i] == [] (
|
||||
set commitCount=%%i
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::
|
||||
:: Get remote url repository
|
||||
::
|
||||
IF NOT %errlvl% == "1" (
|
||||
|
||||
set branch_remote=origin
|
||||
:: Get remote name by current branch
|
||||
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO (
|
||||
set branch_remote=%%i
|
||||
)
|
||||
:: Get remote url
|
||||
FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
|
||||
set commitURL=%%i
|
||||
)
|
||||
:: Get commit id
|
||||
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO (
|
||||
set shafull=%%i
|
||||
set commitSHA=!shafull:~0,+7!
|
||||
)
|
||||
|
||||
IF [!commitURL!] == [] (
|
||||
|
||||
FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
|
||||
set commitURL=%%i
|
||||
)
|
||||
|
||||
:: strip .git
|
||||
if "x!commitURL:~-4!"=="x.git" (
|
||||
set commitURL=!commitURL:~0,-4!
|
||||
)
|
||||
|
||||
:: append extra string
|
||||
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
|
||||
set commitURL=!commitURL!/commits/
|
||||
) ELSE (
|
||||
set commitURL=!commitURL!/commit/
|
||||
)
|
||||
|
||||
) ELSE (
|
||||
:: strip .git
|
||||
if "x!commitURL:~-4!"=="x.git" (
|
||||
set commitURL=!commitURL:~0,-4!
|
||||
)
|
||||
:: replace : to /
|
||||
set commitURL=!commitURL::=/!
|
||||
|
||||
:: append extra string
|
||||
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
|
||||
set commitURL=https://!commitURL!/commits/
|
||||
) ELSE (
|
||||
set commitURL=https://!commitURL!/commit/
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
::
|
||||
:: Detect local modifications
|
||||
::
|
||||
set localChanged=0
|
||||
IF NOT %errlvl% == "1" (
|
||||
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO (
|
||||
set localChanged=1
|
||||
)
|
||||
)
|
||||
|
||||
IF [%localChanged%]==[1] (
|
||||
set version_modifed=+m
|
||||
)
|
||||
|
||||
::
|
||||
:: Now form full version string like 1.0.0.1
|
||||
::
|
||||
|
||||
set new_version_inc=%version_major%%version_minor%%commitCount%
|
||||
set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed%
|
||||
|
||||
::
|
||||
:: Update appversion.h if version has changed or modifications/mixed revisions detected
|
||||
::
|
||||
IF NOT "%new_version%"=="%old_version%" (
|
||||
goto _update
|
||||
)
|
||||
|
||||
::
|
||||
:: Update reapi_version.inc if version has changed or modifications/mixed revisions detected
|
||||
::
|
||||
|
||||
IF NOT "%new_version_inc%"=="%old_version_inc%" (
|
||||
goto _update
|
||||
)
|
||||
|
||||
goto _exit
|
||||
|
||||
:_update
|
||||
|
||||
::
|
||||
:: Write reapi_version.inc
|
||||
::
|
||||
echo Updating reapi_version.inc, new version is "%new_version_inc%", the old one was %old_version_inc%
|
||||
|
||||
echo #if defined _reapi_version_included>"%srcdir%\reapi_version.inc"
|
||||
echo #endinput>>"%srcdir%\reapi_version.inc"
|
||||
echo #endif>>"%srcdir%\reapi_version.inc"
|
||||
echo #define _reapi_version_included>>"%srcdir%\reapi_version.inc"
|
||||
|
||||
echo.>>"%srcdir%\reapi_version.inc"
|
||||
>>"%srcdir%\reapi_version.inc" echo // reapi version
|
||||
>>"%srcdir%\reapi_version.inc" echo #define REAPI_VERSION %version_major%%version_minor%%commitCount%
|
||||
>>"%srcdir%\reapi_version.inc" echo #define REAPI_VERSION_MAJOR %version_major%
|
||||
>>"%srcdir%\reapi_version.inc" echo #define REAPI_VERSION_MINOR %version_minor%
|
||||
|
||||
::
|
||||
:: Write appversion.h
|
||||
::
|
||||
echo Updating appversion.h, new version is "%new_version%", the old one was %old_version%
|
||||
|
||||
echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h"
|
||||
echo #define __APPVERSION_H__>>"%srcdir%\appversion.h"
|
||||
echo.>>"%srcdir%\appversion.h"
|
||||
echo // >>"%srcdir%\appversion.h"
|
||||
echo // This file is generated automatically.>>"%srcdir%\appversion.h"
|
||||
echo // Don't edit it.>>"%srcdir%\appversion.h"
|
||||
echo // >>"%srcdir%\appversion.h"
|
||||
echo.>>"%srcdir%\appversion.h"
|
||||
echo // Version defines>>"%srcdir%\appversion.h"
|
||||
echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h"
|
||||
|
||||
>>"%srcdir%\appversion.h" echo #define APP_VERSION_C %version_major%,%version_minor%,%version_maintenance%,%commitCount%
|
||||
echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_maintenance%.%commitCount%">>"%srcdir%\appversion.h"
|
||||
echo #define APP_VERSION_FLAGS 0x0L>>"%srcdir%\appversion.h"
|
||||
|
||||
echo.>>"%srcdir%\appversion.h"
|
||||
echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h"
|
||||
echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h"
|
||||
|
||||
echo.>>"%srcdir%\appversion.h"
|
||||
echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h"
|
||||
echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h"
|
||||
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
|
@ -1,21 +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_VERSION_C $verInfo.asMavenVersionC()
|
||||
\#define APP_VERSION_STRD "$verInfo.asMavenVersion(false)"
|
||||
\#define APP_VERSION_FLAGS 0x0L
|
||||
|
||||
\#define APP_COMMIT_DATE "$verInfo.asCommitDate("yyyy-MM-dd")"
|
||||
\#define APP_COMMIT_TIME "$verInfo.asCommitTime()"
|
||||
|
||||
\#define APP_COMMIT_SHA "$verInfo.commitSHA"
|
||||
\#define APP_COMMIT_URL "$verInfo.commitURL"
|
||||
|
||||
#endif //__APPVERSION_H__
|
@ -1,9 +0,0 @@
|
||||
\#if defined _reapi_version_included
|
||||
#endinput
|
||||
#endif
|
||||
\#define _reapi_version_included
|
||||
|
||||
// reapi version
|
||||
\#define REAPI_VERSION $verInfo.asReapiVersion()
|
||||
\#define REAPI_VERSION_MAJOR ${verInfo.majorVersion}
|
||||
\#define REAPI_VERSION_MINOR ${verInfo.minorVersion}
|
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Version declaration dependency file
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// This file needed just to add the dependency and appversion.h
|
||||
//
|
||||
#include "precompiled.h"
|
||||
|
@ -1,2 +0,0 @@
|
||||
rootProject.name = 'reapi'
|
||||
include 'reapi'
|
@ -1,36 +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_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 Gcc) {
|
||||
return rootProject.createGccConfig(releaseBuild, binaryKind)
|
||||
} else {
|
||||
throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}")
|
||||
}
|
||||
}
|
@ -1,61 +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: [
|
||||
'linux': null,
|
||||
'__linux__': null,
|
||||
'NDEBUG': null,
|
||||
],
|
||||
),
|
||||
|
||||
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
||||
stripSymbolTable: true,
|
||||
staticLibGcc: false,
|
||||
staticLibStdCpp: true,
|
||||
),
|
||||
|
||||
librarianOptions: new GccToolchainConfig.LibrarianOptions(
|
||||
|
||||
)
|
||||
)
|
||||
} else {
|
||||
// debug
|
||||
cfg = new GccToolchainConfig(
|
||||
compilerOptions: new GccToolchainConfig.CompilerOptions(
|
||||
optimizationLevel: OptimizationLevel.DISABLE,
|
||||
stackProtector: true,
|
||||
noBuiltIn: true,
|
||||
|
||||
extraDefines: [
|
||||
'linux': null,
|
||||
'__linux__': null,
|
||||
'NDEBUG': null,
|
||||
],
|
||||
),
|
||||
|
||||
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
||||
stripSymbolTable: false,
|
||||
staticLibGcc: false,
|
||||
staticLibStdCpp: true,
|
||||
),
|
||||
|
||||
librarianOptions: new GccToolchainConfig.LibrarianOptions(
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
cfg.singleDefines('LINUX', '_LINUX')
|
||||
return cfg
|
||||
}
|
@ -1,68 +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,
|
||||
noBuiltIn: true,
|
||||
intelExtensions: false,
|
||||
asmBlocks: true,
|
||||
positionIndependentCode: false,
|
||||
|
||||
extraDefines: [
|
||||
'linux': null,
|
||||
'__linux__': null,
|
||||
'NDEBUG': null,
|
||||
],
|
||||
),
|
||||
|
||||
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
||||
interProceduralOptimizations: true, // -ipo
|
||||
stripSymbolTable: true,
|
||||
staticLibStdCpp: true,
|
||||
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: [
|
||||
'linux': null,
|
||||
'__linux__': null,
|
||||
'NDEBUG': null,
|
||||
],
|
||||
),
|
||||
|
||||
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
||||
interProceduralOptimizations: false,
|
||||
stripSymbolTable: false,
|
||||
staticLibStdCpp: true,
|
||||
staticLibGcc: false,
|
||||
staticIntel: true,
|
||||
),
|
||||
|
||||
librarianOptions: new GccToolchainConfig.LibrarianOptions(
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return cfg;
|
||||
}
|
@ -1,142 +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.DISABLED,
|
||||
warningLevel: WarningLevel.LEVEL_3,
|
||||
callingConvention: CallingConvention.CDECL,
|
||||
enhancedInstructionsSet: EnhancedInstructionsSet.SSE2,
|
||||
floatingPointModel: FloatingPointModel.FAST,
|
||||
|
||||
enableMinimalRebuild: false,
|
||||
omitFramePointers: true,
|
||||
wholeProgramOptimization: true,
|
||||
enabledFunctionLevelLinking: true,
|
||||
enableSecurityCheck: false,
|
||||
analyzeCode: false,
|
||||
sdlChecks: false,
|
||||
treatWarningsAsErrors: false,
|
||||
treatWchartAsBuiltin: true,
|
||||
forceConformanceInForLoopScope: true,
|
||||
|
||||
extraDefines: [
|
||||
'WIN32': null,
|
||||
'_MBCS': null,
|
||||
'NDEBUG': null,
|
||||
'NOMINMAX': 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,
|
||||
'NOMINMAX': 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");
|
||||
|
||||
return cfg
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user