This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Tasks
SquidDev edited this page Dec 6, 2014
·
5 revisions
The simplest way to define a task is through the Tasks:Task
functions
Tasks:Task "compile"(function()
print("Compiling now...")
end)
You can define dependencies:
Tasks:Task "test"({"compile"}, function()
print("Running tests")
end)
You can also chains functions together:
Task:Task "test"(function()
print("Running tests")
end)
:Depends("compile")
:Description("Compile and run tests")
You can also use the Tasks:AddTask
function. This also supports chaining:
TaskRunner:AddTask("test", {"compile"}, function()
print("running tests")
end):Description("Compile and run tests")
Some tasks have predefined functions. These normally follow the pattern Tasks::TypeName(name, options, taskDependencies)
Clean removes a directory/file from the filesystem. It is worth noting that the directory is global, so you must use fs.combine
Tasks:Clean("clean", fs.combine(CurrentDirectory, "build"))
Combines a dependency tree into one file
local sources = Dependencies(CurrentDirectory)
sources:Main "Thing.lua"
:Depends "Another"
sources:Main "Another.lua"
:Name "Another"
Tasks:Combine("combine", sources, "build.lua", {"clean"})
You can read more on dependencies here.