Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- |
| 3 | * Copyright (C) 2010 The Android Open Source Project |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | --> |
| 17 | |
| 18 | <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]> |
| 19 | <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 20 | <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" /> |
| 21 | <xsl:template match="/"> |
| 22 | <html> |
| 23 | <head> |
Guang Zhu | 67a526d5 | 2015-04-29 21:15:30 -0700 | [diff] [blame] | 24 | <title><xsl:value-of select="api-coverage/@title" /></title> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 25 | <script type="text/javascript"> |
| 26 | function toggleVisibility(id) { |
| 27 | element = document.getElementById(id); |
| 28 | if (element.style.display == "none") { |
| 29 | element.style.display = ""; |
| 30 | } else { |
| 31 | element.style.display = "none"; |
| 32 | } |
| 33 | } |
| 34 | </script> |
| 35 | <style type="text/css"> |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 36 | body { |
| 37 | background-color: #CCCCCC; |
| 38 | font-family: sans-serif; |
| 39 | margin: 10px; |
| 40 | } |
| 41 | |
| 42 | .info { |
| 43 | margin-bottom: 10px; |
| 44 | } |
| 45 | |
| 46 | .apks, .package, .class { |
| 47 | cursor: pointer; |
| 48 | text-decoration: underline; |
| 49 | } |
| 50 | |
| 51 | .packageDetails { |
| 52 | padding-left: 20px; |
| 53 | } |
| 54 | |
| 55 | .classDetails { |
| 56 | padding-left: 40px; |
| 57 | } |
| 58 | |
| 59 | .method { |
| 60 | font-family: courier; |
| 61 | white-space: nowrap; |
| 62 | } |
| 63 | |
| 64 | .red { |
Brian Muramatsu | 37e7341 | 2012-01-03 15:12:19 -0800 | [diff] [blame] | 65 | background-color: #FF6666; |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | .yellow { |
Brian Muramatsu | 37e7341 | 2012-01-03 15:12:19 -0800 | [diff] [blame] | 69 | background-color: #FFFF66; |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | .green { |
Brian Muramatsu | 37e7341 | 2012-01-03 15:12:19 -0800 | [diff] [blame] | 73 | background-color: #66FF66; |
Brian Muramatsu | 16fdad8 | 2010-12-02 17:13:44 -0800 | [diff] [blame] | 74 | } |
Brian Muramatsu | d9423e0 | 2012-01-05 16:00:46 -0800 | [diff] [blame] | 75 | |
| 76 | .deprecated { |
| 77 | text-decoration: line-through; |
| 78 | } |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 79 | </style> |
| 80 | </head> |
| 81 | <body> |
Tsu Chiang Chuang | e0158bf | 2013-07-19 10:46:24 -0700 | [diff] [blame] | 82 | <h1><xsl:value-of select="api-coverage/@title" /></h1> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 83 | <div class="info"> |
| 84 | Generated: <xsl:value-of select="api-coverage/@generatedTime" /> |
| 85 | </div> |
Keun young Park | e156dae | 2012-08-24 18:26:47 -0700 | [diff] [blame] | 86 | <div class="total"> |
| 87 | Total: <xsl:value-of select="api-coverage/total/@coveragePercentage" />% |
| 88 | (<xsl:value-of select="api-coverage/total/@numCovered" />/<xsl:value-of select="api-coverage/total/@numTotal" />) |
| 89 | </div> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 90 | <div class="apks" onclick="toggleVisibility('sourceApks')"> |
Guang Zhu | 67a526d5 | 2015-04-29 21:15:30 -0700 | [diff] [blame] | 91 | Source Modules (<xsl:value-of select="count(api-coverage/debug/sources/apk)" />) |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 92 | </div> |
| 93 | <div id="sourceApks" style="display: none"> |
| 94 | <ul> |
| 95 | <xsl:for-each select="api-coverage/debug/sources/apk"> |
| 96 | <li><xsl:value-of select="@path" /></li> |
| 97 | </xsl:for-each> |
| 98 | </ul> |
| 99 | </div> |
| 100 | <ul> |
| 101 | <xsl:for-each select="api-coverage/api/package"> |
| 102 | <xsl:call-template name="packageOrClassListItem"> |
| 103 | <xsl:with-param name="bulletClass" select="'package'" /> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 104 | <xsl:with-param name="toggleId" select="@name" /> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 105 | </xsl:call-template> |
| 106 | <div class="packageDetails" id="{@name}" style="display: none"> |
| 107 | <ul> |
| 108 | <xsl:for-each select="class"> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 109 | <xsl:variable name="packageClassId" select="concat(../@name, '.', @name)"/> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 110 | <xsl:call-template name="packageOrClassListItem"> |
| 111 | <xsl:with-param name="bulletClass" select="'class'" /> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 112 | <xsl:with-param name="toggleId" select="$packageClassId" /> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 113 | </xsl:call-template> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 114 | <div class="classDetails" id="{$packageClassId}" style="display: none"> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 115 | <xsl:for-each select="constructor"> |
| 116 | <xsl:call-template name="methodListItem" /> |
| 117 | </xsl:for-each> |
| 118 | <xsl:for-each select="method"> |
| 119 | <xsl:call-template name="methodListItem" /> |
| 120 | </xsl:for-each> |
| 121 | </div> |
| 122 | </xsl:for-each> |
| 123 | </ul> |
| 124 | </div> |
| 125 | </xsl:for-each> |
| 126 | </ul> |
| 127 | </body> |
| 128 | </html> |
| 129 | </xsl:template> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 130 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 131 | <xsl:template name="packageOrClassListItem"> |
| 132 | <xsl:param name="bulletClass" /> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 133 | <xsl:param name="toggleId"/> |
Brian Muramatsu | d9423e0 | 2012-01-05 16:00:46 -0800 | [diff] [blame] | 134 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 135 | <xsl:variable name="colorClass"> |
| 136 | <xsl:choose> |
| 137 | <xsl:when test="@coveragePercentage <= 50">red</xsl:when> |
| 138 | <xsl:when test="@coveragePercentage <= 80">yellow</xsl:when> |
| 139 | <xsl:otherwise>green</xsl:otherwise> |
| 140 | </xsl:choose> |
| 141 | </xsl:variable> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 142 | |
Brian Muramatsu | d9423e0 | 2012-01-05 16:00:46 -0800 | [diff] [blame] | 143 | <xsl:variable name="deprecatedClass"> |
| 144 | <xsl:choose> |
| 145 | <xsl:when test="@deprecated = 'true'">deprecated</xsl:when> |
| 146 | <xsl:otherwise></xsl:otherwise> |
| 147 | </xsl:choose> |
| 148 | </xsl:variable> |
| 149 | |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 150 | <li class="{$bulletClass}" onclick="toggleVisibility('{$toggleId}')"> |
Brian Muramatsu | d9423e0 | 2012-01-05 16:00:46 -0800 | [diff] [blame] | 151 | <span class="{$colorClass} {$deprecatedClass}"> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 152 | <b><xsl:value-of select="@name" /></b> |
| 153 | <xsl:value-of select="@coveragePercentage" />% |
| 154 | (<xsl:value-of select="@numCovered" />/<xsl:value-of select="@numTotal" />) |
| 155 | </span> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 156 | </li> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 157 | </xsl:template> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 158 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 159 | <xsl:template name="methodListItem"> |
Brian Muramatsu | d9423e0 | 2012-01-05 16:00:46 -0800 | [diff] [blame] | 160 | |
| 161 | <xsl:variable name="deprecatedClass"> |
| 162 | <xsl:choose> |
| 163 | <xsl:when test="@deprecated = 'true'">deprecated</xsl:when> |
| 164 | <xsl:otherwise></xsl:otherwise> |
| 165 | </xsl:choose> |
| 166 | </xsl:variable> |
| 167 | |
| 168 | <span class="method {$deprecatedClass}"> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 169 | <xsl:choose> |
| 170 | <xsl:when test="@covered = 'true'">[X]</xsl:when> |
| 171 | <xsl:otherwise>[ ]</xsl:otherwise> |
| 172 | </xsl:choose> |
Nicholas Sauer | c55f577 | 2015-07-16 19:39:59 -0700 | [diff] [blame] | 173 | <xsl:if test="@visibility != ''"> <xsl:value-of select="@visibility" /></xsl:if> |
| 174 | <xsl:if test="@abstract = 'true'"> abstract</xsl:if> |
| 175 | <xsl:if test="@static = 'true'"> static</xsl:if> |
| 176 | <xsl:if test="@final = 'true'"> final</xsl:if> |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 177 | <xsl:if test="@returnType != ''"> <xsl:value-of select="@returnType" /></xsl:if> |
| 178 | <b> <xsl:value-of select="@name" /></b><xsl:call-template name="formatParameters" /> |
| 179 | </span> |
| 180 | <br /> |
| 181 | </xsl:template> |
Brian Muramatsu | d9423e0 | 2012-01-05 16:00:46 -0800 | [diff] [blame] | 182 | |
Brian Muramatsu | 2f8eead | 2010-09-24 14:56:43 -0700 | [diff] [blame] | 183 | <xsl:template name="formatParameters">(<xsl:for-each select="parameter"> |
| 184 | <xsl:value-of select="@type" /> |
| 185 | <xsl:if test="not(position() = last())">, </xsl:if> |
| 186 | </xsl:for-each>) |
| 187 | </xsl:template> |
| 188 | |
| 189 | </xsl:stylesheet> |
| 190 | |