Fixed some more eol issues. genservice and gendobj work for me now.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6605 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2011-04-05 23:33:29 +00:00
parent c5a098119f
commit f3d6712cd2
2 changed files with 12 additions and 5 deletions
@@ -154,8 +154,8 @@ public class GenDObjectTask extends GenTask
// append the merged templates as appropriate to the string buffers
if (ii > 0) {
fsection.append("\n");
msection.append("\n");
fsection.append(EOL);
msection.append(EOL);
}
fsection.append(mergeTemplate(NAME_TMPL, data));
msection.append(mergeTemplate(BASE_TMPL + tname, data));
@@ -134,7 +134,7 @@ public abstract class GenTask extends Task
{
String output = mergeTemplate(templatePath, data);
if (_header != null) {
output = _header + output;
output = convertEols(_header) + output;
}
writeFile(outputPath, output);
}
@@ -166,7 +166,7 @@ public abstract class GenTask extends Task
protected boolean wouldProduceSameFile (String generated, File existing)
throws IOException
{
Iterator<String> generatedLines = Splitter.on('\n').split(generated).iterator();
Iterator<String> generatedLines = Splitter.on(EOL).split(generated).iterator();
for (String prev : Files.readLines(existing, UTF_8)) {
if (!generatedLines.hasNext()) {
return false;
@@ -207,7 +207,7 @@ public abstract class GenTask extends Task
{
Reader reader =
new InputStreamReader(getClass().getClassLoader().getResourceAsStream(template), UTF_8);
return Mustache.compiler().escapeHTML(false).compile(reader).execute(data);
return convertEols(Mustache.compiler().escapeHTML(false).compile(reader).execute(data));
}
protected Map<String, Object> createMap (Object... data)
@@ -253,6 +253,13 @@ public abstract class GenTask extends Task
}
}
protected static String convertEols (String str)
{
return str.replace("\n", EOL);
}
protected static String EOL = System.getProperty("line.separator");
/** A list of filesets that contain java source to be processed. */
protected List<FileSet> _filesets = Lists.newArrayList();