Hi,
thanks very muchJesper,
The GradleLauncher suits me fine!
this means I don't have to worry about which operating system I'm running
on, which is great!
In the end, i've done it like this:
moduleLogFile = new File("moduleBuildProcess.log")
if (moduleLogFile.isFile())
moduleLogFile.delete()
moduleLogFile.createNewFile()
def moduleBuildResult
new FileOutputStream(moduleLogFile).withStream { os ->
def startArgs = ['build',
"-p="+root.getAbsolutePath(),
"-PbuildLibs=${buildLibs}",
"-PbuildHome=${buildHome}",
] as String[]
StartParameter startParameterArgs =
GradleLauncher.createStartParameter(startArgs)
GradleLauncher launcher = GradleLauncher.newInstance(startParameterArgs)
StandardOutputListener logoutter = new StandardOutputListener(){
public void onOutput(CharSequence output){
os.write(output.toString().getBytes("UTF-8"))
}
}
launcher.addStandardOutputListener(logoutter)
launcher.addStandardErrorListener(logoutter)
moduleBuildResult = launcher.run()
os.close()
}
if (moduleBuildResult.getFailure()==null)
{
// do something in case of success
}
else
{
// do something in case of error
}