mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Also fixes the google compile-testing library to 0.23.0 (the latest available at time of writing) instead of a wildcard Jackson versions were inconsistent across projects; most were on 2.19.2, but the fields subproject was on 2.15.2. All projects are now on 2.19.2 for consistency
172 lines
5.7 KiB
Groovy
172 lines
5.7 KiB
Groovy
evaluationDependsOn(':hal')
|
|
evaluationDependsOn(':ntcore')
|
|
evaluationDependsOn(':cscore')
|
|
evaluationDependsOn(':cameraserver')
|
|
|
|
ext {
|
|
baseId = 'wpilibj'
|
|
groupId = 'org.wpilib.wpilibj'
|
|
devMain = 'org.wpilib.wpilibj.DevMain'
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/java/javacommon.gradle"
|
|
|
|
def wpilibVersionFileInput = file("src/generate/WPILibVersion.java.in")
|
|
def wpilibVersionFileOutput = file("$buildDir/generated/java/org/wpilib/system/WPILibVersion.java")
|
|
|
|
task generateJavaVersion() {
|
|
description = 'Generates the wpilib version class'
|
|
group = 'WPILib'
|
|
|
|
outputs.file wpilibVersionFileOutput
|
|
inputs.file wpilibVersionFileInput
|
|
|
|
if (wpilibVersioning.releaseMode) {
|
|
outputs.upToDateWhen { false }
|
|
}
|
|
|
|
// We follow a simple set of checks to determine whether we should generate a new version file:
|
|
// 1. If the release type is not development, we generate a new version file
|
|
// 2. If there is no generated version number, we generate a new version file
|
|
// 3. If there is a generated build number, and the release type is development, then we will
|
|
// only generate if the publish task is run.
|
|
doLast {
|
|
def version = wpilibVersioning.version.get()
|
|
println "Writing version ${version} to $wpilibVersionFileOutput"
|
|
|
|
if (wpilibVersionFileOutput.exists()) {
|
|
wpilibVersionFileOutput.delete()
|
|
}
|
|
def read = wpilibVersionFileInput.text.replace('${wpilib_version}', version)
|
|
wpilibVersionFileOutput.write(read)
|
|
}
|
|
}
|
|
|
|
gradle.taskGraph.addTaskExecutionGraphListener { graph ->
|
|
def willPublish = graph.hasTask(publish)
|
|
if (willPublish) {
|
|
generateJavaVersion.outputs.upToDateWhen { false }
|
|
}
|
|
}
|
|
|
|
sourceSets.main.java.srcDir "${buildDir}/generated/java/"
|
|
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
|
|
|
|
compileJava {
|
|
dependsOn generateJavaVersion
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':hal')
|
|
implementation project(':wpiutil')
|
|
implementation project(':wpinet')
|
|
implementation project(':wpimath')
|
|
implementation project(':ntcore')
|
|
implementation project(':cscore')
|
|
api project(':datalog')
|
|
implementation project(':cameraserver')
|
|
testImplementation(libs.bundles.mockito)
|
|
devImplementation sourceSets.main.output
|
|
}
|
|
|
|
apply plugin: 'cpp'
|
|
apply plugin: 'org.wpilib.NativeUtils'
|
|
apply plugin: ExtraTasks
|
|
apply from: "${rootDir}/shared/config.gradle"
|
|
|
|
project(':').libraryBuild.dependsOn build
|
|
|
|
ext {
|
|
sharedCvConfigs = [wpilibjDev: []]
|
|
staticCvConfigs = [:]
|
|
useJava = true
|
|
useCpp = true
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/opencv.gradle"
|
|
|
|
model {
|
|
components {
|
|
wpilibjDev(NativeExecutableSpec) {
|
|
targetBuildTypes 'debug'
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs 'src/dev/native/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/dev/native/include'
|
|
}
|
|
}
|
|
}
|
|
binaries.all {
|
|
project(':ntcore').addNtcoreDependency(it, 'shared')
|
|
project(':ntcore').addNtcoreJniDependency(it)
|
|
lib project: ':cscore', library: 'cscore', linkage: 'shared'
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
|
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
|
|
lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared'
|
|
lib project: ':wpinet', library: 'wpinetJNIShared', linkage: 'shared'
|
|
lib project: ':wpiutil', library: 'wpiutilJNIShared', linkage: 'shared'
|
|
lib project: ':wpimath', library: 'wpimathJNIShared', linkage: 'shared'
|
|
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
|
|
project(':hal').addHalDependency(it, 'shared')
|
|
project(':hal').addHalJniDependency(it)
|
|
}
|
|
}
|
|
}
|
|
tasks {
|
|
def c = $.components
|
|
project.tasks.create('runCpp', Exec) {
|
|
group = 'WPILib'
|
|
description = "Run the wpilibjDev executable"
|
|
def found = false
|
|
def systemArch = getCurrentArch()
|
|
c.each {
|
|
//println it.name
|
|
if (it in NativeExecutableSpec && it.name == "wpilibjDev") {
|
|
it.binaries.each {
|
|
if (!found) {
|
|
def arch = it.targetPlatform.name
|
|
if (arch == systemArch) {
|
|
dependsOn it.tasks.install
|
|
commandLine it.tasks.install.runScriptFile.get().asFile.toString()
|
|
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
|
|
test.dependsOn it.tasks.install
|
|
test.systemProperty 'java.library.path', filePath
|
|
run.dependsOn it.tasks.install
|
|
run.systemProperty 'java.library.path', filePath
|
|
|
|
found = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def oldWpilibVersionFile = file('src/main/java/org/wpilib/system/WPILibVersion.java')
|
|
|
|
clean {
|
|
delete oldWpilibVersionFile
|
|
}
|
|
|
|
test {
|
|
testLogging {
|
|
outputs.upToDateWhen {false}
|
|
showStandardStreams = true
|
|
}
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/javaDesktopTestTask.gradle"
|