Chromium Code Reviews| Index: third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessRobolectricTemplate.java |
| diff --git a/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessRobolectricTemplate.java b/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessRobolectricTemplate.java |
| index db72e49a42119703e43114e1b9d3eb8671b4d864..41773cf7db99a1e5c7273c1548f2b2be5f50048e 100644 |
| --- a/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessRobolectricTemplate.java |
| +++ b/third_party/robolectric/template_processor/src/org/chromium/testing/robolectric/template/ProcessRobolectricTemplate.java |
| @@ -42,7 +42,7 @@ public final class ProcessRobolectricTemplate { |
| Velocity.init(); |
| final VelocityContext context = new VelocityContext(); |
| - int api = parser.getApiLevel(); |
| + final int api = parser.getApiLevel(); |
| context.put("api", api); |
| if (api >= 21) { |
| context.put("ptrClass", "long"); |
| @@ -60,7 +60,7 @@ public final class ProcessRobolectricTemplate { |
| public FileVisitResult visitFile( |
| Path path, BasicFileAttributes attrs) throws IOException { |
| if (templatePathMatcher.matches(path)) { |
| - processTemplate(context, path, parser.getBaseTemplateDir(), parser.getOutputDir()); |
| + processTemplate(context, path, parser.getBaseTemplateDir(), parser.getOutputDir(), api); |
| } |
| return FileVisitResult.CONTINUE; |
| } |
| @@ -70,12 +70,12 @@ public final class ProcessRobolectricTemplate { |
| } |
| } |
| - private static void processTemplate(VelocityContext context, Path templateFile, Path baseTemplateDir, Path outputDir) throws IOException { |
| + private static void processTemplate(VelocityContext context, Path templateFile, Path baseTemplateDir, Path outputDir, int api_level) throws IOException { |
| final StringWriter stringWriter = new StringWriter(); |
| Template template = Velocity.getTemplate(baseTemplateDir.relativize(templateFile).toString(), "UTF-8"); |
| template.merge(context, stringWriter); |
| - String relativeOutputFile = templateFile.toString().replace(baseTemplateDir.toString(), "").replace(".vm", ""); |
| + String relativeOutputFile = "" + api_level + "/" + templateFile.toString().replace(baseTemplateDir.toString(), "").replace(".vm", ""); |
|
mikecase (-- gone --)
2016/07/31 04:21:10
Definitely ugliest hack in this CL. I need to gene
jbudorick
2016/08/01 13:52:04
😬
mikecase (-- gone --)
2016/08/02 06:12:26
Well, this got kinda committed in a different CL.
|
| if (relativeOutputFile.startsWith("/")) { |
| relativeOutputFile = relativeOutputFile.substring(1); |
| } |