2018-04-29 13:29:07 -07:00
|
|
|
evaluationDependsOn(':hal')
|
|
|
|
|
evaluationDependsOn(':ntcore')
|
|
|
|
|
evaluationDependsOn(':cscore')
|
|
|
|
|
evaluationDependsOn(':cameraserver')
|
|
|
|
|
|
|
|
|
|
ext {
|
|
|
|
|
baseId = 'wpilibj'
|
2025-11-07 20:00:38 -05:00
|
|
|
groupId = 'org.wpilib.wpilibj'
|
|
|
|
|
devMain = 'org.wpilib.wpilibj.DevMain'
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
apply from: "${rootDir}/shared/java/javacommon.gradle"
|
Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.
Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.
Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.
Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-05 09:54:14 -04:00
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
def wpilibVersionFileInput = file("src/generate/WPILibVersion.java.in")
|
2025-11-07 19:56:29 -05:00
|
|
|
def wpilibVersionFileOutput = file("$buildDir/generated/java/org/wpilib/system/WPILibVersion.java")
|
2017-08-18 21:35:53 -07:00
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
task generateJavaVersion() {
|
|
|
|
|
description = 'Generates the wpilib version class'
|
|
|
|
|
group = 'WPILib'
|
2017-08-18 21:35:53 -07:00
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
outputs.file wpilibVersionFileOutput
|
|
|
|
|
inputs.file wpilibVersionFileInput
|
2017-08-18 21:35:53 -07:00
|
|
|
|
2019-08-22 21:48:43 -07:00
|
|
|
if (wpilibVersioning.releaseMode) {
|
2018-04-29 13:29:07 -07:00
|
|
|
outputs.upToDateWhen { false }
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
2016-10-20 23:54:04 -07:00
|
|
|
|
|
|
|
|
// We follow a simple set of checks to determine whether we should generate a new version file:
|
2019-03-10 18:40:16 -07:00
|
|
|
// 1. If the release type is not development, we generate a new version file
|
2016-10-20 23:54:04 -07:00
|
|
|
// 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 {
|
2019-08-22 21:48:43 -07:00
|
|
|
def version = wpilibVersioning.version.get()
|
|
|
|
|
println "Writing version ${version} to $wpilibVersionFileOutput"
|
2016-10-20 23:54:04 -07:00
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
if (wpilibVersionFileOutput.exists()) {
|
|
|
|
|
wpilibVersionFileOutput.delete()
|
2016-10-20 23:54:04 -07:00
|
|
|
}
|
2019-08-22 21:48:43 -07:00
|
|
|
def read = wpilibVersionFileInput.text.replace('${wpilib_version}', version)
|
2018-04-29 13:29:07 -07:00
|
|
|
wpilibVersionFileOutput.write(read)
|
2016-10-20 23:54:04 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
gradle.taskGraph.addTaskExecutionGraphListener { graph ->
|
|
|
|
|
def willPublish = graph.hasTask(publish)
|
|
|
|
|
if (willPublish) {
|
|
|
|
|
generateJavaVersion.outputs.upToDateWhen { false }
|
|
|
|
|
}
|
2016-10-20 23:54:04 -07:00
|
|
|
}
|
|
|
|
|
|
2018-05-13 22:00:56 -07:00
|
|
|
sourceSets.main.java.srcDir "${buildDir}/generated/java/"
|
2024-06-08 12:59:07 -04:00
|
|
|
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
|
2018-04-29 13:29:07 -07:00
|
|
|
|
|
|
|
|
compileJava {
|
2018-05-13 22:00:56 -07:00
|
|
|
dependsOn generateJavaVersion
|
2016-12-08 00:24:44 -05:00
|
|
|
}
|
|
|
|
|
|
2019-08-25 17:47:07 -04:00
|
|
|
repositories {
|
2022-05-08 13:59:58 -07:00
|
|
|
maven {
|
|
|
|
|
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
|
|
|
|
|
}
|
2019-08-25 17:47:07 -04:00
|
|
|
}
|
|
|
|
|
|
Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.
Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.
Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.
Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-05 09:54:14 -04:00
|
|
|
dependencies {
|
2019-11-12 17:14:04 -08:00
|
|
|
implementation project(':hal')
|
|
|
|
|
implementation project(':wpiutil')
|
2022-05-07 10:54:14 -07:00
|
|
|
implementation project(':wpinet')
|
2020-08-06 23:57:39 -07:00
|
|
|
implementation project(':wpimath')
|
2019-11-12 17:14:04 -08:00
|
|
|
implementation project(':ntcore')
|
|
|
|
|
implementation project(':cscore')
|
2025-02-19 23:08:17 -06:00
|
|
|
api project(':datalog')
|
2019-11-12 17:14:04 -08:00
|
|
|
implementation project(':cameraserver')
|
2021-12-09 12:20:08 -08:00
|
|
|
testImplementation 'org.mockito:mockito-core:4.1.0'
|
2019-11-12 17:14:04 -08:00
|
|
|
devImplementation sourceSets.main.output
|
Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.
Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.
Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.
Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-05 09:54:14 -04:00
|
|
|
}
|
|
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
apply plugin: 'cpp'
|
2025-12-13 21:44:00 -08:00
|
|
|
apply plugin: 'org.wpilib.NativeUtils'
|
2018-04-29 13:29:07 -07:00
|
|
|
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"
|
2017-08-18 21:35:53 -07:00
|
|
|
|
|
|
|
|
model {
|
|
|
|
|
components {
|
2018-04-29 13:29:07 -07:00
|
|
|
wpilibjDev(NativeExecutableSpec) {
|
2018-10-27 00:19:38 -07:00
|
|
|
targetBuildTypes 'debug'
|
2017-08-18 21:35:53 -07:00
|
|
|
sources {
|
|
|
|
|
cpp {
|
|
|
|
|
source {
|
2018-04-29 13:29:07 -07:00
|
|
|
srcDirs 'src/dev/native/cpp'
|
|
|
|
|
include '**/*.cpp'
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
2018-04-29 13:29:07 -07:00
|
|
|
exportedHeaders {
|
|
|
|
|
srcDirs 'src/dev/native/include'
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-29 13:29:07 -07:00
|
|
|
binaries.all {
|
2022-10-08 10:01:31 -07:00
|
|
|
project(':ntcore').addNtcoreDependency(it, 'shared')
|
|
|
|
|
project(':ntcore').addNtcoreJniDependency(it)
|
2019-11-13 21:35:52 -08:00
|
|
|
lib project: ':cscore', library: 'cscore', linkage: 'shared'
|
2022-05-07 10:54:14 -07:00
|
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
|
2019-11-13 21:35:52 -08:00
|
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
2020-08-06 23:57:39 -07:00
|
|
|
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
|
2019-11-13 21:35:52 -08:00
|
|
|
lib project: ':cscore', library: 'cscoreJNIShared', linkage: 'shared'
|
2022-05-07 10:54:14 -07:00
|
|
|
lib project: ':wpinet', library: 'wpinetJNIShared', linkage: 'shared'
|
2019-12-01 13:25:46 -08:00
|
|
|
lib project: ':wpiutil', library: 'wpiutilJNIShared', linkage: 'shared'
|
2020-08-06 23:57:39 -07:00
|
|
|
lib project: ':wpimath', library: 'wpimathJNIShared', linkage: 'shared'
|
2019-11-13 21:35:52 -08:00
|
|
|
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
|
2018-09-19 21:57:58 -07:00
|
|
|
project(':hal').addHalDependency(it, 'shared')
|
2018-10-27 00:19:38 -07:00
|
|
|
project(':hal').addHalJniDependency(it)
|
2018-04-29 13:29:07 -07:00
|
|
|
}
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
2017-11-03 22:50:06 -07:00
|
|
|
tasks {
|
2018-04-29 13:29:07 -07:00
|
|
|
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") {
|
2017-11-03 22:50:06 -07:00
|
|
|
it.binaries.each {
|
2018-04-29 13:29:07 -07:00
|
|
|
if (!found) {
|
2019-06-28 14:09:10 -07:00
|
|
|
def arch = it.targetPlatform.name
|
2018-04-29 13:29:07 -07:00
|
|
|
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
|
2017-11-03 22:50:06 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-20 04:03:32 -05:00
|
|
|
}
|
2016-05-20 15:15:14 -04:00
|
|
|
|
2025-11-07 19:56:29 -05:00
|
|
|
def oldWpilibVersionFile = file('src/main/java/org/wpilib/system/WPILibVersion.java')
|
2017-08-18 21:35:53 -07:00
|
|
|
|
2018-04-29 13:29:07 -07:00
|
|
|
clean {
|
|
|
|
|
delete oldWpilibVersionFile
|
2017-08-18 21:35:53 -07:00
|
|
|
}
|
2018-11-17 20:29:27 -08:00
|
|
|
|
|
|
|
|
test {
|
|
|
|
|
testLogging {
|
|
|
|
|
outputs.upToDateWhen {false}
|
|
|
|
|
showStandardStreams = true
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-20 13:48:26 -08:00
|
|
|
|
|
|
|
|
apply from: "${rootDir}/shared/javaDesktopTestTask.gradle"
|