Fix link_type checking

This was printing "error:", but not actually triggering an error.
Instead of trying to write a single line bash script to handle this,
move the actual check into python. This allows us to print all of the
errors for a single module before triggering the failure.

Also updates the warning format and the warn.py script to properly parse
these warning. Many of the java:sdk -> java:platform warnings are false
positives due to the lack of LOCAL_SDK_VERSION markings on prebuilts.

Individual tags can be marked as warnings now, which lets us check for
system libraries linking against vendor libraries (which won't work on
AOSP). I'm not sure this is a completely valid check, which one reason
that it's just a warning.

Test: m all_link_types (with some missing libs commented out)
Change-Id: I333e418c9a4511b7c7e826891ae481da08fbf6f9
diff --git a/tools/warn.py b/tools/warn.py
index 572ac68..5cb104f 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -91,9 +91,18 @@
         'description':'make: overriding commands/ignoring old commands',
         'patterns':[r".*: warning: overriding commands for target .+",
                     r".*: warning: ignoring old commands for target .+"] },
-    { 'category':'make',    'severity':severity.HIGH,   'members':[], 'option':'',
+    { 'category':'make',    'severity':severity.HIGH,     'members':[], 'option':'',
         'description':'make: LOCAL_CLANG is false',
         'patterns':[r".*: warning: LOCAL_CLANG is set to false"] },
+    { 'category':'make',    'severity':severity.HIGH,     'members':[], 'option':'',
+        'description':'SDK App using platform shared library',
+        'patterns':[r".*: warning: .+ \(.*app:sdk.*\) should not link to .+ \(native:platform\)"] },
+    { 'category':'make',    'severity':severity.HIGH,     'members':[], 'option':'',
+        'description':'System module linking to a vendor module',
+        'patterns':[r".*: warning: .+ \(.+\) should not link to .+ \(partition:.+\)"] },
+    { 'category':'make',    'severity':severity.MEDIUM,   'members':[], 'option':'',
+        'description':'Invalid SDK/NDK linking',
+        'patterns':[r".*: warning: .+ \(.+\) should not link to .+ \(.+\)"] },
     { 'category':'C/C++',   'severity':severity.HIGH,     'members':[], 'option':'-Wimplicit-function-declaration',
         'description':'Implicit function declaration',
         'patterns':[r".*: warning: implicit declaration of function .+",