aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-08-06 07:39:03 -0700
committerTor Norbye <tnorbye@google.com>2012-08-06 08:32:05 -0700
commitee4780f1de04e7c87b3fe172a4b1510bd4c7e9bf (patch)
treea05c31329f5a92bc0e8b2c0225aafa8265cd45ce /anttasks
parent726ce505cb26f4375591729d41ea1395280d244d (diff)
downloadsdk-ee4780f1de04e7c87b3fe172a4b1510bd4c7e9bf.zip
sdk-ee4780f1de04e7c87b3fe172a4b1510bd4c7e9bf.tar.gz
sdk-ee4780f1de04e7c87b3fe172a4b1510bd4c7e9bf.tar.bz2
Allow lint cli --sources to specify a path, and use from ant lint
First, this changeset allows the arguments passed to --sources and --classpath (renamed from --classes) to specify not just a directory, but to specify a path as well. This might make it easier to invoke lint from scripts if you have a path variable, so you don't have to split it into multiple arguments. Second, it makes the lint task in ant use these, such that any build.xml customizations to the source paths or class paths are automatically used rather than relying on lint's default structure check. Change-Id: Id8e4caf0010d7fd7245844b3099b5dc0607f0aba
Diffstat (limited to 'anttasks')
-rw-r--r--anttasks/src/com/android/ant/LintExecTask.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/anttasks/src/com/android/ant/LintExecTask.java b/anttasks/src/com/android/ant/LintExecTask.java
index 64a6c00..3d687cb 100644
--- a/anttasks/src/com/android/ant/LintExecTask.java
+++ b/anttasks/src/com/android/ant/LintExecTask.java
@@ -28,6 +28,8 @@ public class LintExecTask extends ExecTask {
private String mExecutable;
private String mHtml;
private String mXml;
+ private Path mSourcePath;
+ private Path mClassPath;
/**
* Sets the value of the "executable" attribute.
@@ -37,6 +39,16 @@ public class LintExecTask extends ExecTask {
mExecutable = TaskHelper.checkSinglePath("executable", executable);
}
+ /** Sets the path where Java source code should be found */
+ public void setSrc(Path path) {
+ mSourcePath = path;
+ }
+
+ /** Sets the path where class files should be found */
+ public void setClasspath(Path path) {
+ mClassPath = path;
+ }
+
/**
* Sets the value of the "html" attribute: a path to a file or directory name
* where the HTML report should be written.
@@ -80,6 +92,16 @@ public class LintExecTask extends ExecTask {
task.createArg().setValue(mXml);
}
+ if (mSourcePath != null) {
+ task.createArg().setValue("--sources");
+ task.createArg().setValue(mSourcePath.toString());
+ }
+
+ if (mClassPath != null) {
+ task.createArg().setValue("--classpath");
+ task.createArg().setValue(mClassPath.toString());
+ }
+
task.createArg().setValue(getProject().getBaseDir().getAbsolutePath());
task.execute();
}