Gradle 2.14 (#118)

Updates the gradle version to 2.14. In doing so, some model elements have changed. Additionally, some redundant elements have been removed from the gradle scripts.
This commit is contained in:
Fredric Silberberg
2016-07-02 16:32:14 -07:00
committed by Peter Johnson
parent cf29d4560b
commit 2f36d508c4
13 changed files with 107 additions and 140 deletions

View File

@@ -63,3 +63,7 @@ subprojects {
}
apply from: 'cppSettings.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '2.14'
}

View File

@@ -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)
}
}
}

Binary file not shown.

View File

@@ -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

46
gradlew vendored
View File

@@ -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

8
gradlew.bat vendored
View File

@@ -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

View File

@@ -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 {

View File

@@ -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'
}
}

View File

@@ -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}

View File

@@ -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

View File

@@ -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'

View File

@@ -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'
}
}
}
}
}

View File

@@ -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'
}
}
}