Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: tool/format.sh

Issue 1167233002: split analyze and format steps out of test.sh (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tool/analyze.sh ('k') | tool/presubmit.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/format.sh
diff --git a/tool/format.sh b/tool/format.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b3a0ce25425a186c4fac7906c6fa58b81188391f
--- /dev/null
+++ b/tool/format.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -e
+
+# Switch to the root directory of dev_compiler
+cd $( dirname "${BASH_SOURCE[0]}" )/..
+
+# Run formatter in rewrite mode on all files that are part of the project.
+# This checks that all files are commited first to git, so no state is lost.
+# The formatter ignores:
+# * local files that have never been added to git,
+# * subdirectories of test/ and tool/, unless explicitly added. Those dirs
+# contain a lot of generated or external source we should not reformat.
+(files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \
+ tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \
+ && echo "Did not run the formatter, please commit edited files first." \
+ || (echo "Running dart formatter" ; pub run dart_style:format -w $files))
« no previous file with comments | « tool/analyze.sh ('k') | tool/presubmit.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698