aboutsummaryrefslogtreecommitdiffstats
path: root/lint/cli
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 /lint/cli
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 'lint/cli')
-rw-r--r--lint/cli/src/com/android/tools/lint/Main.java48
1 files changed, 27 insertions, 21 deletions
diff --git a/lint/cli/src/com/android/tools/lint/Main.java b/lint/cli/src/com/android/tools/lint/Main.java
index 8ca3c50..6cdb689 100644
--- a/lint/cli/src/com/android/tools/lint/Main.java
+++ b/lint/cli/src/com/android/tools/lint/Main.java
@@ -86,7 +86,7 @@ public class Main extends LintClient {
private static final String ARG_URL = "--url"; //$NON-NLS-1$
private static final String ARG_VERSION = "--version"; //$NON-NLS-1$
private static final String ARG_EXITCODE = "--exitcode"; //$NON-NLS-1$
- private static final String ARG_CLASSES = "--classes"; //$NON-NLS-1$
+ private static final String ARG_CLASSES = "--classpath"; //$NON-NLS-1$
private static final String ARG_SOURCES = "--sources"; //$NON-NLS-1$
private static final String ARG_NOWARN2 = "--nowarn"; //$NON-NLS-1$
@@ -466,29 +466,35 @@ public class Main extends LintClient {
System.err.println("Missing class folder name");
System.exit(ERRNO_INVALIDARGS);
}
- File input = getInArgumentPath(args[++index]);
- if (!input.exists()) {
- System.err.println("Source folder " + input + " does not exist.");
- System.exit(ERRNO_INVALIDARGS);
- }
- if (mClasses == null) {
- mClasses = new ArrayList<File>();
+ String paths = args[++index];
+ for (String path : LintUtils.splitPath(paths)) {
+ File input = getInArgumentPath(path);
+ if (!input.exists()) {
+ System.err.println("Class path entry " + input + " does not exist.");
+ System.exit(ERRNO_INVALIDARGS);
+ }
+ if (mClasses == null) {
+ mClasses = new ArrayList<File>();
+ }
+ mClasses.add(input);
}
- mClasses.add(input);
} else if (arg.equals(ARG_SOURCES)) {
if (index == args.length - 1) {
System.err.println("Missing source folder name");
System.exit(ERRNO_INVALIDARGS);
}
- File input = getInArgumentPath(args[++index]);
- if (!input.exists()) {
- System.err.println("Source folder " + input + " does not exist.");
- System.exit(ERRNO_INVALIDARGS);
- }
- if (mSources == null) {
- mSources = new ArrayList<File>();
+ String paths = args[++index];
+ for (String path : LintUtils.splitPath(paths)) {
+ File input = getInArgumentPath(path);
+ if (!input.exists()) {
+ System.err.println("Source folder " + input + " does not exist.");
+ System.exit(ERRNO_INVALIDARGS);
+ }
+ if (mSources == null) {
+ mSources = new ArrayList<File>();
+ }
+ mSources.add(input);
}
- mSources.add(input);
} else if (arg.startsWith("--")) {
System.err.println("Invalid argument " + arg + "\n");
printUsage(System.err);
@@ -943,10 +949,10 @@ public class Main extends LintClient {
ARG_XML + " <filename>", "Create an XML report instead.",
"", "\nProject Options:",
- ARG_SOURCES + " <dir>", "Add the given folder as a source directory for the " +
- "project. Only valid when running lint on a single project.",
- ARG_CLASSES + " <dir>", "Add the given folder (or jar file) as a class directory " +
- "for the project. Only valid when running lint on a single project.",
+ ARG_SOURCES + " <dir>", "Add the given folder (or path) as a source directory for " +
+ "the project. Only valid when running lint on a single project.",
+ ARG_CLASSES + " <dir>", "Add the given folder (or jar file, or path) as a class " +
+ "directory for the project. Only valid when running lint on a single project.",
"", "\nExit Status:",
"0", "Success.",