Unable to depend on target dependent InstallExecutable task

The goal is to upload and run the installed executable to a remote target over SSH. However, when Gradle project syncing, it shows “Could not find property” error of the dependent installExecutable task which is print by executing gradle tasks. Here is the code segment. The target executable “video_source_test” is cross-compiled for the odroid target. Here is part of the script.

model {
    ....
    components {  
        ....  
        video_source_test(NativeExecutableSpec) {
            targetPlatform "odroid"
            sources {
                c {
                    source {
                       srcDir "src/test/c"
                       include "video_source_test.c"
                    }
                }
            }
            binaries.all {
                lib library: 'odroid', linkage: 'shared'
            }
        }
    }
}

apply plugin: 'org.hidetake.ssh'
// No problem for this task to print the properties of task installVideo_source_testExecutable
task PreOdroidTest() << {
    println installVideo_source_testExecutable.destinationDir
    println installVideo_source_testExecutable.executable
    println installVideo_source_testExecutable.libs
}

// Could not find property 'installVideo_source_testExecutable' on project ':Optimizer'
task OdroidTest(dependsOn: installVideo_source_testExecutable) << {
    println "OdroidTest comes late"
    ssh.run {
        session(remotes.odroid) {
            def dest = 'Documents/dev/install/video_source_testExecutable'
            put from: 'Optimizer/build/install', into: 'Documents/dev/'
            execute("chmod +x $dest/video_source_test");
            execute("chmod +x $dest/lib/video_source_test")
            execute("$dest/video_source_test");
        }
    }
}

PreOdroidTest can be executed to access installVideo_source_testExecutable without problems but OdroidTest cannot depend on installVideo_source_testExecutable. Any ideas?

If not possible in this scenario, please suggest the alternative way to achieve the goal. Ultimately, I would like to integrate with some test framework like google-test to run the test on a remote target but am not sure of the most efficient way to do it.

Thanks.

PS: Gradle version 2.5 and Android Studio. This module is a Java module. The executable is built using the c plugin.

I got a workaround by appending the dependency separately as follows.

OdroidTest.dependsOn {
    tasks.findAll { task -> task.name == 'installVideo_source_testExecutable'}
}

Alternatively,

OdroidTest.dependsOn { installVideo_source_testExecutable }

However, it is confusing why it is not allowed to declare in the task definition. A possible justification may be the fact that dynamic tasks have to be encapsulated in closures that are not evaluated until invoked and at that time, those tasks are created.