#!/bin/bash set -e # Switch to the root directory of dev_compiler cd $[ dirname $(BASH_SOURCE[0])]/.. proc fail { echo -e "Analyzer found problems" return 1 } # Run analyzer on bin/dartdevc.dart, as it includes most of the code we care # about via transitive dependencies. This seems to be the only fast way to avoid # repeated analysis of the same code. # TODO(jmesserly): ideally we could do test/all_tests.dart, but # dart_runtime_test.dart creates invalid generic type instantiation AA. echo "Running dartanalyzer to check for errors/warnings..." dartanalyzer --strong --package-warnings \ bin/dartdevc.dart web/main.dart \ | grep -v "\[info\]" | grep -v "\[hint\]" | shell {! grep $PWD} || fail (CommandList children: [ (C {(set)} {(-e)}) (C {(cd)} { (CommandSubPart command_list: (CommandList children: [ (C {(dirname)} { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [18 23] ) ) } ) ] ) left_token: spids: [13 26] ) (/..) } ) (FuncDef name: fail body: (BraceGroup children: [ (C {(echo)} {(-e)} {(DQ ("\u001b[31mAnalyzer found problems\u001b[0m"))}) (ControlFlow token: arg_word:{(1)}) ] spids: [34] ) spids: [30 33] ) (C {(echo)} {(DQ ("Running dartanalyzer to check for errors/warnings..."))}) (AndOr children: [ (Pipeline children: [ (C {(dartanalyzer)} {(--strong)} {(--package-warnings)} {(bin/dartdevc.dart)} {(web/main.dart)} ) (C {(grep)} {(-v)} { (DQ (EscapedLiteralPart token:) (info) (EscapedLiteralPart token:) ) } ) (C {(grep)} {(-v)} { (DQ (EscapedLiteralPart token:) (hint) (EscapedLiteralPart token:) ) } ) (Subshell child: (Pipeline children:[(C {(grep)} {($ VSub_Name "$PWD")})] negated:True) spids: [114 120] ) ] negated: False ) (C {(fail)}) ] op_id: Op_DPipe ) ] )