Native: How to get the path of an executable

native

(ZOSROTHKO) #1

Hello

My build.gradle contains a NativeExecutableSpec and I need to get the absolute or relative path of the executable at runtime. How could I get the path of the TestApp executable in the tasks.withType(RunTestExecutable) below ?

model {
     components {
        TestApp(NativeExecutableSpec) {
            sources {
                cpp {
                    source {
                           srcDir 'src'
                           include 'TestApp.cpp'
                    }
		}
	}}}}
tasks.withType(RunTestExecutable) {
}

(Daniel Lacasse) #2

The solution to this question should be the same as explained in this issue. You can use NativeTestSuiteBinarySpec#getExecutableFile() to get the absolute path of the test binary.