How to adapt Gradle enhanced tasks in buildscripts?

(Ganesh) #1

For Native Gradle builds, there is an enhanced task called LinkExecutable that is provided by Gradle. I would like to use this task for my requirements. However, I would like to know how to set the targetPlatform and toolChain property for this task type. Attached is an excerpt of my build.gradle

apply plugin: 'c'
task myLinker(type: LinkExecutable) {
	outputFile = file("build/exe/libplatform")
	source = files("pf/build/exe/pf/pf","pfEquipments/build/exe/pfEquipments/pfEquipments","pfSop/build/exe/pfSop/pfSop","pfApFw/build/exe/pfApFw/pfApFw","pfIf/build/exe/pfIf/pfIf")
	linkerArgs = ["-r --warn-common"]

My requirement is to to partially link these object files to make up the complete software. The DSL Reference says that toolChain should be of type NativeToolChain but how do I define this in my task body? My Java knowledge isn’t really great so I am sort of stuck at this position. The other properties were simple enough to configure.