mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[build] Delete test folders after tests execute (#2891)
Also deletes object files. Both of these things are only done on the build server (-PbuildServer flag). This will remove all test folders, which removes lots of copies of dependencies. This also fixes an issue where gtest exectubables were installed for cross builds, even though they should not have been.
This commit is contained in:
@@ -6,6 +6,8 @@ import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gradle.api.tasks.Delete
|
||||
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
@@ -87,6 +89,14 @@ class SingleNativeBuild implements Plugin<Project> {
|
||||
subs << component
|
||||
}
|
||||
}
|
||||
Delete deleteObjects = null
|
||||
if (project.hasProperty('buildServer')) {
|
||||
deleteObjects = project.tasks.create('deleteObjects', Delete)
|
||||
project.tasks.named('build').configure { Task t ->
|
||||
t.dependsOn deleteObjects
|
||||
return
|
||||
}
|
||||
}
|
||||
subs.each {
|
||||
((NativeLibrarySpec) it).binaries.each { oBinary ->
|
||||
if (oBinary.buildable == false) {
|
||||
@@ -136,6 +146,10 @@ class SingleNativeBuild implements Plugin<Project> {
|
||||
tree.include '**/*.o'
|
||||
tree.include '**/*.obj'
|
||||
link.source tree
|
||||
if (project.hasProperty('buildServer')) {
|
||||
deleteObjects.dependsOn link
|
||||
deleteObjects.delete tree
|
||||
}
|
||||
} else if (binary instanceof StaticLibraryBinarySpec) {
|
||||
def sBinary = (StaticLibraryBinarySpec) binary
|
||||
ObjectFilesToBinary assemble = (ObjectFilesToBinary) sBinary.tasks.createStaticLib
|
||||
@@ -145,6 +159,10 @@ class SingleNativeBuild implements Plugin<Project> {
|
||||
tree.include '**/*.o'
|
||||
tree.include '**/*.obj'
|
||||
assemble.source tree
|
||||
if (project.hasProperty('buildServer')) {
|
||||
deleteObjects.dependsOn assemble
|
||||
deleteObjects.delete tree
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ def generateUsageReporting = tasks.register('generateUsageReporting') {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: DisableBuildingGTest
|
||||
|
||||
ext {
|
||||
addHalDependency = { binary, shared->
|
||||
binary.tasks.withType(AbstractNativeSourceCompileTask) {
|
||||
|
||||
@@ -45,6 +45,19 @@ model {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: DisableBuildingGTest
|
||||
|
||||
if (project.hasProperty('buildServer')) {
|
||||
tasks.withType(org.gradle.nativeplatform.test.tasks.RunTestExecutable) {
|
||||
def exeFile = file(it.executable)
|
||||
def folder = exeFile.parentFile
|
||||
|
||||
it.doLast {
|
||||
folder.deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.appendDebugPathToBinaries = { binaries->
|
||||
binaries.withType(StaticLibraryBinarySpec) {
|
||||
if (it.buildType.name.contains('debug')) {
|
||||
|
||||
@@ -257,6 +257,15 @@ model {
|
||||
commandLine it.tasks.install.runScriptFile.get().asFile.toString()
|
||||
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
|
||||
test.dependsOn it.tasks.install
|
||||
|
||||
if (project.hasProperty('buildServer')) {
|
||||
def folderDir = it.tasks.install.installDirectory.get().toString()
|
||||
test.doLast {
|
||||
def folder = file(folderDir)
|
||||
folder.deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
test.systemProperty 'java.library.path', filePath
|
||||
test.environment 'LD_LIBRARY_PATH', filePath
|
||||
test.workingDir filePath
|
||||
|
||||
@@ -43,8 +43,6 @@ nativeUtils.exportsConfigs {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: DisableBuildingGTest
|
||||
|
||||
model {
|
||||
components {}
|
||||
binaries {
|
||||
|
||||
@@ -41,8 +41,6 @@ nativeUtils.exportsConfigs {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: DisableBuildingGTest
|
||||
|
||||
model {
|
||||
components {}
|
||||
binaries {
|
||||
|
||||
@@ -60,8 +60,6 @@ staticGtestConfigs["${nativeName}Test"] = []
|
||||
|
||||
apply from: "${rootDir}/shared/googletest.gradle"
|
||||
|
||||
apply plugin: DisableBuildingGTest
|
||||
|
||||
nativeUtils.exportsConfigs {
|
||||
wpilibc {
|
||||
x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
|
||||
|
||||
Reference in New Issue
Block a user