From 928e87b4f48c910a48ee826b4395dab8a251efbd Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Tue, 24 Oct 2023 02:35:44 -0400 Subject: [PATCH] [build] Add combined test meta-task (#5813) --- README.md | 19 +++++++++++++++++-- shared/cppJavaDesktopTestTask.gradle | 7 +++++++ shared/javacpp/setupBuild.gradle | 3 +-- shared/jni/setupBuild.gradle | 3 +-- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 shared/cppJavaDesktopTestTask.gradle diff --git a/README.md b/README.md index e43f47467a..78f248652e 100644 --- a/README.md +++ b/README.md @@ -88,9 +88,24 @@ If opening from a fresh clone, generated java dependencies will not exist. Most `./gradlew build` builds _everything_, which includes debug and release builds for desktop and all installed cross compilers. Many developers don't need or want to build all of this. Therefore, common tasks have shortcuts to only build necessary components for common development and testing tasks. -`./gradlew testDesktopCpp` and `./gradlew testDesktopJava` will build and run the tests for `wpilibc` and `wpilibj` respectively. They will only build the minimum components required to run the tests. +`./gradlew testDesktopCpp` and `./gradlew testDesktopJava` will build and run the tests for `wpilibc` and `wpilibj` respectively. They will only build the minimum components required to run the tests. `./gradlew testDesktop` will run both `testDesktopJava` and `testDesktopCpp`. -`testDesktopCpp` and `testDesktopJava` tasks also exist for the projects `wpiutil`, `ntcore`, `cscore`, `hal` `wpilibNewCommands` and `cameraserver`. These can be ran with `./gradlew :projectName:task`. +`testDesktopCpp`, `testDesktopJava`, and `testDesktop` tasks also exist for the following projects: + +- `apriltag` +- `cameraserver` +- `cscore` +- `hal` +- `ntcore` +- `wpilibNewCommands` +- `wpimath` +- `wpinet` +- `wpiunits` +- `wpiutil` +- `romiVendordep` +- `xrpVendordep` + +These can be ran with `./gradlew :projectName:task`. `./gradlew buildDesktopCpp` and `./gradlew buildDesktopJava` will compile `wpilibcExamples` and `wpilibjExamples` respectively. The results can't be ran, but they can compile. diff --git a/shared/cppJavaDesktopTestTask.gradle b/shared/cppJavaDesktopTestTask.gradle new file mode 100644 index 0000000000..475c38c4cd --- /dev/null +++ b/shared/cppJavaDesktopTestTask.gradle @@ -0,0 +1,7 @@ +apply from: "${rootDir}/shared/cppDesktopTestTask.gradle" +apply from: "${rootDir}/shared/javaDesktopTestTask.gradle" + +tasks.register('testDesktop') { + dependsOn testDesktopJava + dependsOn testDesktopCpp +} diff --git a/shared/javacpp/setupBuild.gradle b/shared/javacpp/setupBuild.gradle index f2d88c4a82..1f3ff10acc 100644 --- a/shared/javacpp/setupBuild.gradle +++ b/shared/javacpp/setupBuild.gradle @@ -182,8 +182,7 @@ model { } } -apply from: "${rootDir}/shared/cppDesktopTestTask.gradle" -apply from: "${rootDir}/shared/javaDesktopTestTask.gradle" +apply from: "${rootDir}/shared/cppJavaDesktopTestTask.gradle" tasks.withType(RunTestExecutable) { args "--gtest_output=xml:test_detail.xml" diff --git a/shared/jni/setupBuild.gradle b/shared/jni/setupBuild.gradle index 6f4345ad57..9f9334ffc0 100644 --- a/shared/jni/setupBuild.gradle +++ b/shared/jni/setupBuild.gradle @@ -327,8 +327,7 @@ model { } } -apply from: "${rootDir}/shared/cppDesktopTestTask.gradle" -apply from: "${rootDir}/shared/javaDesktopTestTask.gradle" +apply from: "${rootDir}/shared/cppJavaDesktopTestTask.gradle" ext.getJniSpecClass = { return JniNativeLibrarySpec