Skip to content

Commit

Permalink
Bug 803400 - Add clobber mach command; r=glandium
Browse files Browse the repository at this point in the history
DONTBUILD (NPOTB)
  • Loading branch information
indygreg committed Dec 6, 2012
1 parent ff8c56f commit f718bac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions mach
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SEARCH_PATHS = [
'testing',
'testing/xpcshell',
'testing/mozbase/mozprocess',
'testing/mozbase/mozfile',
'testing/mozbase/mozinfo',
]

Expand Down
9 changes: 9 additions & 0 deletions python/mozbuild/mozbuild/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
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,
Expand Down Expand Up @@ -82,6 +84,13 @@ def bindir(self):
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:
Expand Down
5 changes: 5 additions & 0 deletions python/mozbuild/mozbuild/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def on_line(line):

return status

@Command('clobber', help='Clobber the tree (delete the object directory).')
def clobber(self):
self.remove_objdir()
return 0


@CommandProvider
class Warnings(MachCommandBase):
Expand Down

0 comments on commit f718bac

Please sign in to comment.