build: update to clang 1.4.0 and only run clang format on changed files (#36203)
Update to clang@1.4.0 to gain support for optional changing and nullish coalescing. Because this would trigger a change on >1800 files in the repository, also changes our format enforcement to only be run against changed files. This will allow us to incramentally roll out the value add of the upgraded clang format. PR Close #36203
This commit is contained in:

committed by
Alex Rickabaugh

parent
51a89c32c4
commit
c5c57f6737
@ -85,7 +85,7 @@ function gulpStatus() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
// Check source code for formatting errors (clang-format)
|
||||
// Check source code for formatting errors with clang-format
|
||||
enforce: (gulp) => () => {
|
||||
const format = require('gulp-clang-format');
|
||||
const clangFormat = require('clang-format');
|
||||
@ -93,6 +93,34 @@ module.exports = {
|
||||
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
|
||||
},
|
||||
|
||||
// Check only the untracked source code files for formatting errors with .clang-format
|
||||
'enforce-untracked': (gulp) => () => {
|
||||
const format = require('gulp-clang-format');
|
||||
const clangFormat = require('clang-format');
|
||||
const gulpFilter = require('gulp-filter');
|
||||
|
||||
return gulpStatus()
|
||||
.pipe(gulpFilter(srcsToFmt))
|
||||
.pipe(format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
|
||||
},
|
||||
|
||||
// Check only the changed source code files diffed from the provided branch for formatting
|
||||
// errors with clang-format
|
||||
'enforce-diff': (gulp) => () => {
|
||||
const format = require('gulp-clang-format');
|
||||
const clangFormat = require('clang-format');
|
||||
const gulpFilter = require('gulp-filter');
|
||||
const minimist = require('minimist');
|
||||
const gulpGit = require('gulp-git');
|
||||
|
||||
const args = minimist(process.argv.slice(2));
|
||||
const branch = args.branch || 'master';
|
||||
|
||||
return gulpGit.diff(branch, {log: false})
|
||||
.pipe(gulpFilter(srcsToFmt))
|
||||
.pipe(format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
|
||||
},
|
||||
|
||||
// Format the source code with clang-format (see .clang-format)
|
||||
format: (gulp) => () => {
|
||||
const format = require('gulp-clang-format');
|
||||
|
Reference in New Issue
Block a user