2017-10-31 09:07:53 +01:00
|
|
|
import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec
|
|
|
|
|
|
|
|
model {
|
|
|
|
components {
|
2018-09-28 16:31:45 +02:00
|
|
|
/*
|
2017-10-31 09:07:53 +01:00
|
|
|
withType(NativeComponentSpec) {
|
|
|
|
binaries.withType(NativeBinarySpec) {
|
|
|
|
if (buildType == buildTypes.debug) {
|
2018-09-28 16:31:45 +02:00
|
|
|
if (it instanceof NativeExecutableBinarySpec) {
|
2017-10-31 09:07:53 +01:00
|
|
|
executable.file = toLocalBin(appendDebugSuffix(executable.file), targetPlatform)
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (buildType == buildTypes.release) {
|
2018-09-28 16:31:45 +02:00
|
|
|
if (it instanceof NativeExecutableBinarySpec) {
|
2017-10-31 09:07:53 +01:00
|
|
|
executable.file = toLocalBin(executable.file, targetPlatform)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-28 16:31:45 +02:00
|
|
|
*/
|
2018-09-22 20:28:04 +02:00
|
|
|
TestLibrary(NativeLibrarySpec) {
|
2017-10-31 09:07:53 +01:00
|
|
|
sources {
|
|
|
|
cpp {
|
|
|
|
source {
|
|
|
|
srcDir 'src'
|
|
|
|
include 'TestLibrary.cpp'
|
|
|
|
include 'TestPlugin.cpp'
|
|
|
|
}
|
|
|
|
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TestApp(NativeExecutableSpec) {
|
|
|
|
sources {
|
|
|
|
cpp {
|
|
|
|
source {
|
|
|
|
srcDir 'src'
|
|
|
|
include 'TestApp.cpp'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TestSuite(NativeLibrarySpec) {
|
|
|
|
sources {
|
|
|
|
cpp {
|
|
|
|
source {
|
|
|
|
srcDir 'src'
|
|
|
|
include '**/*.cpp'
|
|
|
|
exclude '*Driver.cpp'
|
|
|
|
exclude '*_WINCE.cpp'
|
|
|
|
exclude 'TestApp*.cpp'
|
|
|
|
}
|
|
|
|
exportedHeaders {
|
|
|
|
srcDir 'src'
|
|
|
|
}
|
|
|
|
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
|
|
|
|
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
testSuites {
|
|
|
|
FoundationTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
|
2018-09-26 10:47:12 +02:00
|
|
|
testing $.components.TestSuite
|
2018-10-05 15:31:16 +02:00
|
|
|
binaries.all {
|
2018-10-10 16:54:39 +02:00
|
|
|
|
2018-10-20 01:05:20 +02:00
|
|
|
String PATH = ""
|
|
|
|
if (targetPlatform.name.startsWith("win"))
|
|
|
|
PATH = tasks.run.environment.get("Path")
|
|
|
|
else
|
|
|
|
PATH = tasks.run.environment.get("PATH")
|
2018-10-05 15:31:16 +02:00
|
|
|
|
2018-10-03 19:42:00 +02:00
|
|
|
String testAppDir = project.buildDir
|
2018-10-05 15:31:16 +02:00
|
|
|
testAppDir += "/exe" + "/testApp"
|
|
|
|
testAppDir += "/" + targetPlatform.name
|
|
|
|
if (buildType == buildTypes.debug)
|
|
|
|
testAppDir += "/debug"
|
|
|
|
else
|
|
|
|
if (buildType == buildTypes.release)
|
|
|
|
testAppDir += "/release"
|
|
|
|
|
|
|
|
|
|
|
|
if (targetPlatform.name.startsWith("win"))
|
|
|
|
testAppDir = testAppDir.replace('/', '\\')
|
|
|
|
|
|
|
|
|
2018-10-11 19:23:00 +02:00
|
|
|
PATH = testAppDir + File.pathSeparator + PATH
|
2018-10-20 01:05:20 +02:00
|
|
|
if (targetPlatform.name.startsWith("win"))
|
|
|
|
tasks.run.environment "Path", PATH
|
|
|
|
else
|
|
|
|
tasks.run.environment "PATH", PATH
|
2018-10-05 15:31:16 +02:00
|
|
|
}
|
2017-10-31 09:07:53 +01:00
|
|
|
}
|
|
|
|
}
|
2018-09-26 10:47:12 +02:00
|
|
|
binaries {
|
2017-10-31 09:07:53 +01:00
|
|
|
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
|
|
|
|
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
|
2018-09-22 20:28:04 +02:00
|
|
|
lib library: 'TestLibrary', linkage: 'shared'
|
|
|
|
|
2017-10-31 09:07:53 +01:00
|
|
|
if (toolChain in VisualCpp) {
|
|
|
|
if (buildType == buildTypes.debug) {
|
|
|
|
cCompiler.args "/MDd"
|
|
|
|
cppCompiler.args "/MDd"
|
|
|
|
} else
|
|
|
|
if (buildType == buildTypes.release) {
|
|
|
|
cCompiler.args "/MD"
|
|
|
|
cppCompiler.args "/MD"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (toolChain in Gcc) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task testsuite { dependsOn "assemble" }
|
|
|
|
|
2018-09-30 16:44:28 +02:00
|
|
|
tasks.withType(RunTestExecutable) {
|
|
|
|
environment "POCO_BASE", "$rootDir"
|
|
|
|
args test
|
2018-10-11 19:23:00 +02:00
|
|
|
}
|