aboutsummaryrefslogtreecommitdiffstats
path: root/lint
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-01-31 13:16:10 -0800
committerTor Norbye <tnorbye@google.com>2012-01-31 13:28:21 -0800
commit825e060cb7a68f4022cf730439b0191ffece7dfd (patch)
tree765afa67938c100c44c52a195906311f1982944e /lint
parent06d233a4cc7a2476001830c80b6cfe3ad7f966c1 (diff)
downloadsdk-825e060cb7a68f4022cf730439b0191ffece7dfd.zip
sdk-825e060cb7a68f4022cf730439b0191ffece7dfd.tar.gz
sdk-825e060cb7a68f4022cf730439b0191ffece7dfd.tar.bz2
Emit relative paths in multi-project HTML reports
Change-Id: I2bf31a95fbb9835912df06eb9319820668019aeb
Diffstat (limited to 'lint')
-rw-r--r--lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java b/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java
index c8ebf16..42d61ef 100644
--- a/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java
+++ b/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java
@@ -112,8 +112,21 @@ class MultiProjectHtmlReporter extends Reporter {
}
reporter.write(projectErrorCount, projectWarningCount, issues);
+ String prefix = project.getReferenceDir().getPath();
+ String path = project.getDir().getPath();
+ String relative;
+ if (path.startsWith(prefix) && path.length() > prefix.length()) {
+ int i = prefix.length();
+ if (path.charAt(i) == File.separatorChar) {
+ i++;
+ }
+ relative = path.substring(i);
+ } else {
+ relative = projectName;
+ }
+
projects.add(new ProjectEntry(project, fileName, projectErrorCount,
- projectWarningCount));
+ projectWarningCount, relative));
}
// Write overview index?
@@ -187,7 +200,7 @@ class MultiProjectHtmlReporter extends Reporter {
writer.write("<a href=\"");
writer.write(entry.fileName); // TODO: Escape?
writer.write("\">"); //$NON-NLS-1$
- writer.write(entry.project.getName());
+ writer.write(entry.path);
writer.write("</a></td><td>"); //$NON-NLS-1$
writer.write(Integer.toString(entry.errorCount));
writer.write("</td><td>"); //$NON-NLS-1$
@@ -207,14 +220,16 @@ class MultiProjectHtmlReporter extends Reporter {
public int errorCount;
public int warningCount;
public String fileName;
+ public String path;
- public ProjectEntry(Project project, String fileName, int errorCount, int warningCount) {
- super();
+ public ProjectEntry(Project project, String fileName, int errorCount, int warningCount,
+ String path) {
this.project = project;
this.fileName = fileName;
this.errorCount = errorCount;
this.warningCount = warningCount;
+ this.path = path;
}
@Override
@@ -229,7 +244,7 @@ class MultiProjectHtmlReporter extends Reporter {
return delta;
}
- return project.getName().compareTo(other.project.getName());
+ return path.compareTo(other.path);
}
}
}