Permalink
Browse files

Initial Gradlification. Issue #125

  • Loading branch information...
ShaneMcC committed Jan 15, 2017
1 parent 65a75f0 commit e03db422577513446bcdb1f4ec0bb423fb87cf5e
Showing with 415 additions and 11 deletions.
  1. +1 −0 .gitignore
  2. +0 −6 .gitmodules
  3. +68 −0 build.gradle
  4. +1 −0 gradle.properties
  5. +84 −0 gradle/jar.gradle
  6. BIN gradle/wrapper/gradle-wrapper.jar
  7. +6 −0 gradle/wrapper/gradle-wrapper.properties
  8. +164 −0 gradlew
  9. +90 −0 gradlew.bat
  10. +0 −3 manifest.mf
  11. +0 −1 modules/akuma
  12. +0 −1 modules/util
  13. +1 −0 settings.gradle
View
@@ -7,3 +7,4 @@ build
.idea/workspace.xml
.idea/tasks.xml
keystore.ks
.gradle
View
@@ -1,12 +1,6 @@
[submodule "modules/parser"]
path = modules/parser
url = https://github.com/DMDirc/Parser.git
[submodule "modules/akuma"]
path = modules/akuma
url = https://github.com/DFBnc/akuma.git
[submodule "modules/util"]
path = modules/util
url = https://github.com/DMDirc/Util.git
[submodule "modules/sockets"]
path = modules/sockets
url = https://github.com/DFBnc/sockets
View
@@ -0,0 +1,68 @@
plugins {
id 'java'
id 'idea'
}
group = 'com.dfbnc'
repositories {
mavenCentral()
maven { url 'https://artifactory.dmdirc.com/artifactory/repo' }
}
idea {
module {
sourceDirs += file('modules/parser/irc/src/main/generated')
sourceDirs += file('modules/parser/common/src/main/generated')
testSourceDirs += file('modules/parser/irc/src/test/generated_tests')
testSourceDirs += file('modules/parser/common/src/test/generated_tests')
generatedSourceDirs = [file('modules/parser/irc/src/main/generated'),
file('modules/parser/common/src/main/generated'),
file('modules/parser/irc/src/test/generated_tests'),
file('modules/parser/common/src/test/generated_tests')]
}
}
configurations {
bundle
compile {
extendsFrom bundle
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets {
main.java.srcDirs = ['src',
'modules/sockets/src',
'modules/parser/irc/src/main/java',
'modules/parser/common/src/main/java']
test.java.srcDirs = ['test']
}
dependencies {
compile group: 'com.squareup.dagger', name: 'dagger-compiler', version: '1.2.5'
compile group: 'com.google.auto.value', name: 'auto-value', version: '1.3'
bundle group: 'org.kohsuke', name: 'akuma', version: '1.10'
bundle group: 'com.squareup.dagger', name: 'dagger', version: '1.2.5'
bundle group: 'com.google.guava', name:'guava', version: '19.0'
bundle group: 'net.engio', name: 'mbassador', version: '1.3.0'
bundle group: 'de.odysseus.juel', name: 'juel-api', version: '2.2.7'
bundle group: 'de.odysseus.juel', name: 'juel-impl', version: '2.2.7'
bundle group: 'de.odysseus.juel', name: 'juel-spi', version: '2.2.7'
bundle group: 'com.dmdirc', name: 'util', version: 'null-SNAPSHOT'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.2.7'
}
apply from: 'gradle/jar.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '3.1'
}
View
@@ -0,0 +1 @@
org.gradle.daemon=true
View
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2006-2015 DMDirc Developers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
task createVersionConfig {
inputs.dir 'src'
inputs.dir 'res'
outputs.file new File(buildDir, 'version.config')
dependsOn classes
// TODO: This shouldn't shell out to git.
ext.getGitVersion = {directory ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', "--git-dir=" + (new File(directory, ".git")).getAbsolutePath(), 'describe', '--tags'
standardOutput = stdout
ignoreExitValue = true
}
return stdout.toString().trim().isEmpty() ? "Unknown" : stdout.toString().trim();
}
doLast {
def targetFile = new File(buildDir, 'version.config')
def component, componentVersion;
targetFile.text = ''
targetFile << "# This is a DFBnc configuration file automatically generated by\n"
targetFile << "# the build process.\n"
targetFile << "\n"
targetFile << "keysections:\n"
targetFile << " versions\n"
targetFile << "\n"
targetFile << "versions:\n"
targetFile << " dfbnc=" + getGitVersion(project.projectDir) + "\n"
targetFile << " parser=" + getGitVersion(new File(project.projectDir, "modules/parser")) + "\n"
targetFile << " sockets=" + getGitVersion(new File(project.projectDir, "modules/sockets")) + "\n"
}
}
jar {
outputs.file "dist/dfbnc.jar"
dependsOn createVersionConfig
exclude 'com/dfbnc/version.config'
from("$buildDir/version.config") {
into 'com/dfbnc/'
}
from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
exclude 'META-INF/*'
exclude 'META-INF/maven/**'
}
manifest {
attributes 'Main-Class': 'com.dfbnc.DFBnc'
}
doLast {
copy {
from jar.archivePath
into "dist/"
rename ".*", "dfbnc.jar"
}
}
}
View
Binary file not shown.
@@ -0,0 +1,6 @@
#Sun Jan 15 02:14:18 GMT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
View
164 gradlew
@@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# 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\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# 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
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
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" -a "$nonstop" = "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"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# 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 "$@"
Oops, something went wrong.

0 comments on commit e03db42

Please sign in to comment.