mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add docs and lifecycle tasks for faster dev builds (#2182)
This commit is contained in:
committed by
Peter Johnson
parent
ea4d1a39e1
commit
5e08bb28f8
15
FasterBuilds.md
Normal file
15
FasterBuilds.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Faster Builds for Developers
|
||||
|
||||
When you run `./gradlew build`, it builds EVERYTHING. This means debug and release builds for desktop and all installed cross compilers. For many developers, this is way too much, and causes much developer pain.
|
||||
|
||||
To help with some of these things, common tasks have shortcuts to only build necessary things for common development and testing tasks.
|
||||
|
||||
## Development (Desktop)
|
||||
|
||||
For projects `wpiutil`, `ntcore`, `cscore`, `hal` `wpilibOldCommands`, `wpilibNewCommands` and `cameraserver`, a `testDesktopJava` and a `testDesktopCpp` task exists. These can be ran with `./gradlew :projectName:task`, and will only build the minimum things required to run those tests.
|
||||
|
||||
For `wpilibc`, a `testDesktopCpp` task exists. For `wpilibj`, a `testDesktopJava` task exists.
|
||||
|
||||
For `wpilibcExamples`, a `buildDesktopCpp` task exists (These can't be ran, but they can compile).
|
||||
|
||||
For `wpilibjExamples`, a `buildDesktopJava` task exists.
|
||||
21
shared/cppDesktopTestTask.gradle
Normal file
21
shared/cppDesktopTestTask.gradle
Normal file
@@ -0,0 +1,21 @@
|
||||
model {
|
||||
tasks {
|
||||
def ts = $.testSuites
|
||||
project.tasks.register('testDesktopCpp') { testTask->
|
||||
def systemArch = getCurrentArch()
|
||||
def found = false
|
||||
ts.each {
|
||||
if (it in GoogleTestTestSuiteSpec && it.name == "${nativeName}Test") {
|
||||
it.binaries.each {
|
||||
if (found) return
|
||||
def arch = it.targetPlatform.name
|
||||
if (arch == systemArch && it.buildType.name == 'debug') {
|
||||
testTask.dependsOn it.tasks.run
|
||||
found = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
shared/javaDesktopTestTask.gradle
Normal file
3
shared/javaDesktopTestTask.gradle
Normal file
@@ -0,0 +1,3 @@
|
||||
tasks.register('testDesktopJava') {
|
||||
dependsOn test
|
||||
}
|
||||
@@ -141,6 +141,9 @@ model {
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/shared/cppDesktopTestTask.gradle"
|
||||
apply from: "${rootDir}/shared/javaDesktopTestTask.gradle"
|
||||
|
||||
tasks.withType(RunTestExecutable) {
|
||||
args "--gtest_output=xml:test_detail.xml"
|
||||
outputs.dir outputDir
|
||||
|
||||
@@ -275,6 +275,9 @@ model {
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/shared/cppDesktopTestTask.gradle"
|
||||
apply from: "${rootDir}/shared/javaDesktopTestTask.gradle"
|
||||
|
||||
ext.getJniSpecClass = {
|
||||
return JniNativeLibrarySpec
|
||||
}
|
||||
|
||||
@@ -231,6 +231,8 @@ model {
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/shared/cppDesktopTestTask.gradle"
|
||||
|
||||
tasks.withType(RunTestExecutable) {
|
||||
args "--gtest_output=xml:test_detail.xml"
|
||||
outputs.dir outputDir
|
||||
|
||||
@@ -6,6 +6,8 @@ apply plugin: 'visual-studio'
|
||||
apply plugin: 'edu.wpi.first.NativeUtils'
|
||||
apply plugin: ExtraTasks
|
||||
|
||||
evaluationDependsOn(':hal')
|
||||
|
||||
apply from: '../shared/config.gradle'
|
||||
|
||||
ext.examplesMap = [:]
|
||||
@@ -222,6 +224,25 @@ model {
|
||||
}
|
||||
apply from: 'publish.gradle'
|
||||
|
||||
model {
|
||||
tasks {
|
||||
def c = $.components
|
||||
project.tasks.register('buildDesktopCpp') { compileTask->
|
||||
def systemArch = getCurrentArch()
|
||||
c.each {
|
||||
if (it in NativeExecutableSpec && it.name) {
|
||||
it.binaries.each {
|
||||
def arch = it.targetPlatform.name
|
||||
if (arch == systemArch && it.buildType.name == 'debug') {
|
||||
compileTask.dependsOn it.tasks.link
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
templateDirectory = new File("$projectDir/src/main/cpp/templates/")
|
||||
templateFile = new File("$projectDir/src/main/cpp/templates/templates.json")
|
||||
|
||||
@@ -170,3 +170,5 @@ test {
|
||||
showStandardStreams = true
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/shared/javaDesktopTestTask.gradle"
|
||||
|
||||
@@ -39,6 +39,10 @@ gradle.projectsEvaluated {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('buildDesktopJava') {
|
||||
it.dependsOn tasks.withType(JavaCompile)
|
||||
}
|
||||
|
||||
apply from: 'publish.gradle'
|
||||
|
||||
ext {
|
||||
|
||||
Reference in New Issue
Block a user