Use full file path in error string.
PiperOrigin-RevId: 302062150
diff --git a/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java b/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java
index 82bf8da..1e1ccf9 100644
--- a/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java
+++ b/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java
@@ -153,8 +153,7 @@
new IllegalArgumentException("Unexpected resource folder for file: " + file));
}
- final String filename =
- interpolateAapt2Filename(resourceFolderType, file.getFileName().toString());
+ final String filename = interpolateAapt2Filename(resourceFolderType, file);
final List<Path> results = new ArrayList<>();
if (resourceFolderType.equals(ResourceFolderType.VALUES)
|| (resourceFolderType.equals(ResourceFolderType.RAW)
@@ -181,8 +180,9 @@
return results;
}
- static String interpolateAapt2Filename(ResourceFolderType resourceFolderType, String filename) {
+ static String interpolateAapt2Filename(ResourceFolderType resourceFolderType, Path file) {
// res/<not values>/foo.bar -> foo.bar
+ String filename = file.getFileName().toString();
if (!resourceFolderType.equals(ResourceFolderType.VALUES)) {
return filename;
}
@@ -200,7 +200,7 @@
new IllegalArgumentException(
"aapt2 does not support compiling resource xmls with multiple periods in the "
+ "filename: "
- + filename));
+ + file));
}
// res/values/foo.xml -> foo.arsc
@@ -296,8 +296,10 @@
CompilingVisitor.destinationPath(file, compiledResourcesOut)
.resolve(type + "_" + filename + CompiledResources.ATTRIBUTES_FILE_EXTENSION);
- Preconditions.checkArgument(!Files.exists(resourcesAttributesPath),
- "%s was already created for another resource.", resourcesAttributesPath);
+ Preconditions.checkArgument(
+ !Files.exists(resourcesAttributesPath),
+ "%s was already created for another resource.",
+ resourcesAttributesPath);
while (attributeIterator.hasNext()) {
Attribute attribute = attributeIterator.next();