diff --git a/build.gradle b/build.gradle index b473e3883c..66a5dc3a22 100644 --- a/build.gradle +++ b/build.gradle @@ -142,15 +142,18 @@ def ntcoreZipTask = { project -> } } - project.binaries.withType(StaticLibraryBinarySpec) { binary -> - from(binary.staticLibraryFile) { - into getPlatformPath(binary) - } - } - - project.binaries.withType(SharedLibraryBinarySpec) { binary -> - from(binary.sharedLibraryFile) { - into getPlatformPath(binary) + project.model { + binaries { + withType(StaticLibraryBinarySpec) { binary -> + from(binary.staticLibraryFile) { + into getPlatformPath(binary) + } + } + withType(SharedLibraryBinarySpec) { binary -> + from(binary.sharedLibraryFile) { + into getPlatformPath(binary) + } + } } } } @@ -167,8 +170,7 @@ def ntcoreZipTask = { project -> project.tasks.whenTaskAdded { task -> def name = task.name.toLowerCase() - if (name.contains("ntcoresharedlibrary") || name.contains("ntcorestaticlibrary") || - name.contains("ntcoretest")) { + if (name.contains("ntcoresharedlibrary") || name.contains("ntcorestaticlibrary") || name.contains("ntcoretest")) { project.ntcoreZip.dependsOn task } } @@ -227,7 +229,7 @@ task ntcoreSourceZip(type: Zip) { baseName = 'ntcore' classifier = "sources" - from ('src') { + from('src') { into 'src' } @@ -254,3 +256,7 @@ task build build.dependsOn ntcoreSourceZip apply from: 'publish.gradle' + +task wrapper(type: Wrapper) { + gradleVersion = '2.14' +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e8c6bf7bb4..ca78035ef0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c0d783e643..f8892d512b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Oct 31 11:10:48 EDT 2015 +#Wed Jun 29 20:58:54 PDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip diff --git a/gradlew b/gradlew index 97fac783e1..27309d9231 100755 --- a/gradlew +++ b/gradlew @@ -6,12 +6,30 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# 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" @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# 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. @@ -85,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +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 diff --git a/gradlew.bat b/gradlew.bat index 8a0b282aa6..f6d5974e72 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,90 +1,90 @@ -@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 +@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 + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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= + +@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 Windows 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/java/java.gradle b/java/java.gradle index 78e8133932..05fb7eed41 100644 --- a/java/java.gradle +++ b/java/java.gradle @@ -27,18 +27,22 @@ jar { classifier = "$buildPlatform" dependsOn { classes } - binaries.withType(SharedLibraryBinary) { binary -> - from(file(binary.sharedLibraryFile)) { - into getPlatformPath(binary) + model { + binaries { + withType(SharedLibraryBinarySpec) { binary -> + from(file(binary.sharedLibraryFile)) { + into getPlatformPath(binary) + } + } } } } -project.tasks.whenTaskAdded { task-> +project.tasks.whenTaskAdded { task -> if (isArm) { if (task.name == 'ntcoreSharedLibrary') jar.dependsOn task } else { - if (task.name == 'x64NtcoreSharedLibrary' || task.name == 'x86NtcoreSharedLibrary') + if (task.name == 'ntcoreX64SharedLibrary' || task.name == 'ntcoreX86SharedLibrary') jar.dependsOn task } } diff --git a/test/tests.gradle b/test/tests.gradle index 8499e20040..4bb969bd6d 100644 --- a/test/tests.gradle +++ b/test/tests.gradle @@ -26,13 +26,17 @@ model { } } -binaries.withType(GoogleTestTestSuiteBinarySpec) { - lib project: ':gmock', library: "gmock", linkage: "static" - lib library: 'ntcore', linkage: 'static' - if (targetPlatform.operatingSystem.windows) { - cppCompiler.args '/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS' - } else { - cppCompiler.args '-pthread', '-std=c++1y' - linker.args '-pthread' +model { + binaries { + withType(GoogleTestTestSuiteBinarySpec) { + lib project: ':gmock', library: "gmock", linkage: "static" + lib library: 'ntcore', linkage: 'static' + if (targetPlatform.operatingSystem.windows) { + cppCompiler.args '/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS' + } else { + cppCompiler.args '-pthread', '-std=c++1y' + linker.args '-pthread' + } + } } } diff --git a/toolchains/arm.gradle b/toolchains/arm.gradle index 529edf6e09..14eca799ac 100644 --- a/toolchains/arm.gradle +++ b/toolchains/arm.gradle @@ -2,7 +2,7 @@ def compilerPrefix = project.hasProperty('compilerPrefix') ? project.compilerPre model { toolChains { gcc(Gcc) { - target("arm"){ + target("arm") { // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi- // If this ever changes, the prefix will need to be changed here cppCompiler.executable = compilerPrefix + cppCompiler.executable @@ -66,29 +66,33 @@ ext.setupDebugDefines = { cppCompiler, linker -> } ext.releaseSetup = { releaseTasks -> - binaries.withType(SharedLibraryBinarySpec) { binary -> - if (!project.hasProperty('debug')) { - def library = binary.sharedLibraryFile.absolutePath - def debugLibrary = binary.sharedLibraryFile.absolutePath + ".debug" - if (project.tasks.findByName("firstObjcopy${binary.name}") == null) { - def firstObjcopy = project.tasks.create("firstObjcopy${binary.name}", Exec) { task -> - task.commandLine "${compilerPrefix}objcopy", '--only-keep-debug', library, debugLibrary - } - def strip = project.tasks.create("strip${binary.name}", Exec) { task -> - task.commandLine "${compilerPrefix}strip", '-g', library - } - def secondObjcopy = project.tasks.create("secondObjcopy${binary.name}", Exec) { task -> - task.commandLine "${compilerPrefix}objcopy", "--add-gnu-debuglink=$debugLibrary", library - } - secondObjcopy.dependsOn strip - strip.dependsOn firstObjcopy - binary.tasks.whenObjectAdded { task -> - if (task.name.contains('link')) { - firstObjcopy.dependsOn task + model { + binaries { + withType(SharedLibraryBinarySpec) { binary -> + if (!project.hasProperty('debug')) { + def library = binary.sharedLibraryFile.absolutePath + def debugLibrary = binary.sharedLibraryFile.absolutePath + ".debug" + if (project.tasks.findByName("firstObjcopy${binary.name}") == null) { + def firstObjcopy = project.tasks.create("firstObjcopy${binary.name}", Exec) { task -> + task.commandLine "${compilerPrefix}objcopy", '--only-keep-debug', library, debugLibrary + } + def strip = project.tasks.create("strip${binary.name}", Exec) { task -> + task.commandLine "${compilerPrefix}strip", '-g', library + } + def secondObjcopy = project.tasks.create("secondObjcopy${binary.name}", Exec) { task -> + task.commandLine "${compilerPrefix}objcopy", "--add-gnu-debuglink=$debugLibrary", library + } + secondObjcopy.dependsOn strip + strip.dependsOn firstObjcopy + binary.tasks.whenObjectAdded { task -> + if (task.name.contains('link')) { + firstObjcopy.dependsOn task + } + } } + releaseTasks.each { it.dependsOn project.tasks.getByName("secondObjcopy${binary.name}") } } } - releaseTasks.each { it.dependsOn project.tasks.getByName("secondObjcopy${binary.name}") } } } } diff --git a/toolchains/linux.gradle b/toolchains/linux.gradle index f13250950e..00823a8edc 100644 --- a/toolchains/linux.gradle +++ b/toolchains/linux.gradle @@ -42,29 +42,33 @@ ext.setupDebugDefines = { cppCompiler, linker -> } ext.releaseSetup = { releaseTasks -> - binaries.withType(SharedLibraryBinarySpec) { binary -> - if (!project.hasProperty('debug')) { - def library = binary.sharedLibraryFile.absolutePath - def debugLibrary = binary.sharedLibraryFile.absolutePath + ".debug" - if (project.tasks.findByName("firstObjcopy${binary.name}") == null) { - def firstObjcopy = project.tasks.create("firstObjcopy${binary.name}", Exec) { task -> - task.commandLine 'objcopy', '--only-keep-debug', library, debugLibrary - } - def strip = project.tasks.create("strip${binary.name}", Exec) { task -> - task.commandLine 'strip', '-g', library - } - def secondObjcopy = project.tasks.create("secondObjcopy${binary.name}", Exec) { task -> - task.commandLine 'objcopy', "--add-gnu-debuglink=$debugLibrary", library - } - secondObjcopy.dependsOn strip - strip.dependsOn firstObjcopy - binary.tasks.whenObjectAdded { task -> - if (task.name.contains('link')) { - firstObjcopy.dependsOn task + model { + binaries { + withType(SharedLibraryBinarySpec) { binary -> + if (!project.hasProperty('debug')) { + def library = binary.sharedLibraryFile.absolutePath + def debugLibrary = binary.sharedLibraryFile.absolutePath + ".debug" + if (project.tasks.findByName("firstObjcopy${binary.name}") == null) { + def firstObjcopy = project.tasks.create("firstObjcopy${binary.name}", Exec) { task -> + task.commandLine 'objcopy', '--only-keep-debug', library, debugLibrary + } + def strip = project.tasks.create("strip${binary.name}", Exec) { task -> + task.commandLine 'strip', '-g', library + } + def secondObjcopy = project.tasks.create("secondObjcopy${binary.name}", Exec) { task -> + task.commandLine 'objcopy', "--add-gnu-debuglink=$debugLibrary", library + } + secondObjcopy.dependsOn strip + strip.dependsOn firstObjcopy + binary.tasks.whenObjectAdded { task -> + if (task.name.contains('link')) { + firstObjcopy.dependsOn task + } + } } + releaseTasks.each { it.dependsOn project.tasks.getByName("secondObjcopy${binary.name}") } } } - releaseTasks.each { it.dependsOn project.tasks.getByName("secondObjcopy${binary.name}") } } } } diff --git a/toolchains/mac.gradle b/toolchains/mac.gradle index 5ef05b7512..8ad1a25b46 100644 --- a/toolchains/mac.gradle +++ b/toolchains/mac.gradle @@ -31,24 +31,28 @@ ext.setupDebugDefines = { cppCompiler, linker -> } ext.releaseSetup = { releaseTasks -> - binaries.withType(SharedLibraryBinarySpec) { binary -> - if (!project.hasProperty('debug')) { - def library = binary.sharedLibraryFile.absolutePath - if (project.tasks.findByName("strip${binary.name}") == null) { - def dsymutil = project.tasks.create("dsymutil${binary.name}", Exec) { task -> - task.commandLine 'dsymutil', library - } - def strip = project.tasks.create("strip${binary.name}", Exec) { task -> - task.commandLine 'strip', '-S', library - } - strip.dependsOn dsymutil - binary.tasks.whenObjectAdded { task -> - if (task.name.contains('link')) { - dsymutil.dependsOn task + model { + binaries { + withType(SharedLibraryBinarySpec) { binary -> + if (!project.hasProperty('debug')) { + def library = binary.sharedLibraryFile.absolutePath + if (project.tasks.findByName("strip${binary.name}") == null) { + def dsymutil = project.tasks.create("dsymutil${binary.name}", Exec) { task -> + task.commandLine 'dsymutil', library + } + def strip = project.tasks.create("strip${binary.name}", Exec) { task -> + task.commandLine 'strip', '-S', library + } + strip.dependsOn dsymutil + binary.tasks.whenObjectAdded { task -> + if (task.name.contains('link')) { + dsymutil.dependsOn task + } + } } + releaseTasks.each { it.dependsOn project.tasks.getByName("strip${binary.name}") } } } - releaseTasks.each { it.dependsOn project.tasks.getByName("strip${binary.name}") } } } }