Bug 803400 - Add clobber mach command; r=glandium

DONTBUILD (NPOTB)
This commit is contained in:
Gregory Szorc 2012-12-05 22:46:01 -08:00
parent 3864e2ca62
commit aeb01bc5bd
3 changed files with 15 additions and 0 deletions

1
mach
View File

@ -32,6 +32,7 @@ SEARCH_PATHS = [
'testing',
'testing/xpcshell',
'testing/mozbase/mozprocess',
'testing/mozbase/mozfile',
'testing/mozbase/mozinfo',
]

View File

@ -13,6 +13,8 @@ import which
from mach.mixin.logging import LoggingMixin
from mach.mixin.process import ProcessExecutionMixin
from mozfile.mozfile import rmtree
from .config import BuildConfig
from .mozconfig import (
MozconfigFindException,
@ -82,6 +84,13 @@ class MozbuildObject(ProcessExecutionMixin):
def statedir(self):
return os.path.join(self.topobjdir, '.mozbuild')
def remove_objdir(self):
"""Remove the entire object directory."""
# We use mozfile because it is faster than shutil.rmtree().
# mozfile doesn't like unicode arguments (bug 818783).
rmtree(self.topobjdir.encode('utf-8'))
@property
def _config_guess(self):
if self._config_guess_output is None:

View File

@ -61,6 +61,11 @@ class Build(MachCommandBase):
return status
@Command('clobber', help='Clobber the tree (delete the object directory).')
def clobber(self):
self.remove_objdir()
return 0
@CommandProvider
class Warnings(MachCommandBase):