Index: third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessTemplateArgParser.java |
diff --git a/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessTemplateArgParser.java b/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessTemplateArgParser.java |
index 1df401a7b7120470fbd68fcd845f416e1aa4a394..20cb1de32a39c27df2e6fa092493b07092280743 100644 |
--- a/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessTemplateArgParser.java |
+++ b/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessTemplateArgParser.java |
@@ -6,12 +6,14 @@ package org.chromium.testing.robolectric.template; |
import java.nio.file.Path; |
import java.nio.file.Paths; |
- |
+import java.util.LinkedList; |
+import java.util.List; |
/** |
* Parses command line arguments for ProcessRobolectricTemplate. |
*/ |
public class ProcessTemplateArgParser { |
+ private List<TemplateFileInfo> mTemplateFileInfoList; |
private Path mBaseTemplateDir; |
private Path mOutputDir; |
private Integer mApiLevel; |
@@ -29,15 +31,20 @@ public class ProcessTemplateArgParser { |
argName = args[i].substring(1, args[i].length()); |
} |
try { |
- if ("output-dir".equals(argName)) { |
+ if ("process-file".equals(argName)) { |
+ // Read the two command line arguments after the flag. |
+ // Format is --process-file <template file> <output file>. |
+ // Argument can be passed multiple times. |
+ Path templatePath = Paths.get(args[++i]); |
+ Path outputPath = Paths.get(args[++i]); |
+ parsed.addTemplateFileInfo( |
+ new TemplateFileInfo(templatePath, outputPath)); |
+ } else if ("api-level".equals(argName)) { |
// Read the command line argument after the flag. |
- parsed.setOutputDir(args[++i]); |
+ parsed.setApiLevel(args[++i]); |
} else if ("base-template-dir".equals(argName)) { |
// Read the command line argument after the flag. |
parsed.setBaseTemplateDir(args[++i]); |
- } else if ("api-level".equals(argName)) { |
- // Read the command line argument after the flag. |
- parsed.setApiLevel(args[++i]); |
} else { |
System.out.println("Ignoring flag: \"" + argName + "\""); |
} |
@@ -50,11 +57,6 @@ public class ProcessTemplateArgParser { |
} |
} |
- if (parsed.getOutputDir() == null) { |
- System.err.println("--output-dir argument required."); |
- System.exit(1); |
- } |
- |
if (parsed.getBaseTemplateDir() == null) { |
System.err.println("--base-template-dir argument required."); |
System.exit(1); |
@@ -68,32 +70,33 @@ public class ProcessTemplateArgParser { |
} |
private ProcessTemplateArgParser() { |
+ mApiLevel = null; |
mBaseTemplateDir = null; |
mOutputDir = null; |
- mApiLevel = null; |
+ mTemplateFileInfoList = new LinkedList<TemplateFileInfo>(); |
+ } |
+ |
+ public Integer getApiLevel() { |
+ return mApiLevel; |
} |
public Path getBaseTemplateDir() { |
return mBaseTemplateDir; |
} |
- public Path getOutputDir() { |
- return mOutputDir; |
+ public List<TemplateFileInfo> getTemplateFileInfoList() { |
+ return mTemplateFileInfoList; |
} |
- public Integer getApiLevel() { |
- return mApiLevel; |
+ private void setApiLevel(String integer) { |
+ mApiLevel = Integer.parseInt(integer); |
} |
private void setBaseTemplateDir(String path) { |
mBaseTemplateDir = Paths.get(path); |
} |
- private void setOutputDir(String path) { |
- mOutputDir = Paths.get(path); |
- } |
- |
- private void setApiLevel(String integer) { |
- mApiLevel = Integer.parseInt(integer); |
+ private void addTemplateFileInfo(TemplateFileInfo templateFileInfo) { |
+ mTemplateFileInfoList.add(templateFileInfo); |
} |
} |