gradle/gradle — pull request #352 by Shad0w1nk (2014-11-15 19:15:32+00:00)
Title: Google Test framework initial integration with Gradle.

It includes plugin, tests, docs and sample.

One thing that is not included is the automatic setup xml output. This would probably require a separation of the GoogleTestPlugin into a base and a more opinionated as the --gtest_output flag is automatically provided by the default main function from the Google Test plugin however it may not be how most people use Google Test.

Another thing not included is the prebuilt library for everything except macosx. I don't have the setup to build the other library however I pasted the build.gradle used for macosx which should work without modification for building all the other variants. Just drop the script in a freshly extracted gtest-1.7.0 and build as normal.

```groovy
apply plugin: 'cpp'

binaries.all {
if (it instanceof SharedLibraryBinary) {
cppCompiler.define "GTEST_CREATE_SHARED_LIBRARY", "1"
}
}

model {
components {
main(NativeLibrarySpec) {
baseName 'gtest-main'
sources {
cpp(CppSourceSet) {
exportedHeaders.srcDir 'include'
source.srcDir 'src'
source.include 'gtest_main.cc'
}
}
}
core(NativeLibrarySpec) {
baseName 'gtest-core'
sources {
cpp(CppSourceSet) {
exportedHeaders.srcDir 'include'
source.srcDir 'src'
source.include 'gtest-all.cc'
exportedHeaders.srcDir projectDir
}
}

}
}
platforms {
x86 {
architecture "x86"
}
}
}
```