Disable google tests on cross compilers (#1738)

Removes checks for onlyathena and onlyraspbian, and just disables gtest for cross compilers.
This commit is contained in:
Thad House
2019-06-29 09:27:11 -07:00
committed by Peter Johnson
parent d9cb57a429
commit 2dc94e6052
4 changed files with 25 additions and 21 deletions

View File

@@ -9,7 +9,9 @@ import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import edu.wpi.first.toolchain.ToolchainExtension
import org.gradle.model.Mutate;
import org.gradle.api.plugins.ExtensionContainer;
import org.gradle.nativeplatform.test.googletest.GoogleTestTestSuiteBinarySpec;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
@@ -52,6 +54,20 @@ class MultiBuilds implements Plugin<Project> {
binary.buildable = false
}
@Validate
@CompileStatic
// TODO: Move this to tc plugin
void disableCrossTests(BinaryContainer binaries, ExtensionContainer extContainer) {
final ToolchainExtension ext = extContainer.getByType(ToolchainExtension.class);
for (GoogleTestTestSuiteBinarySpec binary : binaries.withType(GoogleTestTestSuiteBinarySpec.class)) {
if (ext.getCrossCompilers().findByName(binary.getTargetPlatform().getName()) != null) {
setBuildableFalseDynamically(binary)
}
}
}
@Mutate
@CompileStatic
void disableReleaseGoogleTest(BinaryContainer binaries, ProjectLayout projectLayout) {

View File

@@ -103,11 +103,7 @@ model {
}
binaries {
withType(GoogleTestTestSuiteBinarySpec) {
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian')) {
lib library: nativeName, linkage: 'shared'
} else {
it.buildable = false
}
lib library: nativeName, linkage: 'shared'
}
}
tasks {

View File

@@ -232,12 +232,8 @@ model {
}
binaries {
withType(GoogleTestTestSuiteBinarySpec) {
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian')) {
lib library: nativeName, linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
} else {
it.buildable = false
}
lib library: nativeName, linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
tasks {

View File

@@ -203,16 +203,12 @@ model {
}
}
withType(GoogleTestTestSuiteBinarySpec) {
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
lib library: nativeName, linkage: 'shared'
} else {
it.buildable = false
}
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
lib library: nativeName, linkage: 'shared'
}
}
tasks {