Skip to content

Commit

Permalink
Added --clean option & bug fix
Browse files Browse the repository at this point in the history
Command-line arguments need processing prior to expanding properties,
because those properties might depend on the selected conf/arch/proj.
  • Loading branch information
vercas committed Dec 21, 2016
1 parent 40deab8 commit 99e849b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions vmake-1.3.1-6.rockspec → vmake-1.4.0-7.rockspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package = "vmake"
version = "1.3.1-6"
version = "1.4.0-7"

source = {
url = "git://github.com/vercas/vMake",
tag = "v1.3.1",
tag = "v1.4.0",
}

description = {
Expand Down
31 changes: 27 additions & 4 deletions vmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ if arg then
end

local vmake, vmake__call, getEnvironment = {
Version = "1.3.1",
VersionNumber = 1003001,
Version = "1.4.0",
VersionNumber = 1004000,

Debug = false,
Silent = false,
Expand All @@ -63,6 +63,7 @@ local vmake, vmake__call, getEnvironment = {
ShouldComputeGraph = true,
ShouldDoWork = true,
ShouldPrintGraph = false,
ShouldClean = false,

FullBuild = false,
WorkGraph = false,
Expand Down Expand Up @@ -4387,11 +4388,14 @@ end

function vmake__call()
vmake.ValidateAndDefault()
vmake.CheckArguments()
vmake.ExpandProperties()

vmake.ParallelOpts = vmake.Classes.List()

vmake.CheckArguments()
if vmake.ShouldClean then
sh.silent("rm", "-Rf", outDir)
end

if vmake.ShouldComputeGraph then
vmake.WorkGraph = vmake.ConstructWorkGraph()
Expand Down Expand Up @@ -4519,11 +4523,27 @@ CmdOpt "print" {
end,
}

CmdOpt "clean" {
Description = "Cleans the output directory. Will not perform a build unless `--full` is also specified.",

Handler = function(_)
vmake.ShouldClean = true

if not vmake.FullBuild then
vmake.ShouldComputeGraph = false
end
end,
}

CmdOpt "full" {
Description = "Indicates that work items should be executed even if they are considered up-to-date.",

Handler = function(_)
vmake.FullBuild = true

if vmake.ShouldClean then
vmake.ShouldComputeGraph = true
end
end,
}

Expand Down Expand Up @@ -4604,6 +4624,9 @@ _G.vmake = setmetatable({
-- Does what it says on the tin. It's a blank tin.
function DoNothing() end

-- Ditto.
function NewList() return List { } end

-- An action which copies a single source file to the destination.
function CopySingleFileAction(_, dst, src)
fs.Copy(dst, src[1])
Expand All @@ -4617,7 +4640,7 @@ function ExcuseMissingFilesRule(ext)
local rule = Rule "Excuse Missing Headers" {
Filter = function(_, dst) return dst:CheckExtension(ext) and not fs.GetInfo(dst) end,

Source = List { },
Source = NewList,

Action = DoNothing,
}
Expand Down

0 comments on commit 99e849b

Please sign in to comment.