diff --git a/build.gradle b/build.gradle index c424857a39..7921716cf2 100644 --- a/build.gradle +++ b/build.gradle @@ -63,3 +63,7 @@ subprojects { } apply from: 'cppSettings.gradle' + +task wrapper(type: Wrapper) { + gradleVersion = '2.14' +} diff --git a/cppSettings.gradle b/cppSettings.gradle index 77c4ece891..91ccca00d2 100644 --- a/cppSettings.gradle +++ b/cppSettings.gradle @@ -60,27 +60,17 @@ subprojects { ext.netTables = netTablesUnzipLocation ext.netTablesInclude = "$netTablesUnzipLocation/include" ext.netLibArmLocation = "$netTablesUnzipLocation/Linux/arm" - if (project.hasProperty('makeSim')){ - ext.netLibDesktopLocation = "$netTablesUnzipLocation/Linux/amd64" + if (project.hasProperty('makeSim')) { + ext.netLibDesktopLocation = "$netTablesUnzipLocation/Linux/amd64" } ext.netSharedLib = "$netLibArmLocation/libntcore.so" ext.netStaticLib = "$netLibArmLocation/libntcore.a" - task addNetworkTablesLibraryLinks() { - description = 'Adds the linker flags for the networktables libraries retreived from maven' - group = 'WPILib' - dependsOn project(':').unzipNetworkTables - doLast { - binaries.all { - tasks.withType(CppCompile) { - // desktop version doesn't use all the NI libraries - // so only do this for arm libraries - String architecture = targetPlatform.architecture - if (architecture.contains('arm')){ - linker.args netStaticLib - } - } - } + ext.addNetworkTablesLibraryLinks = { compileTask, linker, targetPlatform -> + compileTask.dependsOn project(':').unzipNetworkTables + String architecture = targetPlatform.architecture + if (architecture.contains('arm')) { + linker.args netStaticLib } } } @@ -158,36 +148,11 @@ subprojects { } // This task adds the appropriate linker flags for the NI libraries - task addNiLibraryLinks() { - description = 'Adds the linker flags for the NI libraries in the ni-library folders' - group = 'WPILib' - doLast { - binaries.all { - tasks.withType(CppCompile) { - // desktop version doesn't use all the NI libraries - // so only do this for arm libraries - String architecture = targetPlatform.architecture - if (architecture.contains('arm')){ - linker.args << '-L' + niLibraryPath - linker.args.addAll(niLibraryArgs) - } - } - } - model { - repositories { - libs(PrebuiltLibraries) { libs -> - // Loops through all .so files (except files matching *libwpi*.so) in ../ni-libraries - // and includes them for linking - niLibraryTree.each { niLib -> - libs.create(niLib) { - binaries.withType(SharedLibraryBinary) { - sharedLibraryFile = file(niLib.path) - } - } - } - } - } - } + ext.addNiLibraryLinks = { linker, targetPlatform -> + String architecture = targetPlatform.architecture + if (architecture.contains('arm')){ + linker.args << '-L' + niLibraryPath + linker.args.addAll(niLibraryArgs) } } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e8c6bf7bb4..d3b83982b9 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 b396175bc4..8d5723b5f8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Nov 21 18:19:09 EST 2015 +#Wed Jun 29 20:35:34 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 aec99730b4..f6d5974e72 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @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 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 @@ -46,7 +46,7 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args if "%@eval[2+2]" == "4" goto 4NT_args diff --git a/hal/build.gradle b/hal/build.gradle index dd0096dbef..0c4aa06fd4 100644 --- a/hal/build.gradle +++ b/hal/build.gradle @@ -8,8 +8,10 @@ model { components { HALAthena(NativeLibrarySpec) { targetPlatform 'arm' - tasks.withType(CppCompile) { - dependsOn addNiLibraryLinks + binaries.all { + tasks.withType(CppCompile) { + addNiLibraryLinks(linker, targetPlatform) + } } sources { cpp { diff --git a/simulation/SimDS/build.gradle b/simulation/SimDS/build.gradle index 58270b7f21..5d8d7db471 100644 --- a/simulation/SimDS/build.gradle +++ b/simulation/SimDS/build.gradle @@ -7,7 +7,7 @@ apply plugin: 'maven-publish' buildscript { repositories { jcenter() } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.1' + classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' } } diff --git a/test-scripts/config.sh b/test-scripts/config.sh index 181d2ffcf4..7d0d054a91 100644 --- a/test-scripts/config.sh +++ b/test-scripts/config.sh @@ -21,7 +21,7 @@ DEFAULT_DESTINATION_TEST_RESULTS_DIR=${DEFAULT_DESTINATION_DIR}/testResults # C++ test variables DEFAULT_CPP_TEST_NAME=FRCUserProgram DEFAULT_CPP_TEST_ARGS="--gtest_color=yes" -DEFAULT_LOCAL_CPP_TEST_FILE=../wpilibcIntegrationTests/build/binaries/fRCUserProgramExecutable/FRCUserProgram +DEFAULT_LOCAL_CPP_TEST_FILE=../wpilibcIntegrationTests/build/exe/fRCUserProgram/FRCUserProgram CPP_REPORT=cppreport.xml DEFAULT_LOCAL_CPP_TEST_RESULT=${DEFAULT_LOCAL_TEST_RESULTS_DIR}/${CPP_REPORT} diff --git a/wpilibc/athena.gradle b/wpilibc/athena.gradle index 0d63ae7a12..fc582a13ca 100644 --- a/wpilibc/athena.gradle +++ b/wpilibc/athena.gradle @@ -8,8 +8,8 @@ model { targetPlatform 'arm' binaries.all { tasks.withType(CppCompile) { - dependsOn addNiLibraryLinks - dependsOn addNetworkTablesLibraryLinks + addNiLibraryLinks(linker, targetPlatform) + addNetworkTablesLibraryLinks(it, linker, targetPlatform) } } sources { @@ -36,34 +36,42 @@ task wpilibcZip(type: Zip) { destinationDir = project.buildDir // Include the static library file and header files from this project - binaries.withType(StaticLibraryBinarySpec) { spec -> - spec.headerDirs.each { - from(it) { - into 'include' + model { + binaries { + withType(StaticLibraryBinarySpec) { spec -> + spec.headerDirs.each { + from(it) { + into 'include' + } + } + from(spec.staticLibraryFile) { + into 'lib' + } } } - from(spec.staticLibraryFile) { - into 'lib' - } } // Include the static library file and shared library object from hal project def hal = project(':hal') - hal.binaries.withType(StaticLibraryBinarySpec) { spec -> - spec.headerDirs.each { - from(it) { - into 'include' - // We don't want to include any of the .cpp files that are in some of the header directories - exclude '**/*.cpp' + hal.model{ + binaries{ + withType(StaticLibraryBinarySpec) { spec -> + spec.headerDirs.each { + from(it) { + into 'include' + // We don't want to include any of the .cpp files that are in some of the header directories + exclude '**/*.cpp' + } + } + from(spec.staticLibraryFile) { + into 'lib' + } + } + withType(SharedLibraryBinarySpec) { spec -> + from(spec.sharedLibraryFile) { + into 'lib' + } } - } - from(spec.staticLibraryFile) { - into 'lib' - } - } - hal.binaries.withType(SharedLibraryBinarySpec) { spec -> - from(spec.sharedLibraryFile) { - into 'lib' } } @@ -119,15 +127,15 @@ if (checkDoxygen()) { doxygen { def halLocation = '../hal' - source file("${project.shared}/src") - source file("${project.shared}/include") - source file("${project.athena}/src") - source file("${project.athena}/include") - source file("$ntSourceDir/src") - source file("$ntSourceDir/include") - source file("$halLocation/shared") - source file("$halLocation/athena") - source file("$halLocation/include") + source new File("${project.shared}/src") + source new File("${project.shared}/include") + source new File("${project.athena}/src") + source new File("${project.athena}/include") + source new File("$ntSourceDir/src") + source new File("$ntSourceDir/include") + source new File("$halLocation/shared") + source new File("$halLocation/athena") + source new File("$halLocation/include") // template file('cpp.doxy') exclude 'nivision.h' extension_mapping 'inc=C++' @@ -144,7 +152,7 @@ if (checkDoxygen()) { generate_latex false html_timestamp true generate_treeview true - outputDir file("$buildDir/docs") + outputDir new File("$buildDir/docs") } doxygen.dependsOn unzipCppNtSources diff --git a/wpilibcIntegrationTests/build.gradle b/wpilibcIntegrationTests/build.gradle index a7b982419d..6a9485b2fc 100644 --- a/wpilibcIntegrationTests/build.gradle +++ b/wpilibcIntegrationTests/build.gradle @@ -12,8 +12,8 @@ model { targetPlatform 'arm' binaries.all { tasks.withType(CppCompile) { - dependsOn addNiLibraryLinks - dependsOn addNetworkTablesLibraryLinks + addNiLibraryLinks(linker, targetPlatform) + addNetworkTablesLibraryLinks(it, linker, targetPlatform) } cppCompiler.args '-pthread', '-Wno-unused-variable' diff --git a/wpilibj/athena.gradle b/wpilibj/athena.gradle index ed63278644..9fc4dd4972 100644 --- a/wpilibj/athena.gradle +++ b/wpilibj/athena.gradle @@ -22,7 +22,7 @@ model { binaries.all { tasks.withType(CppCompile) { dependsOn jniHeaders - dependsOn addNiLibraryLinks + addNiLibraryLinks(linker, targetPlatform) } } sources { @@ -85,9 +85,13 @@ jar { addClasspath sourceSets.shared.runtimeClasspath } - binaries.withType(SharedLibraryBinarySpec) { - from(file(it.sharedLibraryFile)) { - into 'linux-arm' + model { + binaries { + withType(SharedLibraryBinarySpec) { + from(file(it.sharedLibraryFile)) { + into 'linux-arm' + } + } } } } diff --git a/wpilibjIntegrationTests/build.gradle b/wpilibjIntegrationTests/build.gradle index 8d309a503c..5b0f904370 100644 --- a/wpilibjIntegrationTests/build.gradle +++ b/wpilibjIntegrationTests/build.gradle @@ -14,42 +14,22 @@ mainClassName = 'edu.wpi.first.wpilibj.test.AntJunitLanucher' buildscript { repositories { jcenter() } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.1' + classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' } } def wpilibj = project(':wpilibj') dependencies { - compile wpilibj.sourceSets.shared.output - compile wpilibj.sourceSets.athena.output - compile files(wpilibj.jar.archivePath) + compile wpilibj + compile files(wpilibj.sourceSets.test.output.classesDir) compile 'edu.wpi.first.wpilib.networktables.java:NetworkTables:3.0.0-SNAPSHOT:arm' compile 'junit:junit:4.11' compile 'com.googlecode.junit-toolbox:junit-toolbox:2.0' compile 'org.apache.ant:ant:1.9.4' compile 'org.apache.ant:ant-junit:1.9.4' - compile files(wpilibj.sourceSets.test.output.classesDir) } compileJava.dependsOn tasks.getByPath(':wpilibj:testClasses') build.dependsOn shadowJar - -jar { - wpilibj.binaries.withType(SharedLibraryBinarySpec) { - from(file(it.sharedLibraryFile)) { - into 'linux-arm' - } - } - - dependsOn wpilibj.jar -} - -shadowJar { - wpilibj.binaries.withType(SharedLibraryBinarySpec) { - from(file(it.sharedLibraryFile)) { - into 'linux-arm' - } - } -}