Files
allwpilib/build.gradle

251 lines
7.6 KiB
Groovy
Raw Normal View History

import edu.wpi.first.nativeutils.NativeUtils
import org.gradle.api.file.FileCollection
import org.gradle.internal.os.OperatingSystem
import edu.wpi.first.nativeutils.tasks.JNIHeaders
2016-05-12 12:24:08 -04:00
buildscript {
repositories {
mavenLocal()
2016-05-12 12:24:08 -04:00
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'gradle.plugin.edu.wpi.first:native-utils:1.2.9'
classpath 'gradle.plugin.edu.wpi.first.wpilib.versioning:wpilib-version-plugin:1.6'
}
}
repositories {
mavenCentral()
}
ext.getClassifier = { binary->
return NativeUtils.getClassifier(binary)
}
ext.getPlatformPath = { binary->
return NativeUtils.getPlatformPath(binary)
}
ext.getJNIHeadersClass = {
return JNIHeaders
}
apply plugin: 'cpp'
apply plugin: 'google-test'
apply plugin: 'visual-studio'
apply plugin: 'edu.wpi.first.NativeUtils'
apply plugin: 'java'
apply from: 'config.gradle'
if (project.hasProperty('onlyAthena')) {
test.enabled = false
}
sourceSets {
dev
}
task nativeTestFilesJar(type: Jar) {
destinationDir = project.buildDir
classifier = "nativeTestFiles"
project.model {
binaries {
withType(SharedLibraryBinarySpec) { binary ->
if (binary.component.name == 'ntcoreJNI') {
from(binary.sharedLibraryFile) {
into NativeUtils.getPlatformPath(binary)
}
dependsOn binary.buildTask
}
}
}
}
}
task run(type: JavaExec) {
classpath = sourceSets.dev.runtimeClasspath
main = 'edu.wpi.first.ntcore.DevMain'
}
test.dependsOn nativeTestFilesJar
run.dependsOn nativeTestFilesJar
build.dependsOn devClasses
dependencies {
compile 'edu.wpi.first.wpiutil:wpiutil-java:+'
testCompile 'junit:junit:4.12'
testRuntime files(project(':').nativeTestFilesJar.archivePath)
devCompile 'edu.wpi.first.wpiutil:wpiutil-java:+'
devCompile sourceSets.main.output
devRuntime files(project(':').nativeTestFilesJar.archivePath)
}
model {
jniConfigs {
ntcore(JNIConfig) {
Implement independent instances. Previously, most of the classes were implemented as singletons so only one instance was possible. This change adds an instance handle-based API. In Java, this API is located in a different package than the old API (edu.wpi.first.networktables). Backwards compatibility with ITable and the old NetworkTable API is largely maintained, but a handful of classes have moved to the new package in Java (ConnectionInfo and PersistentException), and the old JNI has been completed replaced. Also: - Move SetTeam implementation to Dispatcher. - Consistently pass time through Java and C++ Value API. - Rename nt_Value.h to NetworkTableValue.h for consistency with Java. - Improve documentation - Make C++ and Java APIs more consistent - Document RPC functions and support RPC in Java. - Add polling features for entry and connection listeners and use them to move callback threads to Java level. - Remove thread start and stop hooks (as polling is available). - Make Notifiers, RpcServer, Dispatcher, and Storage mockable. - Set NOTIFY_NEW on immediate entry notifications. - Make GetTable("/") and GetTable("") equivalent. - Generate local notification for flags update when loading persistent file. And many unit test updates/changes: - Use InitGoogleMock instead of InitGoogleTest in test main. - Move test printers to TestPrinter.h/cpp. - Provide printers for StringRef, EntryNotifier, and Handle. - StorageTest: Check notifications. - Add entry notifier unit tests. - Storage: Add test for incoming entry assignment. - Update connection listener tests. - Add entry listener unit tests. Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
jniDefinitionClasses = [ "edu.wpi.first.networktables.NetworkTablesJNI" ]
jniArmHeaderLocations = [ all: file("${rootDir}/src/arm-linux-jni") ]
sourceSets = [ project.sourceSets.main ]
}
ntcoreJNI(JNIConfig) {
Implement independent instances. Previously, most of the classes were implemented as singletons so only one instance was possible. This change adds an instance handle-based API. In Java, this API is located in a different package than the old API (edu.wpi.first.networktables). Backwards compatibility with ITable and the old NetworkTable API is largely maintained, but a handful of classes have moved to the new package in Java (ConnectionInfo and PersistentException), and the old JNI has been completed replaced. Also: - Move SetTeam implementation to Dispatcher. - Consistently pass time through Java and C++ Value API. - Rename nt_Value.h to NetworkTableValue.h for consistency with Java. - Improve documentation - Make C++ and Java APIs more consistent - Document RPC functions and support RPC in Java. - Add polling features for entry and connection listeners and use them to move callback threads to Java level. - Remove thread start and stop hooks (as polling is available). - Make Notifiers, RpcServer, Dispatcher, and Storage mockable. - Set NOTIFY_NEW on immediate entry notifications. - Make GetTable("/") and GetTable("") equivalent. - Generate local notification for flags update when loading persistent file. And many unit test updates/changes: - Use InitGoogleMock instead of InitGoogleTest in test main. - Move test printers to TestPrinter.h/cpp. - Provide printers for StringRef, EntryNotifier, and Handle. - StorageTest: Check notifications. - Add entry notifier unit tests. - Storage: Add test for incoming entry assignment. - Update connection listener tests. - Add entry listener unit tests. Fixes #11, #140, #189, #190, #192, #193, #221
2017-04-23 10:26:17 -07:00
jniDefinitionClasses = [ "edu.wpi.first.networktables.NetworkTablesJNI" ]
jniArmHeaderLocations = [ all: file("${rootDir}/src/arm-linux-jni") ]
sourceSets = [ project.sourceSets.main ]
}
}
exportsConfigs {
ntcore(ExportsConfig) {
x86ExcludeSymbols = [ '_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVbad_cast',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure' ]
x64ExcludeSymbols = [ '_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVbad_cast',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure' ]
}
ntcoreJNI(ExportsConfig) {
x86SymbolFilter = { symbols->
def retList = []
symbols.each { symbol->
if (symbol.startsWith('NT_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
x64SymbolFilter = { symbols->
def retList = []
symbols.each { symbol->
if (symbol.startsWith('NT_') || symbol.startsWith('Java_') || symbol.startsWith('JNI_')) {
retList << symbol
}
}
return retList
}
}
}
dependencyConfigs {
wpiutil(DependencyConfig) {
groupId = 'edu.wpi.first.wpiutil'
artifactId = 'wpiutil-cpp'
headerClassifier = 'headers'
ext = 'zip'
version = '+'
sharedConfigs = [ ntcore: [],
2017-08-13 08:01:39 -07:00
ntcoreDev: [],
ntcoreTestingBaseTest: [] ]
staticConfigs = [ ntcoreJNI: [] ]
}
}
components {
ntcore(NativeLibrarySpec) {
sources {
cpp {
source {
srcDirs 'src/main/native/cpp'
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/main/native/include'
}
}
}
}
ntcoreJNI(NativeLibrarySpec) {
baseName = 'ntcore'
sources {
cpp {
source {
srcDirs 'src/main/native/cpp'
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/main/native/include'
}
}
}
}
if (!project.hasProperty('skipTestExe')) {
2017-08-13 08:01:39 -07:00
ntcoreDev(NativeExecutableSpec) {
sources {
cpp {
lib library: "ntcore"
2017-08-04 13:35:23 -05:00
source {
srcDirs 'src/dev/native/cpp'
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/dev/native/include'
}
}
}
}
}
ntcoreTestingBase(NativeLibrarySpec) { }
}
testSuites {
ntcoreTestingBaseTest {
sources {
cpp {
source {
srcDirs 'src/test/native/cpp'
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/test/native/include', 'src/main/native/cpp'
}
}
}
}
}
binaries {
withType(StaticLibraryBinarySpec) {
if (it.component.name == 'ntcoreJNI') {
it.buildable = false
}
}
withType(GoogleTestTestSuiteBinarySpec) {
if (it.component.testedComponent.name.contains('TestingBase') && !project.hasProperty('onlyAthena')) {
lib project: ':gmock', library: 'gmock', linkage: 'static'
lib library: 'ntcore', linkage: 'shared'
} else {
it.buildable = false
}
}
}
2017-08-13 08:01:39 -07:00
tasks {
def c = $.components
project.tasks.create('runCpp', Exec) {
def found = false
c.each {
if (it in NativeExecutableSpec && it.name == 'ntcoreDev') {
it.binaries.each {
if (!found) {
def arch = it.targetPlatform.architecture.name
if (arch == 'x86-64' || arch == 'x86') {
dependsOn it.tasks.install
commandLine it.tasks.install.runScript
found = true
}
}
}
}
}
}
}
}
apply from: 'publish.gradle'
2016-06-30 19:57:29 -07:00
task wrapper(type: Wrapper) {
2017-08-11 01:10:18 -07:00
gradleVersion = '4.1'
2016-06-30 19:57:29 -07:00
}