| 1 |
/* |
| 2 |
* Copyright (C) 2015 The Android Open Source Project |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package com.android.ide.common.blame.parser; |
| 18 |
|
| 19 |
import static com.android.SdkConstants.DOT_XML; |
| 20 |
import static com.android.SdkConstants.PLATFORM_WINDOWS; |
| 21 |
import static com.android.SdkConstants.currentPlatform; |
| 22 |
import static com.android.utils.SdkUtils.createPathComment; |
| 23 |
import static org.junit.Assert.assertEquals; |
| 24 |
import static org.junit.Assert.assertNotNull; |
| 25 |
|
| 26 |
import com.android.annotations.NonNull; |
| 27 |
import com.android.annotations.Nullable; |
| 28 |
import com.android.ide.common.blame.Message; |
| 29 |
import com.android.ide.common.blame.SourceFilePosition; |
| 30 |
import com.android.ide.common.blame.SourcePosition; |
| 31 |
import com.android.ide.common.blame.parser.aapt.AaptOutputParser; |
| 32 |
import com.android.ide.common.blame.parser.aapt.AbstractAaptOutputParser; |
| 33 |
import com.android.utils.StdLogger; |
| 34 |
import com.android.utils.StringHelper; |
| 35 |
import com.google.common.base.Charsets; |
| 36 |
import com.google.common.io.Closeables; |
| 37 |
import com.google.common.io.Files; |
| 38 |
|
| 39 |
import org.junit.After; |
| 40 |
import org.junit.Before; |
| 41 |
import org.junit.Rule; |
| 42 |
import org.junit.Test; |
| 43 |
import org.junit.rules.TemporaryFolder; |
| 44 |
|
| 45 |
import java.io.BufferedWriter; |
| 46 |
import java.io.File; |
| 47 |
import java.io.FileWriter; |
| 48 |
import java.io.IOException; |
| 49 |
import java.util.Collection; |
| 50 |
import java.util.List; |
| 51 |
import java.util.Locale; |
| 52 |
|
| 53 |
/** |
| 54 |
* Tests for {@link ToolOutputParser}. |
| 55 |
*/ |
| 56 |
public class AaptOutputParserTest { |
| 57 |
|
| 58 |
@Rule |
| 59 |
public TemporaryFolder temporaryFolder = new TemporaryFolder(); |
| 60 |
|
| 61 |
private File sourceFile; |
| 62 |
|
| 63 |
private String sourceFilePath; |
| 64 |
|
| 65 |
private ToolOutputParser parser; |
| 66 |
|
| 67 |
@Nullable |
| 68 |
private static String getSystemIndependentSourcePath(@NonNull Message message) { |
| 69 |
String sourcePath = message.getSourcePath(); |
| 70 |
return sourcePath == null ? null : sourcePath.replace('\\', '/'); |
| 71 |
} |
| 72 |
|
| 73 |
private static boolean setupSdkHome() { |
| 74 |
AbstractAaptOutputParser.ourRootDir = new File("."); |
| 75 |
return true; |
| 76 |
} |
| 77 |
|
| 78 |
@NonNull |
| 79 |
private static String toString(@NonNull List<Message> messages) { |
| 80 |
StringBuilder sb = new StringBuilder(); |
| 81 |
for (int i = 0, n = messages.size(); i < n; i++) { |
| 82 |
Message message = messages.get(i); |
| 83 |
sb.append(Integer.toString(i)).append(':').append(' '); |
| 84 |
sb.append( |
| 85 |
StringHelper.capitalize(message.getKind().toString().toLowerCase(Locale.US))) |
| 86 |
.append(':'); // INFO => Info |
| 87 |
sb.append(message.getText()); |
| 88 |
if (!message.getSourceFilePositions().isEmpty() && |
| 89 |
!message.getSourceFilePositions().get(0).getPosition().equals( |
| 90 |
SourcePosition.UNKNOWN)) { |
| 91 |
sb.append('\n'); |
| 92 |
sb.append('\t'); |
| 93 |
sb.append(message.getSourceFilePositions().get(0).toString()); |
| 94 |
} |
| 95 |
sb.append('\n'); |
| 96 |
} |
| 97 |
|
| 98 |
return sb.toString(); |
| 99 |
} |
| 100 |
|
| 101 |
@Before |
| 102 |
public void setUp() throws Exception { |
| 103 |
parser = new ToolOutputParser(new AaptOutputParser(), |
| 104 |
new StdLogger(StdLogger.Level.VERBOSE)); |
| 105 |
} |
| 106 |
|
| 107 |
@After |
| 108 |
public void tearDown() throws Exception { |
| 109 |
if (sourceFile != null) { |
| 110 |
sourceFile.delete(); |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
public void testParseDisplayingUnhandledMessages() { |
| 115 |
String output = " **--- HELLO WORLD ---**"; |
| 116 |
List<Message> gradleMessages = parser.parseToolOutput(output); |
| 117 |
assertEquals(1, gradleMessages.size()); |
| 118 |
Message message = gradleMessages.get(0); |
| 119 |
assertEquals(output, message.getText()); |
| 120 |
assertEquals(Message.Kind.SIMPLE, message.getKind()); |
| 121 |
} |
| 122 |
|
| 123 |
public void testParseAaptOutputWithRange1() throws IOException { |
| 124 |
createTempXmlFile(); |
| 125 |
writeToFile("<manifest xmlns:android='http://schemas.android.com/apk/res/android'", |
| 126 |
" android:versionCode='12' android:versionName='2.0' package='com.android.tests.basic'>", |
| 127 |
" <uses-sdk android:minSdkVersion='16' android:targetSdkVersion='16'/>", |
| 128 |
" <application android:icon='@drawable/icon' android:label='@string/app_name2'>"); |
| 129 |
String messageText = "No resource found that matches the given name (at 'label' with value " |
| 130 |
+ "'@string/app_name2')."; |
| 131 |
String err = sourceFilePath + ":4: error: Error: " + messageText; |
| 132 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 133 |
assertHasCorrectErrorMessage(messages, messageText, 4, 61); |
| 134 |
} |
| 135 |
|
| 136 |
public void testParseAaptOutputWithRange2() throws IOException { |
| 137 |
// Check that when the actual aapt error occurs on a line later than the original error line, |
| 138 |
// the forward search which looks for a value match does not stop on an earlier line that |
| 139 |
// happens to have the same value prefix |
| 140 |
createTempXmlFile(); |
| 141 |
writeToFile("<manifest xmlns:android='http://schemas.android.com/apk/res/android'", |
| 142 |
" android:versionCode='12' android:versionName='2.0' package='com.android.tests.basic'>", |
| 143 |
" <uses-sdk android:minSdkVersion='16' android:targetSdkVersion='16'/>", |
| 144 |
" <application android:icon='@drawable/icon' android:label=", |
| 145 |
" '@string/app_name2'>"); |
| 146 |
String messageText = "No resource found that matches the given name (at 'label' with value " |
| 147 |
+ "'@string/app_name2')."; |
| 148 |
String err = sourceFilePath + ":4: error: Error: " + messageText; |
| 149 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 150 |
assertHasCorrectErrorMessage(messages, messageText, 5, 8); |
| 151 |
} |
| 152 |
|
| 153 |
public void testParseAaptOutputWithRange3() throws IOException { |
| 154 |
// Check that when we have a duplicate resource error, we highlight both the original property |
| 155 |
// and the original definition. |
| 156 |
// This tests the second, duplicate declaration ration. |
| 157 |
createTempXmlFile(); |
| 158 |
writeToFile("<resources xmlns:android='http://schemas.android.com/apk/res/android'>", |
| 159 |
" <style name='repeatedStyle1'>", |
| 160 |
" <item name='android:gravity'>left</item>", |
| 161 |
" </style>", |
| 162 |
" <style name='repeatedStyle1'>", |
| 163 |
" <item name='android:gravity'>left</item>"); |
| 164 |
String messageText = "Resource entry repeatedStyle1 already has bag item android:gravity."; |
| 165 |
String err = sourceFilePath + ":6: error: " + messageText; |
| 166 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 167 |
assertHasCorrectErrorMessage(messages, messageText, 6, 17); |
| 168 |
} |
| 169 |
|
| 170 |
public void testParseAaptOutputWithRange4() throws IOException { |
| 171 |
// Check that when we have a duplicate resource error, we highlight both the original property |
| 172 |
// and the original definition. |
| 173 |
// This tests the original definition. Note that we don't have enough position info so we simply |
| 174 |
// highlight the whitespace portion of the line. |
| 175 |
createTempXmlFile(); |
| 176 |
writeToFile("<resources xmlns:android='http://schemas.android.com/apk/res/android'>", |
| 177 |
" <style name='repeatedStyle1'>", |
| 178 |
" <item name='android:gravity'>left</item>"); |
| 179 |
String messageText = "Originally defined here."; |
| 180 |
String err = sourceFilePath + ":3: " + messageText; |
| 181 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 182 |
assertHasCorrectErrorMessage(messages, messageText, 3, 5); |
| 183 |
} |
| 184 |
|
| 185 |
public void testParseAaptOutputWithRange5() throws IOException { |
| 186 |
// Check for aapt error which occurs when the attribute name in an item style declaration is |
| 187 |
// non-existent. |
| 188 |
createTempXmlFile(); |
| 189 |
writeToFile("<resources xmlns:android='http://schemas.android.com/apk/res/android'>", |
| 190 |
" <style name='wrongAttribute'>", |
| 191 |
" <item name='nonexistent'>left</item>"); |
| 192 |
String messageText = "No resource found that matches the given name: attr 'nonexistent'."; |
| 193 |
String err = sourceFilePath + ":3: error: Error: " + messageText; |
| 194 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 195 |
assertHasCorrectErrorMessage(messages, messageText, 3, 17); |
| 196 |
} |
| 197 |
|
| 198 |
public void testParseAaptOutputWithRange6() throws IOException { |
| 199 |
// Test missing resource name. |
| 200 |
createTempXmlFile(); |
| 201 |
writeToFile("<resources xmlns:android='http://schemas.android.com/apk/res/android'>", |
| 202 |
" <style>"); |
| 203 |
String messageText = "A 'name' attribute is required for <style>"; |
| 204 |
String err = sourceFilePath + ":2: error: " + messageText; |
| 205 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 206 |
assertHasCorrectErrorMessage(messages, messageText, 2, 3); |
| 207 |
} |
| 208 |
|
| 209 |
public void testParseAaptOutputWithRange7() throws IOException { |
| 210 |
createTempXmlFile(); |
| 211 |
writeToFile("<resources xmlns:android='http://schemas.android.com/apk/res/android'>", |
| 212 |
" <item>"); |
| 213 |
String messageText = "A 'type' attribute is required for <item>"; |
| 214 |
String err = sourceFilePath + ":2: error: " + messageText; |
| 215 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 216 |
assertHasCorrectErrorMessage(messages, messageText, 2, 3); |
| 217 |
} |
| 218 |
|
| 219 |
public void testParseAaptOutputWithRange8() throws IOException { |
| 220 |
createTempXmlFile(); |
| 221 |
writeToFile("<resources xmlns:android='http://schemas.android.com/apk/res/android'>", |
| 222 |
" <item>"); |
| 223 |
String messageText = "A 'name' attribute is required for <item>"; |
| 224 |
String err = sourceFilePath + ":2: error: " + messageText; |
| 225 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 226 |
assertHasCorrectErrorMessage(messages, messageText, 2, 3); |
| 227 |
} |
| 228 |
|
| 229 |
public void testParseAaptOutputWithRange9() throws IOException { |
| 230 |
createTempXmlFile(); |
| 231 |
writeToFile("<resources xmlns:android='http://schemas.android.com/apk/res/android'>", |
| 232 |
" <style name='test'>", |
| 233 |
" <item name='android:layout_width'></item>"); |
| 234 |
String messageText = "String types not allowed (at 'android:layout_width' with value '')."; |
| 235 |
String err = sourceFilePath + ":3: error: " + messageText; |
| 236 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 237 |
assertHasCorrectErrorMessage(messages, messageText, 3, 21); |
| 238 |
} |
| 239 |
|
| 240 |
public void testParseAaptOutputWithRange10() throws IOException { |
| 241 |
createTempXmlFile(); |
| 242 |
writeToFile("<FrameLayout", |
| 243 |
" xmlns:android='http://schemas.android.com/apk/res/android'", |
| 244 |
" android:layout_width='wrap_content'", |
| 245 |
" android:layout_height='match_parent'>", |
| 246 |
" <TextView", |
| 247 |
" android:layout_width='fill_parent'", |
| 248 |
" android:layout_height='wrap_content'", |
| 249 |
" android:layout_marginTop=''", |
| 250 |
" android:layout_marginLeft=''"); |
| 251 |
String messageText = "String types not allowed (at 'layout_marginTop' with value '')."; |
| 252 |
String err = sourceFilePath + ":5: error: Error: " + messageText; |
| 253 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 254 |
assertHasCorrectErrorMessage(messages, messageText, 8, 34); |
| 255 |
} |
| 256 |
|
| 257 |
public void testParseAaptOutputWithRange11() throws IOException { |
| 258 |
createTempXmlFile(); |
| 259 |
writeToFile("<FrameLayout", |
| 260 |
" xmlns:android='http://schemas.android.com/apk/res/android'", |
| 261 |
" android:layout_width='wrap_content'", |
| 262 |
" android:layout_height='match_parent'>", |
| 263 |
" <TextView", |
| 264 |
" android:layout_width='fill_parent'", |
| 265 |
" android:layout_height='wrap_content'", |
| 266 |
" android:layout_marginTop=''", |
| 267 |
" android:layout_marginLeft=''"); |
| 268 |
String messageText = "String types not allowed (at 'layout_marginLeft' with value '')."; |
| 269 |
String err = sourceFilePath + ":5: error: Error: " + messageText; |
| 270 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 271 |
assertHasCorrectErrorMessage(messages, messageText, 9, 35); |
| 272 |
} |
| 273 |
|
| 274 |
public void testParseAaptOutputWithRange12() throws IOException { |
| 275 |
createTempXmlFile(); |
| 276 |
writeToFile("<FrameLayout", |
| 277 |
" xmlns:android='http://schemas.android.com/apk/res/android'", |
| 278 |
" android:layout_width='wrap_content'", |
| 279 |
" android:layout_height='match_parent'>", |
| 280 |
" <TextView", |
| 281 |
" android:id=''"); |
| 282 |
String messageText = "String types not allowed (at 'id' with value '')."; |
| 283 |
String err = sourceFilePath + ":5: error: Error: " + messageText; |
| 284 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 285 |
assertHasCorrectErrorMessage(messages, messageText, 6, 20); |
| 286 |
} |
| 287 |
|
| 288 |
private void createTempXmlFile() throws IOException { |
| 289 |
createTempFile(DOT_XML); |
| 290 |
} |
| 291 |
|
| 292 |
private void createTempFile(@NonNull String fileExtension) throws IOException { |
| 293 |
sourceFile = File.createTempFile(AaptOutputParserTest.class.getName(), fileExtension); |
| 294 |
sourceFilePath = sourceFile.getAbsolutePath(); |
| 295 |
} |
| 296 |
|
| 297 |
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed") |
| 298 |
private void writeToFile(@NonNull String... lines) throws IOException { |
| 299 |
BufferedWriter out = null; |
| 300 |
try { |
| 301 |
out = new BufferedWriter(new FileWriter(sourceFile)); |
| 302 |
for (String line : lines) { |
| 303 |
out.write(line); |
| 304 |
out.newLine(); |
| 305 |
} |
| 306 |
} finally { |
| 307 |
Closeables.close(out, true /* swallowIOException */); |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
/** |
| 312 |
* Assert the error message is correct. |
| 313 |
* |
| 314 |
* @param messages a collection of Messages |
| 315 |
* @param expectedText the text the single gradle message should have. |
| 316 |
* @param expectedLine the 1-based line |
| 317 |
* @param expectedColumn the 1-based column. |
| 318 |
*/ |
| 319 |
private void assertHasCorrectErrorMessage(@NonNull Collection<Message> messages, |
| 320 |
@NonNull String expectedText, |
| 321 |
int expectedLine, |
| 322 |
int expectedColumn) { |
| 323 |
assertEquals("[message count]", 1, messages.size()); |
| 324 |
Message message = messages.iterator().next(); |
| 325 |
assertEquals("[source file position count]", 1, message.getSourceFilePositions().size()); |
| 326 |
SourceFilePosition position = message.getSourceFilePositions().get(0); |
| 327 |
assertEquals("[file path]", sourceFilePath, position.getFile().toString()); |
| 328 |
assertEquals("[message severity]", Message.Kind.ERROR, message.getKind()); |
| 329 |
assertEquals("[message text]", expectedText, message.getText()); |
| 330 |
assertEquals("[position line]", expectedLine, position.getPosition().getStartLine() + 1); |
| 331 |
assertEquals("[position column]", expectedColumn, position.getPosition().getStartColumn() + 1); |
| 332 |
} |
| 333 |
|
| 334 |
@Test |
| 335 |
public void testRedirectValueLinksOutput() throws Exception { |
| 336 |
if (!setupSdkHome()) { |
| 337 |
System.out.println( |
| 338 |
"Skipping testRedirectValueLinksOutput because sdk-common was not found"); |
| 339 |
return; |
| 340 |
} |
| 341 |
|
| 342 |
// Need file to be named (exactly) values.xml |
| 343 |
File tempDir = temporaryFolder.newFolder(); |
| 344 |
File valueDir = new File(tempDir, "values-en"); |
| 345 |
valueDir.mkdirs(); |
| 346 |
sourceFile = new File(valueDir, |
| 347 |
"values.xml"); // Keep in sync with MergedResourceWriter.FN_VALUES_XML |
| 348 |
sourceFilePath = sourceFile.getAbsolutePath(); |
| 349 |
|
| 350 |
writeToFile( |
| 351 |
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + |
| 352 |
"<resources xmlns:ns1=\"urn:oasis:names:tc:xliff:document:1.2\"" + |
| 353 |
" xmlns:tools=\"http://schemas.android.com/tools\"" + |
| 354 |
" xmlns:alias_for_tools=\"http://schemas.android.com/tools\">\n" + |
| 355 |
"\n" + |
| 356 |
" <!-- From: src/test/resources/testData/resources/baseSet/values/values.xml -->\n" |
| 357 |
+ |
| 358 |
" <string-array name=\"string_array\" translatable=\"false\">\n" + |
| 359 |
" <item/> <!-- 0 -->\n" + |
| 360 |
" <item/> <!-- 1 -->\n" + |
| 361 |
" <item>ABC</item> <!-- 2 -->\n" + |
| 362 |
" <item>DEF</item> <!-- 3 -->\n" + |
| 363 |
" <item>GHI</item> <!-- 4 -->\n" + |
| 364 |
" <item>JKL</item> <!-- 5 -->\n" + |
| 365 |
" <item>MNO</item> <!-- 6 -->\n" + |
| 366 |
" <item>PQRS</item> <!-- 7 -->\n" + |
| 367 |
" <item>TUV</item> <!-- 8 -->\n" + |
| 368 |
" <item>WXYZ</item> <!-- 9 -->\n" + |
| 369 |
" </string-array>\n" + |
| 370 |
"\n" + |
| 371 |
" <attr name=\"dimen_attr\" format=\"dimension\" />\n" + |
| 372 |
" <attr name=\"enum_attr\">\n" + |
| 373 |
" <enum name=\"normal\" value=\"0\" />\n" + |
| 374 |
" <enum name=\"sans\" value=\"1\" />\n" + |
| 375 |
" <enum name=\"serif\" value=\"2\" />\n" + |
| 376 |
" <enum name=\"monospace\" value=\"3\" />\n" + |
| 377 |
" </attr>\n" + |
| 378 |
" <attr name=\"flag_attr\">\n" + |
| 379 |
" <flag name=\"normal\" value=\"0\" />\n" + |
| 380 |
" <flag name=\"bold\" value=\"1\" />\n" + |
| 381 |
" <flag name=\"italic\" value=\"2\" />\n" + |
| 382 |
" </attr>\n" + |
| 383 |
" <attr name=\"string_attr\" format=\"string\" />\n" + |
| 384 |
" <!-- From: src/test/resources/testData/resources/baseMerge/overlay/values/values.xml -->\n" |
| 385 |
+ |
| 386 |
" <color name=\"color\">#FFFFFFFF</color>\n" + |
| 387 |
" <!-- From: src/test/resources/testData/resources/baseSet/values/values.xml -->\n" |
| 388 |
+ |
| 389 |
" <declare-styleable name=\"declare_styleable\">\n" + |
| 390 |
"\n" + |
| 391 |
" <!-- ============== -->\n" + |
| 392 |
" <!-- Generic styles -->\n" + |
| 393 |
" <!-- ============== -->\n" + |
| 394 |
" <eat-comment />\n" + |
| 395 |
"\n" + |
| 396 |
" <!-- Default color of foreground imagery. -->\n" + |
| 397 |
" <attr name=\"blah\" format=\"color\" />\n" + |
| 398 |
" <!-- Default color of foreground imagery on an inverted background. -->\n" |
| 399 |
+ |
| 400 |
" <attr name=\"android:colorForegroundInverse\" />\n" + |
| 401 |
" </declare-styleable>\n" + |
| 402 |
"\n" + |
| 403 |
" <dimen name=\"dimen\">164dp</dimen>\n" + |
| 404 |
"\n" + |
| 405 |
" <drawable name=\"color_drawable\">#ffffffff</drawable>\n" + |
| 406 |
" <drawable name=\"drawable_ref\">@drawable/stat_notify_sync_anim0</drawable>\n" |
| 407 |
+ |
| 408 |
"\n" + |
| 409 |
" <item name=\"item_id\" type=\"id\"/>\n" + |
| 410 |
"\n" + |
| 411 |
" <integer name=\"integer\">75</integer>\n" + |
| 412 |
" <!-- From: src/test/resources/testData/resources/baseMerge/overlay/values/values.xml -->\n" |
| 413 |
+ |
| 414 |
" <item name=\"file_replaced_by_alias\" type=\"layout\">@layout/ref</item>\n" |
| 415 |
+ |
| 416 |
" <!-- From: src/test/resources/testData/resources/baseSet/values/values.xml -->\n" |
| 417 |
+ |
| 418 |
" <item name=\"layout_ref\" type=\"layout\">@layout/ref</item>\n" + |
| 419 |
" <!-- From: src/test/resources/testData/resources/baseMerge/overlay/values/values.xml -->\n" |
| 420 |
+ |
| 421 |
" <string name=\"basic_string\">overlay_string</string>\n" + |
| 422 |
" <!-- From: src/test/resources/testData/resources/baseSet/values/values.xml -->\n" |
| 423 |
+ |
| 424 |
" <string name=\"styled_string\">Forgot your username or password\\?\\nVisit <b>google.com/accounts/recovery</b>.</string>\n" |
| 425 |
+ |
| 426 |
" <string name=\"xliff_string\"><ns1:g id=\"number\" example=\"123\">%1$s</ns1:g><ns1:g id=\"unit\" example=\"KB\">%2$s</ns1:g></string>\n" |
| 427 |
+ |
| 428 |
"\n" + |
| 429 |
" <style name=\"style\" parent=\"@android:style/Holo.Light\">\n" + |
| 430 |
" <item name=\"android:singleLine\">true</item>\n" + |
| 431 |
" <item name=\"android:textAppearance\">@style/TextAppearance.WindowTitle</item>\n" |
| 432 |
+ |
| 433 |
" <item name=\"android:shadowColor\">#BB000000</item>\n" + |
| 434 |
" <item name=\"android:shadowRadius\">2.75</item>\n" + |
| 435 |
" <item name=\"foo\">foo</item>\n" + |
| 436 |
" </style>\n" + |
| 437 |
"\n" + |
| 438 |
"</resources>\n"); |
| 439 |
|
| 440 |
String messageText |
| 441 |
= "String types not allowed (at 'drawable_ref' with value '@drawable/stat_notify_sync_anim0')."; |
| 442 |
String err = sourceFilePath + ":46: error: Error: " + messageText; |
| 443 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 444 |
assertEquals(1, messages.size()); |
| 445 |
|
| 446 |
assertEquals("[message count]", 1, messages.size()); |
| 447 |
Message message = messages.iterator().next(); |
| 448 |
|
| 449 |
assertNotNull(message); |
| 450 |
|
| 451 |
// NOT sourceFilePath; should be translated back from source comment |
| 452 |
assertEquals(new File ("src/test/resources/testData/resources/baseSet/values/values.xml").getAbsolutePath(), |
| 453 |
getSystemIndependentSourcePath(message)); |
| 454 |
|
| 455 |
assertEquals("[message severity]", Message.Kind.ERROR, message.getKind()); |
| 456 |
assertEquals("[message text]", messageText, message.getText()); |
| 457 |
assertEquals(1, message.getSourceFilePositions().size()); |
| 458 |
SourcePosition pos = message.getSourceFilePositions().get(0).getPosition(); |
| 459 |
assertEquals("[position line]", 11, pos.getStartLine() + 1); |
| 460 |
assertEquals("[position column]", 35, pos.getStartColumn() + 1); |
| 461 |
} |
| 462 |
|
| 463 |
@Test |
| 464 |
public void testRedirectFileLinksOutput() throws Exception { |
| 465 |
if (!setupSdkHome()) { |
| 466 |
System.out.println( |
| 467 |
"Skipping testRedirectFileLinksOutput because sdk-common was not found"); |
| 468 |
return; |
| 469 |
} |
| 470 |
|
| 471 |
// Need file to be named (exactly) values.xml |
| 472 |
File tempDir = temporaryFolder.newFolder(); |
| 473 |
File layoutDir = new File(tempDir, "layout-land"); |
| 474 |
layoutDir.mkdirs(); |
| 475 |
sourceFile = new File(layoutDir, "main.xml"); |
| 476 |
sourceFilePath = sourceFile.getAbsolutePath(); |
| 477 |
|
| 478 |
writeToFile( |
| 479 |
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + |
| 480 |
"<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" |
| 481 |
+ |
| 482 |
" android:orientation=\"vertical\"\n" + |
| 483 |
" android:layout_width=\"fill_parent\"\n" + |
| 484 |
" android:layout_height=\"fill_parent\"\n" + |
| 485 |
" >\n" + |
| 486 |
"<TextView\n" + |
| 487 |
" android:layout_width=\"fill_parent\"\n" + |
| 488 |
" android:layout_height=\"wrap_content\"\n" + |
| 489 |
" android:text=\"Test App - Basic\"\n" + |
| 490 |
" android:id=\"@+id/text\"\n" + |
| 491 |
" />\n" + |
| 492 |
"</LinearLayout>\n" + |
| 493 |
"\n" + |
| 494 |
"<!-- From: file:src/test/resources/testData/resources/incMergeData/filesVsValues/main/layout/main.xml -->"); |
| 495 |
|
| 496 |
String messageText = "Random error message here"; |
| 497 |
String err = sourceFilePath + ":4: error: Error: " + messageText; |
| 498 |
Collection<Message> messages = parser.parseToolOutput(err); |
| 499 |
assertEquals("[message count]", 1, messages.size()); |
| 500 |
Message message = messages.iterator().next(); |
| 501 |
assertNotNull(message); |
| 502 |
|
| 503 |
// NOT sourceFilePath; should be translated back from source comment |
| 504 |
String expected = new File("src/test/resources/testData/resources/incMergeData/filesVsValues/main/layout/main.xml") |
| 505 |
.getAbsolutePath(); |
| 506 |
assertEquals("[file path]", expected, getSystemIndependentSourcePath(message)); |
| 507 |
assertEquals("[message severity]", Message.Kind.ERROR, message.getKind()); |
| 508 |
assertEquals("[message text]", messageText, message.getText()); |
| 509 |
assertEquals("[position line]", 4, message.getSourceFilePositions().get(0).getPosition().getStartLine() + 1); |
| 510 |
//assertEquals("[position column]", 35, message.getColumn()); |
| 511 |
|
| 512 |
// TODO: Test encoding issues (e.g. & in path where the XML source comment would be & instead) |
| 513 |
} |
| 514 |
|
| 515 |
public void test() throws Exception { |
| 516 |
File tempDir = temporaryFolder.newFolder(); |
| 517 |
sourceFile = new File(tempDir, "values.xml"); // Name matters for position search |
| 518 |
sourceFilePath = sourceFile.getAbsolutePath(); |
| 519 |
File source = new File(tempDir, "dimens.xml"); |
| 520 |
Files.write("<resources>\n" + |
| 521 |
" <!-- Default screen margins, per the Android Design guidelines. -->\n" + |
| 522 |
" <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n" + |
| 523 |
" <dimen name=\"activity_vertical_margin\">16dp</dimen>\n" + |
| 524 |
" <dimen name=\"new_name\">50</dimen>\n" + |
| 525 |
"</resources>", source, Charsets.UTF_8); |
| 526 |
source.deleteOnExit(); |
| 527 |
Files.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + |
| 528 |
"<resources>\n" + |
| 529 |
" <!-- From: file:/Users/unittest/AndroidStudioProjects/BlankProject1Project/BlankProject1/build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar/res/values/values.xml -->\n" |
| 530 |
+ |
| 531 |
" <dimen name=\"abc_action_bar_default_height\">48dip</dimen>\n" + |
| 532 |
" <dimen name=\"abc_action_bar_icon_vertical_padding\">8dip</dimen>\n" + |
| 533 |
" <!-- From: file:" + source.getPath() + " -->\n" + |
| 534 |
" <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n" + |
| 535 |
" <dimen name=\"activity_vertical_margin\">16dp</dimen>\n" + |
| 536 |
" <dimen name=\"ok\">50dp</dimen>\n" + |
| 537 |
" <dimen name=\"new_name\">50</dimen>\n" + |
| 538 |
" <!-- From: file:/Users/unittest/AndroidStudioProjects/BlankProject1Project/BlankProject1/build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar/res/values/values.xml -->\n" |
| 539 |
+ |
| 540 |
" <item name=\"action_bar_activity_content\" type=\"id\"/>\n" + |
| 541 |
" <item name=\"action_menu_divider\" type=\"id\"/>\n" + |
| 542 |
" <item name=\"action_menu_presenter\" type=\"id\"/>\n" + |
| 543 |
" <item name=\"home\" type=\"id\"/>\n" + |
| 544 |
"</resources>\n", sourceFile, Charsets.UTF_8); |
| 545 |
|
| 546 |
String output = |
| 547 |
":BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" |
| 548 |
+ |
| 549 |
":BlankProject1:prepareDebugDependencies\n" + |
| 550 |
":BlankProject1:mergeDebugAssets UP-TO-DATE\n" + |
| 551 |
":BlankProject1:compileDebugRenderscript UP-TO-DATE\n" + |
| 552 |
":BlankProject1:mergeDebugResources UP-TO-DATE\n" + |
| 553 |
":BlankProject1:processDebugManifest UP-TO-DATE\n" + |
| 554 |
":BlankProject1:processDebugResources\n" + |
| 555 |
sourceFilePath |
| 556 |
+ ":10: error: Error: Integer types not allowed (at 'new_name' with value '50').\n" |
| 557 |
+ |
| 558 |
":BlankProject1:processDebugResources FAILED\n" + |
| 559 |
"\n"; /* + |
| 560 |
"FAILURE: Build failed with an exception.\n" + |
| 561 |
"\n" + |
| 562 |
"* What went wrong:\n" + |
| 563 |
"Execution failed for task ':BlankProject1:processDebugResources'.\n" + |
| 564 |
"> Failed to run command:\n" + |
| 565 |
" \t/Users/tnorbye/dev/sdks/build-tools/18.0.1/aapt package -f --no-crunch -I ...\n" |
| 566 |
+ |
| 567 |
" Error Code:\n" + |
| 568 |
" \t1\n" + |
| 569 |
" Output:\n" + |
| 570 |
" \t" + sourceFilePath |
| 571 |
+ ":10: error: Error: Integer types not allowed (at 'new_name' with value '50').\n" |
| 572 |
+ |
| 573 |
"\n" + |
| 574 |
"\n" + |
| 575 |
"* Try:\n" + |
| 576 |
"Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\n" |
| 577 |
+ |
| 578 |
"\n" + |
| 579 |
"BUILD FAILED\n" + |
| 580 |
"\n" + |
| 581 |
"Total time: 5.435 secs"; */ |
| 582 |
|
| 583 |
String expected = |
| 584 |
"0: Simple::BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" |
| 585 |
+ |
| 586 |
"1: Simple::BlankProject1:prepareDebugDependencies\n" + |
| 587 |
"2: Simple::BlankProject1:mergeDebugAssets UP-TO-DATE\n" + |
| 588 |
"3: Simple::BlankProject1:compileDebugRenderscript UP-TO-DATE\n" + |
| 589 |
"4: Simple::BlankProject1:mergeDebugResources UP-TO-DATE\n" + |
| 590 |
"5: Simple::BlankProject1:processDebugManifest UP-TO-DATE\n" + |
| 591 |
"6: Simple::BlankProject1:processDebugResources\n" + |
| 592 |
"7: Error:Integer types not allowed (at 'new_name' with value '50').\n" + |
| 593 |
"\t" + source.getPath() + ":5:28-30\n" + |
| 594 |
"8: Simple::BlankProject1:processDebugResources FAILED\n"; /* + |
| 595 |
"9: Error:Error while executing aapt command\n" + |
| 596 |
"10: Error:Integer types not allowed (at 'new_name' with value '50').\n" + |
| 597 |
"\t" + source.getPath() + ":5:28\n" + |
| 598 |
"11: Error:Execution failed for task ':BlankProject1:processDebugResources'.\n" |
| 599 |
+ |
| 600 |
"12: Info:BUILD FAILED\n" + |
| 601 |
"13: Info:Total time: 5.435 secs\n";*/ |
| 602 |
String actual = |
| 603 |
toString(parser.parseToolOutput(output)); |
| 604 |
assertEquals(expected, actual); |
| 605 |
|
| 606 |
sourceFile.delete(); |
| 607 |
source.delete(); |
| 608 |
tempDir.delete(); |
| 609 |
} |
| 610 |
|
| 611 |
@Test |
| 612 |
public void testDashes() throws Exception { |
| 613 |
File tempDir = temporaryFolder.newFolder(); |
| 614 |
String dirName = currentPlatform() == PLATFORM_WINDOWS ? "My -- Q&A Dir" : "My -- Q&A< Dir"; |
| 615 |
File dir = new File(tempDir, |
| 616 |
dirName); // path which should force encoding of path chars, see for example issue 60050 |
| 617 |
dir.mkdirs(); |
| 618 |
sourceFile = new File(dir, "values.xml"); // Name matters for position search |
| 619 |
sourceFilePath = sourceFile.getAbsolutePath(); |
| 620 |
File source = new File(dir, "dimens.xml"); |
| 621 |
Files.write("<resources>\n" + |
| 622 |
" <!-- Default screen margins, per the Android Design guidelines. -->\n" + |
| 623 |
" <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n" + |
| 624 |
" <dimen name=\"activity_vertical_margin\">16dp</dimen>\n" + |
| 625 |
" <dimen name=\"new_name\">50</dimen>\n" + |
| 626 |
"</resources>", source, Charsets.UTF_8); |
| 627 |
source.deleteOnExit(); |
| 628 |
Files.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + |
| 629 |
"<resources>\n" + |
| 630 |
" <!-- From: file:/Users/unittest/AndroidStudioProjects/BlankProject1Project/BlankProject1/build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar/res/values/values.xml -->\n" |
| 631 |
+ |
| 632 |
" <dimen name=\"abc_action_bar_default_height\">48dip</dimen>\n" + |
| 633 |
" <dimen name=\"abc_action_bar_icon_vertical_padding\">8dip</dimen>\n" + |
| 634 |
" <!-- " + createPathComment(source, false) + " -->\n" + |
| 635 |
" <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n" + |
| 636 |
" <dimen name=\"activity_vertical_margin\">16dp</dimen>\n" + |
| 637 |
" <dimen name=\"ok\">50dp</dimen>\n" + |
| 638 |
" <dimen name=\"new_name\">50</dimen>\n" + |
| 639 |
" <!-- From: file:/Users/unittest/AndroidStudioProjects/BlankProject1Project/BlankProject1/build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar/res/values/values.xml -->\n" |
| 640 |
+ |
| 641 |
" <item name=\"action_bar_activity_content\" type=\"id\"/>\n" + |
| 642 |
" <item name=\"action_menu_divider\" type=\"id\"/>\n" + |
| 643 |
" <item name=\"action_menu_presenter\" type=\"id\"/>\n" + |
| 644 |
" <item name=\"home\" type=\"id\"/>\n" + |
| 645 |
"</resources>\n", sourceFile, Charsets.UTF_8); |
| 646 |
|
| 647 |
// TODO: Test layout too |
| 648 |
|
| 649 |
String output = |
| 650 |
":BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" |
| 651 |
+ |
| 652 |
":BlankProject1:prepareDebugDependencies\n" + |
| 653 |
":BlankProject1:mergeDebugAssets UP-TO-DATE\n" + |
| 654 |
":BlankProject1:compileDebugRenderscript UP-TO-DATE\n" + |
| 655 |
":BlankProject1:mergeDebugResources UP-TO-DATE\n" + |
| 656 |
":BlankProject1:processDebugManifest UP-TO-DATE\n" + |
| 657 |
":BlankProject1:processDebugResources\n" + |
| 658 |
sourceFilePath |
| 659 |
+ ":10: error: Error: Integer types not allowed (at 'new_name' with value '50').\n" |
| 660 |
+ |
| 661 |
":BlankProject1:processDebugResources FAILED\n"; |
| 662 |
|
| 663 |
String expected = |
| 664 |
"0: Simple::BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" |
| 665 |
+ |
| 666 |
"1: Simple::BlankProject1:prepareDebugDependencies\n" + |
| 667 |
"2: Simple::BlankProject1:mergeDebugAssets UP-TO-DATE\n" + |
| 668 |
"3: Simple::BlankProject1:compileDebugRenderscript UP-TO-DATE\n" + |
| 669 |
"4: Simple::BlankProject1:mergeDebugResources UP-TO-DATE\n" + |
| 670 |
"5: Simple::BlankProject1:processDebugManifest UP-TO-DATE\n" + |
| 671 |
"6: Simple::BlankProject1:processDebugResources\n" + |
| 672 |
"7: Error:Integer types not allowed (at 'new_name' with value '50').\n" + |
| 673 |
"\t" + source.getPath() + ":5:28-30\n" + |
| 674 |
"8: Simple::BlankProject1:processDebugResources FAILED\n"; |
| 675 |
String actual = toString(parser.parseToolOutput(output)); |
| 676 |
|
| 677 |
assertEquals(expected, actual); |
| 678 |
sourceFile.delete(); |
| 679 |
source.delete(); |
| 680 |
dir.delete(); |
| 681 |
tempDir.delete(); |
| 682 |
} |
| 683 |
|
| 684 |
@Test |
| 685 |
public void testLayoutFileSuffix() throws Exception { |
| 686 |
File tempDir = temporaryFolder.newFolder(); |
| 687 |
sourceFile = new File(tempDir, "layout.xml"); |
| 688 |
sourceFilePath = sourceFile.getAbsolutePath(); |
| 689 |
File source = new File(tempDir, "real-layout.xml"); |
| 690 |
Files.write( |
| 691 |
"<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + |
| 692 |
" xmlns:tools=\"http://schemas.android.com/tools\"\n" + |
| 693 |
" android:layout_width=\"match_parent\"\n" + |
| 694 |
" android:layout_height=\"match_parent\"\n" + |
| 695 |
" android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n" + |
| 696 |
" android:paddingRight=\"@dimen/activity_horizontal_margin\"\n" + |
| 697 |
" android:paddingTop=\"@dimen/activity_vertical_margin\"\n" + |
| 698 |
" android:paddingBottom=\"@dimen/activity_vertical_margin\"\n" + |
| 699 |
" tools:context=\".MainActivity\">\n" + |
| 700 |
"\n" + |
| 701 |
"\n" + |
| 702 |
" <Button\n" + |
| 703 |
" android:layout_width=\"wrap_content\"\n" + |
| 704 |
" android:layout_height=\"wrap_content\"\n" + |
| 705 |
" android:hint=\"fy faen\"\n" + |
| 706 |
" android:text=\"@string/hello_world\"\n" + |
| 707 |
" android:slayout_alignParentTop=\"true\"\n" + |
| 708 |
" android:layout_alignParentLeft=\"true\" />\n" + |
| 709 |
"\n" + |
| 710 |
"</RelativeLayout>\n", source, Charsets.UTF_8); |
| 711 |
source.deleteOnExit(); |
| 712 |
Files.write( |
| 713 |
"<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + |
| 714 |
" xmlns:tools=\"http://schemas.android.com/tools\"\n" + |
| 715 |
" android:layout_width=\"match_parent\"\n" + |
| 716 |
" android:layout_height=\"match_parent\"\n" + |
| 717 |
" android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n" + |
| 718 |
" android:paddingRight=\"@dimen/activity_horizontal_margin\"\n" + |
| 719 |
" android:paddingTop=\"@dimen/activity_vertical_margin\"\n" + |
| 720 |
" android:paddingBottom=\"@dimen/activity_vertical_margin\"\n" + |
| 721 |
" tools:context=\".MainActivity\">\n" + |
| 722 |
"\n" + |
| 723 |
" <!--style=\"@style/Buttons\"-->\n" + |
| 724 |
" <Button\n" + |
| 725 |
" android:layout_width=\"wrap_content\"\n" + |
| 726 |
" android:layout_height=\"wrap_content\"\n" + |
| 727 |
" android:hint=\"fy faen\"\n" + |
| 728 |
" android:text=\"@string/hello_world\"\n" + |
| 729 |
" android:slayout_alignParentTop=\"true\"\n" + |
| 730 |
" android:layout_alignParentLeft=\"true\" />\n" + |
| 731 |
"\n" + |
| 732 |
"</RelativeLayout>\n" + |
| 733 |
"<!-- " + createPathComment(source, false) + " -->", sourceFile, |
| 734 |
Charsets.UTF_8); |
| 735 |
|
| 736 |
String output = |
| 737 |
":BlankProject1:preBuild UP-TO-DATE\n" + |
| 738 |
":BlankProject1:preDebugBuild UP-TO-DATE\n" + |
| 739 |
":BlankProject1:preReleaseBuild UP-TO-DATE\n" + |
| 740 |
":BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" |
| 741 |
+ |
| 742 |
":BlankProject1:prepareDebugDependencies\n" + |
| 743 |
":BlankProject1:compileDebugAidl UP-TO-DATE\n" + |
| 744 |
":BlankProject1:compileDebugRenderscript UP-TO-DATE\n" + |
| 745 |
":BlankProject1:generateDebugBuildConfig UP-TO-DATE\n" + |
| 746 |
":BlankProject1:mergeDebugAssets UP-TO-DATE\n" + |
| 747 |
":BlankProject1:mergeDebugResources UP-TO-DATE\n" + |
| 748 |
":BlankProject1:processDebugManifest UP-TO-DATE\n" + |
| 749 |
":BlankProject1:processDebugResources\n" + |
| 750 |
sourceFilePath |
| 751 |
+ ":12: error: No resource identifier found for attribute 'slayout_alignParentTop' in package 'android'\n" |
| 752 |
+ |
| 753 |
":BlankProject1:processDebugResources FAILED\n"; |
| 754 |
|
| 755 |
assertEquals("0: Simple::BlankProject1:preBuild UP-TO-DATE\n" + |
| 756 |
"1: Simple::BlankProject1:preDebugBuild UP-TO-DATE\n" + |
| 757 |
"2: Simple::BlankProject1:preReleaseBuild UP-TO-DATE\n" + |
| 758 |
"3: Simple::BlankProject1:prepareComAndroidSupportAppcompatV71800Library UP-TO-DATE\n" |
| 759 |
+ |
| 760 |
"4: Simple::BlankProject1:prepareDebugDependencies\n" + |
| 761 |
"5: Simple::BlankProject1:compileDebugAidl UP-TO-DATE\n" + |
| 762 |
"6: Simple::BlankProject1:compileDebugRenderscript UP-TO-DATE\n" + |
| 763 |
"7: Simple::BlankProject1:generateDebugBuildConfig UP-TO-DATE\n" + |
| 764 |
"8: Simple::BlankProject1:mergeDebugAssets UP-TO-DATE\n" + |
| 765 |
"9: Simple::BlankProject1:mergeDebugResources UP-TO-DATE\n" + |
| 766 |
"10: Simple::BlankProject1:processDebugManifest UP-TO-DATE\n" + |
| 767 |
"11: Simple::BlankProject1:processDebugResources\n" + |
| 768 |
"12: Error:No resource identifier found for attribute 'slayout_alignParentTop' in package 'android'\n" |
| 769 |
+ |
| 770 |
"\t" + source.getPath() + ":12\n" + |
| 771 |
"13: Simple::BlankProject1:processDebugResources FAILED\n", |
| 772 |
toString(parser.parseToolOutput(output))); |
| 773 |
|
| 774 |
sourceFile.delete(); |
| 775 |
source.delete(); |
| 776 |
tempDir.delete(); |
| 777 |
} |
| 778 |
|
| 779 |
@Test |
| 780 |
public void testMismatchedTag() throws Exception { |
| 781 |
// https://code.google.com/p/android/issues/detail?id=59824 |
| 782 |
createTempXmlFile(); |
| 783 |
String output = |
| 784 |
":AudioPlayer:prepareDebugDependencies\n" + |
| 785 |
":AudioPlayer:compileDebugAidl UP-TO-DATE\n" + |
| 786 |
":AudioPlayer:generateDebugBuildConfig UP-TO-DATE\n" + |
| 787 |
":AudioPlayer:mergeDebugAssets UP-TO-DATE\n" + |
| 788 |
":AudioPlayer:compileDebugRenderscript UP-TO-DATE\n" + |
| 789 |
":AudioPlayer:mergeDebugResources UP-TO-DATE\n" + |
| 790 |
":AudioPlayer:processDebugManifest UP-TO-DATE\n" + |
| 791 |
":AudioPlayer:processDebugResources\n" + |
| 792 |
sourceFilePath + ":101: error: Error parsing XML: mismatched tag\n" + |
| 793 |
":AudioPlayer:processDebugResources FAILED\n" + |
| 794 |
"\n"; |
| 795 |
assertEquals("0: Simple::AudioPlayer:prepareDebugDependencies\n" + |
| 796 |
"1: Simple::AudioPlayer:compileDebugAidl UP-TO-DATE\n" + |
| 797 |
"2: Simple::AudioPlayer:generateDebugBuildConfig UP-TO-DATE\n" + |
| 798 |
"3: Simple::AudioPlayer:mergeDebugAssets UP-TO-DATE\n" + |
| 799 |
"4: Simple::AudioPlayer:compileDebugRenderscript UP-TO-DATE\n" + |
| 800 |
"5: Simple::AudioPlayer:mergeDebugResources UP-TO-DATE\n" + |
| 801 |
"6: Simple::AudioPlayer:processDebugManifest UP-TO-DATE\n" + |
| 802 |
"7: Simple::AudioPlayer:processDebugResources\n" + |
| 803 |
"8: Error:Error parsing XML: mismatched tag\n" + |
| 804 |
"\t" + sourceFilePath + ":101\n" + |
| 805 |
"9: Simple::AudioPlayer:processDebugResources FAILED\n", |
| 806 |
toString(parser.parseToolOutput(output))); |
| 807 |
sourceFile.delete(); |
| 808 |
} |
| 809 |
} |