зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1538770 - Replace TRY_MODIFIED_FILES by mozversioncontrol usage, r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D24876 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e5bd78effc
Коммит
502ea8a095
|
@ -48,6 +48,7 @@ from mozbuild.backend import (
|
|||
backends,
|
||||
)
|
||||
|
||||
from mozversioncontrol import get_repository_object
|
||||
|
||||
BUILD_WHAT_HELP = '''
|
||||
What to build. Can be a top-level make target or a relative directory. If
|
||||
|
@ -1701,8 +1702,10 @@ class StaticAnalysis(MachCommandBase):
|
|||
help='Write clang-tidy output in a file')
|
||||
@CommandArgument('--format', default='text', choices=('text', 'json'),
|
||||
help='Output format to write in a file')
|
||||
@CommandArgument('--outgoing', default=False, action='store_true',
|
||||
help='Run static analysis checks on outgoing files from mercurial repository')
|
||||
def check(self, source=None, jobs=2, strip=1, verbose=False,
|
||||
checks='-*', fix=False, header_filter='', output=None, format='text'):
|
||||
checks='-*', fix=False, header_filter='', output=None, format='text', outgoing=False):
|
||||
from mozbuild.controller.building import (
|
||||
StaticAnalysisFooter,
|
||||
StaticAnalysisOutputManager,
|
||||
|
@ -1717,6 +1720,12 @@ class StaticAnalysis(MachCommandBase):
|
|||
if rc != 0:
|
||||
return rc
|
||||
|
||||
# Use outgoing files instead of source files
|
||||
if outgoing:
|
||||
repo = get_repository_object(self.topsrcdir)
|
||||
files = repo.get_outgoing_files()
|
||||
source = self._conv_to_abspath(files)
|
||||
|
||||
# Split in several chunks to avoid hitting Python's limit of 100 groups in re
|
||||
compile_db = json.loads(open(self._compile_db, 'r').read())
|
||||
total = 0
|
||||
|
@ -2406,11 +2415,17 @@ class StaticAnalysis(MachCommandBase):
|
|||
@CommandArgument('--format', '-f', choices=('diff', 'json'), default='diff', dest='output_format',
|
||||
help='Specify the output format used: diff is the raw patch provided by '
|
||||
'clang-format, json is a list of atomic changes to process.')
|
||||
def clang_format(self, assume_filename, path, commit, output_path=None, output_format='diff', verbose=False):
|
||||
@CommandArgument('--outgoing', default=False, action='store_true',
|
||||
help='Run clang-format on outgoing files from mercurial repository')
|
||||
def clang_format(self, assume_filename, path, commit, output_path=None, output_format='diff', verbose=False, outgoing=False):
|
||||
# Run clang-format or clang-format-diff on the local changes
|
||||
# or files/directories
|
||||
if path is not None:
|
||||
path = self._conv_to_abspath(path)
|
||||
elif outgoing:
|
||||
repo = get_repository_object(self.topsrcdir)
|
||||
files = repo.get_outgoing_files()
|
||||
path = self._conv_to_abspath(files)
|
||||
|
||||
os.chdir(self.topsrcdir)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ tidy:
|
|||
command: >-
|
||||
source $HOME/checkouts/gecko/taskcluster/scripts/misc/source-test-clang-setup.sh &&
|
||||
cd $HOME/checkouts/gecko &&
|
||||
./mach --log-no-times static-analysis check $TRY_MODIFIED_FILES --output $HOME/clang-tidy.json --format json
|
||||
./mach --log-no-times static-analysis check --outgoing --output $HOME/clang-tidy.json --format json
|
||||
|
||||
worker:
|
||||
artifacts:
|
||||
|
@ -64,7 +64,7 @@ format:
|
|||
command: >-
|
||||
source $HOME/checkouts/gecko/taskcluster/scripts/misc/source-test-clang-setup.sh &&
|
||||
cd $HOME/checkouts/gecko &&
|
||||
./mach --log-no-times clang-format --path $TRY_MODIFIED_FILES --output $HOME/clang-format.json --format json
|
||||
./mach --log-no-times clang-format --outgoing --output $HOME/clang-format.json --format json
|
||||
worker:
|
||||
artifacts:
|
||||
- type: file
|
||||
|
|
|
@ -22,7 +22,3 @@ export LD_LIBRARY_PATH=$MOZBUILD_STATE_PATH/clang/lib
|
|||
# Mach lookup clang-tidy in clang-tools
|
||||
mkdir -p $MOZBUILD_STATE_PATH/clang-tools
|
||||
ln -s $MOZBUILD_STATE_PATH/clang-tidy $MOZBUILD_STATE_PATH/clang-tools/clang-tidy
|
||||
|
||||
# List modified files since last public revision
|
||||
cd $HOME/checkouts/gecko
|
||||
export TRY_MODIFIED_FILES=$(hg status --rev 'max(ancestors(tip) and public())' -q --no-status)
|
||||
|
|
Загрузка…
Ссылка в новой задаче