Skip to content

Commit de7accc

Browse files
author
Stewart Miles
committed
Fixed exec tasks with file dependencies.
Gradle appears to ignore input and output files for exec tasks so move the exec to a build step of a generic task. Change-Id: Ibd6eddb3f18ebea6ceb5ca6bc96a918c5ba1dbc5
1 parent de23579 commit de7accc

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

build.gradle

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -730,28 +730,32 @@ Task createXbuildTask(String taskName, String taskDescription,
730730

731731
Task task = tasks.create(name: taskName,
732732
description: taskDescription,
733-
type: Exec,
733+
type: Task,
734734
dependsOn: compileTaskDependencies).with {
735735
inputs.files inputFiles
736736
outputs.files files(outputFilesInBinaryOutputDir)
737-
executable project.ext.xbuildExe
738-
workingDir projectToBuild.parentFile.absolutePath
739-
args ([sprintf("/target:%s", target),
740-
sprintf("/property:UnityHintPath=%s",
741-
project.ext.unityDllPath.absolutePath),
742-
sprintf("/property:UnityIosPath=%s",
743-
project.ext.unityIosPath.absolutePath),
744-
sprintf("/property:NUnityHintPath=%s",
745-
project.ext.unityNUnitDll ?
746-
project.ext.unityNUnitDll.absolutePath: ""),
747-
sprintf("/property:BaseIntermediateOutputPath=%s%s",
748-
intermediatesDir.absolutePath,
749-
File.separator),
750-
sprintf("/property:OutputPath=%s%s",
751-
binaryOutputDir.absolutePath,
752-
File.separator),
753-
"/verbosity:quiet",
754-
projectToBuild.absolutePath])
737+
doLast {
738+
exec {
739+
executable project.ext.xbuildExe
740+
workingDir projectToBuild.parentFile.absolutePath
741+
args ([sprintf("/target:%s", target),
742+
sprintf("/property:UnityHintPath=%s",
743+
project.ext.unityDllPath.absolutePath),
744+
sprintf("/property:UnityIosPath=%s",
745+
project.ext.unityIosPath.absolutePath),
746+
sprintf("/property:NUnityHintPath=%s",
747+
project.ext.unityNUnitDll ?
748+
project.ext.unityNUnitDll.absolutePath: ""),
749+
sprintf("/property:BaseIntermediateOutputPath=%s%s",
750+
intermediatesDir.absolutePath,
751+
File.separator),
752+
sprintf("/property:OutputPath=%s%s",
753+
binaryOutputDir.absolutePath,
754+
File.separator),
755+
"/verbosity:quiet",
756+
projectToBuild.absolutePath])
757+
}
758+
}
755759
}
756760
task.ext.buildDir = outputDir
757761
return task
@@ -871,16 +875,20 @@ Task createNUnitTask(String name, String description, File testDll,
871875
File xmlLogFile = new File(logFileDir, name + ".xml")
872876
return tasks.create(name: name,
873877
description: description,
874-
type: Exec,
878+
type: Task,
875879
dependsOn: dependsOn).with {
876-
workingDir project.ext.pluginSourceDir
877-
inputs.files testDll
878-
outputs.files logFile
879-
executable project.ext.nunitConsoleExe
880-
args ([sprintf("-output:%s", logFile.absolutePath),
881-
sprintf("-xml:%s", xmlLogFile.absolutePath),
882-
testDll.absolutePath])
883880
doFirst { checkNUnitConsolePath() }
881+
doLast {
882+
exec {
883+
workingDir project.ext.pluginSourceDir
884+
inputs.files testDll
885+
outputs.files logFile
886+
executable project.ext.nunitConsoleExe
887+
args ([sprintf("-output:%s", logFile.absolutePath),
888+
sprintf("-xml:%s", xmlLogFile.absolutePath),
889+
testDll.absolutePath])
890+
}
891+
}
884892
}
885893
}
886894

0 commit comments

Comments
 (0)