Files
allwpilib/wpilibNewCommands/build.gradle
Sam Carlberg 3972b01c51 Add javac plugin for detecting common error cases at compile time (#8196)
Adds a `@NoDiscard` annotation that can be placed on methods to guarantee their return values are used and on types to guarantee that any method returning that type uses the return value.

Methods that call `@NoDiscard`-annotated functions can add a `@SuppressWarnings("NoDiscard")` or `@SuppressWarnings("all")` annotation (or annotation on the class declaring that method) to silence the compiler error warnings.
2025-10-03 17:42:47 -07:00

111 lines
3.7 KiB
Groovy

ext {
nativeName = 'wpilibNewCommands'
devMain = 'edu.wpi.first.wpilibj2.commands.DevMain'
}
evaluationDependsOn(':ntcore')
evaluationDependsOn(':cscore')
evaluationDependsOn(':hal')
evaluationDependsOn(':wpimath')
evaluationDependsOn(':wpilibc')
evaluationDependsOn(':cameraserver')
evaluationDependsOn(':wpilibj')
apply from: "${rootDir}/shared/javacpp/setupBuild.gradle"
dependencies {
implementation project(':wpiutil')
implementation project(':wpinet')
implementation project(':ntcore')
implementation project(':cscore')
implementation project(':hal')
implementation project(':wpimath')
implementation project(':wpilibj')
implementation project(':wpiannotations')
testImplementation 'org.mockito:mockito-core:4.1.0'
annotationProcessor project(':javacPlugin')
}
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
nativeUtils.exportsConfigs {
wpilibNewCommands {
}
}
model {
components {
"${nativeName}Base" {
it.sources.cpp {
source {
srcDirs 'src/generated/main/native/cpp'
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/generated/main/native/include'
}
}
}
"${nativeName}" {
it.sources.cpp.exportedHeaders {
srcDirs 'src/generated/main/native/include'
}
}
}
binaries {
all {
if (!it.buildable || !(it instanceof NativeBinarySpec)) {
return
}
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
project(':ntcore').addNtcoreDependency(it, 'shared')
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
if (it.component.name == "${nativeName}Dev") {
project(':ntcore').addNtcoreJniDependency(it)
lib project: ':wpinet', library: 'wpinetJNIShared', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutilJNIShared', linkage: 'shared'
lib project: ':wpimath', library: 'wpimathJNIShared', linkage: 'shared'
project(':hal').addHalJniDependency(it)
}
if (it instanceof GoogleTestTestSuiteBinarySpec) {
nativeUtils.useRequiredLibrary(it, 'opencv_shared')
lib project: ':cscore', library: 'cscore', linkage: 'shared'
}
if ((it instanceof NativeExecutableBinarySpec || it instanceof GoogleTestTestSuiteBinarySpec) && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries')
}
}
}
tasks {
def c = $.components
def found = false
def systemArch = getCurrentArch()
c.each {
if (it in NativeExecutableSpec && it.name == "${nativeName}Dev") {
it.binaries.each {
if (!found) {
def arch = it.targetPlatform.name
if (arch == systemArch) {
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
found = true
}
}
}
}
}
}
}
test {
testLogging {
outputs.upToDateWhen {false}
showStandardStreams = true
}
}