blob: 1a56eb0040ba690b7f4478b22ac0de1f0032262b [file] [log] [blame]
Brian Muramatsu2f8eead2010-09-24 14:56:43 -07001<?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 "&#160;"> ]>
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 Zhu67a526d52015-04-29 21:15:30 -070024 <title><xsl:value-of select="api-coverage/@title" /></title>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070025 <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 Muramatsu16fdad82010-12-02 17:13:44 -080036 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 Muramatsu37e73412012-01-03 15:12:19 -080065 background-color: #FF6666;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080066 }
67
68 .yellow {
Brian Muramatsu37e73412012-01-03 15:12:19 -080069 background-color: #FFFF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080070 }
71
72 .green {
Brian Muramatsu37e73412012-01-03 15:12:19 -080073 background-color: #66FF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080074 }
Brian Muramatsud9423e02012-01-05 16:00:46 -080075
76 .deprecated {
77 text-decoration: line-through;
78 }
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070079 </style>
80 </head>
81 <body>
Tsu Chiang Chuange0158bf2013-07-19 10:46:24 -070082 <h1><xsl:value-of select="api-coverage/@title" /></h1>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070083 <div class="info">
84 Generated: <xsl:value-of select="api-coverage/@generatedTime" />
85 </div>
Keun young Parke156dae2012-08-24 18:26:47 -070086 <div class="total">
87 Total:&nbsp;<xsl:value-of select="api-coverage/total/@coveragePercentage" />%
88 &nbsp;(<xsl:value-of select="api-coverage/total/@numCovered" />/<xsl:value-of select="api-coverage/total/@numTotal" />)
89 </div>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070090 <div class="apks" onclick="toggleVisibility('sourceApks')">
Guang Zhu67a526d52015-04-29 21:15:30 -070091 Source Modules (<xsl:value-of select="count(api-coverage/debug/sources/apk)" />)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070092 </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 Sauerc55f5772015-07-16 19:39:59 -0700104 <xsl:with-param name="toggleId" select="@name" />
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700105 </xsl:call-template>
106 <div class="packageDetails" id="{@name}" style="display: none">
107 <ul>
108 <xsl:for-each select="class">
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700109 <xsl:variable name="packageClassId" select="concat(../@name, '.', @name)"/>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700110 <xsl:call-template name="packageOrClassListItem">
111 <xsl:with-param name="bulletClass" select="'class'" />
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700112 <xsl:with-param name="toggleId" select="$packageClassId" />
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700113 </xsl:call-template>
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700114 <div class="classDetails" id="{$packageClassId}" style="display: none">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700115 <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 Sauerc55f5772015-07-16 19:39:59 -0700130
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700131 <xsl:template name="packageOrClassListItem">
132 <xsl:param name="bulletClass" />
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700133 <xsl:param name="toggleId"/>
Brian Muramatsud9423e02012-01-05 16:00:46 -0800134
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700135 <xsl:variable name="colorClass">
136 <xsl:choose>
137 <xsl:when test="@coveragePercentage &lt;= 50">red</xsl:when>
138 <xsl:when test="@coveragePercentage &lt;= 80">yellow</xsl:when>
139 <xsl:otherwise>green</xsl:otherwise>
140 </xsl:choose>
141 </xsl:variable>
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700142
Brian Muramatsud9423e02012-01-05 16:00:46 -0800143 <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 Sauerc55f5772015-07-16 19:39:59 -0700150 <li class="{$bulletClass}" onclick="toggleVisibility('{$toggleId}')">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800151 <span class="{$colorClass} {$deprecatedClass}">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700152 <b><xsl:value-of select="@name" /></b>
153 &nbsp;<xsl:value-of select="@coveragePercentage" />%
154 &nbsp;(<xsl:value-of select="@numCovered" />/<xsl:value-of select="@numTotal" />)
155 </span>
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700156 </li>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700157 </xsl:template>
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700158
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700159 <xsl:template name="methodListItem">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800160
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 Muramatsu2f8eead2010-09-24 14:56:43 -0700169 <xsl:choose>
170 <xsl:when test="@covered = 'true'">[X]</xsl:when>
171 <xsl:otherwise>[ ]</xsl:otherwise>
172 </xsl:choose>
Nicholas Sauerc55f5772015-07-16 19:39:59 -0700173 <xsl:if test="@visibility != ''">&nbsp;<xsl:value-of select="@visibility" /></xsl:if>
174 <xsl:if test="@abstract = 'true'">&nbsp;abstract</xsl:if>
175 <xsl:if test="@static = 'true'">&nbsp;static</xsl:if>
176 <xsl:if test="@final = 'true'">&nbsp;final</xsl:if>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700177 <xsl:if test="@returnType != ''">&nbsp;<xsl:value-of select="@returnType" /></xsl:if>
178 <b>&nbsp;<xsl:value-of select="@name" /></b><xsl:call-template name="formatParameters" />
179 </span>
180 <br />
181 </xsl:template>
Brian Muramatsud9423e02012-01-05 16:00:46 -0800182
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700183 <xsl:template name="formatParameters">(<xsl:for-each select="parameter">
184 <xsl:value-of select="@type" />
185 <xsl:if test="not(position() = last())">,&nbsp;</xsl:if>
186 </xsl:for-each>)
187 </xsl:template>
188
189</xsl:stylesheet>
190